Prompting operations using Face Detection
Hello readers,
In this blog, I have explained how to prompt system to perform below mentioned operations on detecting a face:
When it recognizes my face it will:
send a mail to my mail id.
send a WhatsApp message to the specified contact.
When it recognizes a second face, it will:
create an EC2 instance in the AWS using CLI.
create 5 GB EBS volume and attach it to the instance.
Step1:Configure AWS on Windows Command Prompt
Enter the following command in your windows command prompt:
aws configure
After running the above command we have to provide the following details:
Access_Key_ID
Secret_Key_ID
Region_Name
Format_JSON
Step 3:
First we will load Haarcascade Face recognition model and collect the training data by capturing 200 images using the Webcam to train our model. We also define function to convert the images to grayscale and crop the faces and save in a specified folder.
Step 4: Train Model
We load our training dataset and create numpy arrays for training data and labels. Furthermore, we initialize face recognizer and train the model.
STEP 5: Face Recognition and Prompting Specified Operations Accordingly
Now upon detecting my face it will send a WhatsApp message using WhatsApp web app and send an e-mail to specified mail address using PyWhatKit library of python. For this to happen the confidence score needs to be greater than 90%.
And if it detects the second face of any person like friend or family member, it will launch an EC2 instance in AWS, it will creates 5 GB EBS volume and attach it to the instance. The program will wait for 60 seconds i.e, 1minute before initiating the EBS block so that the EC2 instance is initialized and there are no errors while attaching.
OUTPUT:
Thank you for reading!