Using Face Recognition for automation

Using Face Recognition for automation

SUMMER-TASK-6 (Team Task) and ARTH TASK 38

GitHub ->

In this article I will explain how we can use Face Recognition and then send the mail and whatsapp message. Further if other face detected then we create EC2 instance in AWS!

For Face detection we are using LBPH algorithm

What is LBPH algorithm?

The Local Binary Pattern Histogram(LBPH) algorithm is a simple solution on face recognition problem, which can recognize both front face and side face. The gray value of the pixel is replaced by the median value of its neighborhood sampling value, and then the feature value is extracted by the sub blocks and the statistical histogram is established.

No alt text provided for this image

As we have an image in grayscale, each histogram (from each grid) will contain only 256 positions (0~255) representing the occurrences of each pixel intensity.

Then, we need to concatenate each histogram to create a new and bigger histogram. Supposing we have 8x8 grids, we will have 8x8x256=16.384 positions in the final histogram. The final histogram represents the characteristics of the image original image.

Let's create a LBPH model using Python

Collecting Dataset ->

No alt text provided for this image

Model training ->

No alt text provided for this image

The LBPH model is trained by using face_LBPHFaceRecognition.create() from cv2.

we need opencv-contrib-python so install by ->

pip install opencv-contrib-python        

Main Face Recognition Code ->

No alt text provided for this image

face_detector is a function that is called later in a loop, for getting image coordinates.

No alt text provided for this image

Now once the face is a detected we can take further actions!

No alt text provided for this image

Here the a is a variable acting as a switch variable to trigger the automation when the trained face is a detected.

Code to do whatsapp message ->

No alt text provided for this image

in the first argument of sendwhatmsg use the phone number with country code!

Code to do Mail ->

No alt text provided for this image
No alt text provided for this image

Terraform code ->

No alt text provided for this image


To view or add a comment, sign in

More articles by Yash Indane

  • Use of K-mean clustering in security domain

    Summer Task-10 & ARTH Task 42 Github -> What is K-means Clustering? K-means clustering is one of the simplest and…

  • OSPF Routing Protocol using Dijkastra Algorithm

    What is OSPF? The OSPF (Open Shortest Path First) protocol is one of a family of IP Routing protocols, and is an…

  • JavaScript use cases in Industry

    Summer Task 7.2 What is JavaScript? JavaScript, often abbreviated as JS, is a programming language that conforms to the…

    1 Comment
  • Use of confusion matrix in detecting cyber crime

    Summer 2021 Task 05 👨🏻💻 Particularly in the last decade, Internet usage has been growing rapidly. However, as the…

  • Running Chrome in Docker container

    Summer - Task 02 👨🏻💻 By default containers don't support GUI, but by some way we can achieve that, let's discuss…

    3 Comments
  • Training a ML model inside a container

    Task 01 👨🏻💻 Task Description 📄 👉 Pull the Docker container image of CentOS image from DockerHub and create a new…

    4 Comments
  • Deploying WordPress in Amazon EKS with RDS in Backend

    ARTH-TASK-23 WordPress is a free and open-source content management system written in PHP and paired with a MySQL or…

    3 Comments
  • How industry uses MongoDB

    ARTH-TASK-32 What is MongoDB? MongoDB is a source-available cross-platform document-oriented database program…

  • Creating a Multicloud Setup of Kubernetes using Ansible Roles

    TASK 28 Task Description 📄 📌 CREATE A MULTI-CLOUD SETUP of K8S cluster: 🔅 Lunch node in AWS 🔅 Lunch node in Azure…

    2 Comments
  • Helm and Charts in Kubernetes

    ARTH TASK 24 What are Charts ? A chart is a collection of files that describe a related set of Kubernetes resources. A…

Others also viewed

Explore content categories