The project is made with real-life implementation perspective. The basic idea behind this project is to keep an eye on the children i.e at what time the come house and what time they leave the house. So, as soon as the face is recognised a whatsapp notification is sent with a message as
Last seen: NAME
@ Date Month Year HH:MM AM/PM
- Python Programming Language
- Machine Learning algorithms
- Convolutional Neural Network
- Twilio Account
- Caffe-Based Deep Learning models
- OpenCV for Python
- Install Python
- Install OpenCV for windows
- Install OpenCV for Ubuntu
- Execute the following commands in terminal:
- pip install twilio
- pip install numpy
- pip install -U scikit-learn
`
- Step-1, Use OpenCV face detector model to detect face from each input image and use OpenCV embedder model to extract the 128-d face embeddings for each image
- Step-2, We pass these 128-d embeddings of each iamge through Linear SVM classifier to train it and use it as a recognizer model in step-3
- Step-3, We take the frames of face detected, extract 128-d embeddings and then pass this embeddings through our recognizer model
- Based on the recognizer predictions we recognise whose face it was.
- It recognise anyone from our dataset(as it was trained on those images) it saves the frames and sends a whatsapp notification to a verified number
- If unknwon face is detected we just ignore it.
- Make two different folders with name
my_dataset
andmotions_caught
insideface-recognition-whatsapp-notification
directory - Inside
my_dataset
directory create folders with name of the each individual and place thier images(atleast 35-40 each person of whom the recognition is to be performed) inside them - Now inside
my_dataset
directory create one more folder with name asunknown
and inside this folder place different 35-40 images of random people (celebrities/friends/images who are not to be recognised) - Once folders created, in python file
faceRecognition_notification.py
check thedetails_json
instance variable ofclass Activities
. Replace theperson1_name
json oject with the name of the person(the name should be same as done in step 2 and also it is case-sensitive) - Consider you want to person detection for two people named as
amitabh
andyash
- So inside constructure we would replace
person1_name
andperson2_name
with the following:
"details_json" :{
"amitabh": {
"timestamp": 0,
"captures": 0,
"total_capture": 0,
"image_sent": false
},
"yash": {
"timestamp": 0,
"captures": 0,
"total_capture": 0,
"image_sent": false
}
}
- Also, create an empty folder named
output
. This file will store all the embeddings and our trained model
- Before running the python code you need to set two environement variable. To do so run (always re-run it when you shutdown your local-machine and log in next time) the two lines given below in terminal/console one by one:
- For Linux run code given below: (for other OS check here):
export TWILIO_ACCOUNT_SID='COPY_YOUR_TWILIO_ACCOUNT_SID'
export TWILIO_AUTH_TOKEN='COPY_TWILIO_AUTH_TOKEN'
-
This will make sure twilio whatsapp API to work properly on our local-machine. For TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN refer Twilio Console(Create twilio account if not created already)
-
Also change the
TO_NUMBER
instance variable value insidefaceRecognition_notification.py
to the phone number you wish to recieve msg on. -
You first need to connect that number to twilio via Twilio Testing Sandbox(see: Set Up Your Testing Sandbox)
-
Once all the setup is done run the following in sequence:
python util.py
python face_extract_embedding.py
python train_model.py
python faceRecognition_notification.py
- Chaitanya Sonavane [July 2020]