Send Message on Whatsapp, Mail, and Launch AWS Instance Using Face Recognition.

In this particular task, we can perform some tasks using face recognition. So Let's start.:-

Task Description📄:-

1:- When it recognizes your face then.

(a)It sends mail to your mail-id by writing this is the face of your_name.
(b)Second, it sends a WhatsApp message to your friend, it can be anything.

2:When the model recognizes the other person's face.

(a)(a)It launches the EC2 instance with the help of CLI.

(b) Create 5 GB EBS volume and attach it to the instance.

So Let's start:-

First, when it recognizes your face, send a message to your friend and mail it to your Gmail ID.

First, we need a dataset, We have to recognize our face and collect the dataset. we can generate 100 images of our face data through the program.

In this particular task, we need some libraries like cv2, NumPy, os, pywhatkit, DateTime, subprocess, smtplib, etc. we have to use a haar cascade classifier to detect the face. we have captured the image and crop the face and put the particular folder.

In this image, explain how to save the images in the folder.

Libraries:-

PyWhatKit:- This library is used for sending the message on WhatsApp.

SMTPLib:- This library is used to send mail to any Internet machine with an SMTP listener daemon. Using SMTP protocol.

Subprocess:- The Subprocess module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes.

opencv-contribe-python

And in this task, we will need to read the image dataset and train the model. so we can use LBPH Face Recognizer to recognize the face to the dataset. So we need to install opencv-contrib-python this library.

Collect Dataset:-

In this program, we have collected the dataset of our face.

Train the Model:-

In this image, we have trained our model using LBPHfaceRecognizer.

Define the function:-

In this image, we have define the function for sending the message on whatsapp, mail to the mailID , and Launching the AWS instance.

Launch EC2 Instance:-

aws ec2 run-instances — image-id “your image id” — instance-type t2.micro — count 1 — subnet-id “your subnet id” — security-group-ids “security-group-id” — key-name “your key ” — tag-specifications ResourceType=instance,Tags=[{Key=Name,Value=anyname}] — query Instances[*].[InstanceId] — output text

Using this command, we will create the instance and give some commands. like — image id, instance type, count, subnet id, security group, key. and pick the launched instance id.

Create EBS Volume Size of 5GB:-

aws ec2 create-volume — volume-type gp2 — availability-zone ap-south-1a — size 5 — tag-specifications=ResourceType=volume,Tags=[{Key=Name, Value= volumename}] — query VolumeId — output text

Using this command, we will create the EBS Volume size of 5GB. This also gives the command and subcommand. and pick the created EBS volume id.

Now we have called the function:-

We have to create another function to detect the face in a video and draw the circle of the face. also, check the confidence score. and put some text and We are also calling the function that we have defined for WhatsApp, Mail, and launch the AWS instance.

When It recognizes my face:-

When it recognizes my face and confidence score is above 86% then call the “WhatsApp()” and “email()” function and give the message “This Face is Rohit“ and send the mail to the mail id and also send the WhatsApp message to the friend.

When it recognizes Unknown face:-

when it is recognized unknown face then confidence score is low and detects another person’s face then call the “Instance_EBS() function” and automatically launce the instance and create the EBS volume and attached to the launched instance.

GitHub Link:-

https://github.com/ROHIT8909/MLops_Task6

Thank You :)

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store