This is a security camera / welcome bot that performs face recognition in real time in raspberry
Here is listed the project structure:
capture
folder: contains all the images with detected faces that are sent to the telegram botfeatures
folder: contains all the face embeddings of my dataset in.dat
formatpeople
folder: it is my original dataset with photos of people i want to recognizesaluti
folder: it contains the mp3 files to welcome peopletest_notebook.ipynb
: it is the file where i tested different strategies before to create a main programcreate_feature.py
: that file creates the face embeddings from the labeled photos inside thepeople
folder and then saves the embeddings in thefeatures
folderfacerec.py
: is the main program that will run on the raspberryutility.py
: contains some useful methods that i will need in my main programvoiceGen.py
: with that i can create customized welcome messages with text-to-speech
Install the following libraries with python:
pip3 install -r requirements.txt
It is reccomended to run it in a virtual environment.
First thing to do is to add persons to the dataset (here there will be just my face).
- Add a folder with the name of the person inside the folder
people
- In that folder add an image of that person in high quality named
img.jpg
that will be used to extract the feature - Run
python3 create_feature.py
, it will create the features for the person - Create a custom mp3 file for welcome the person with the command
python3 voiceGen.py Welcome message
- It will create a file
output.mp3
, move it in thesaluti
folder and rename it with the name of the person:mv output.mp3 saluti/name.mp3
The only thing to do is to run the file main.py
and the system will be running.
You can even create a system service so the code is automatically started when the machine reboots.
In order to use the telegram bot you need to create a bot and get the token.
In order to run the tests, even from a laptop just follow the step inside the file test_notebook.ipynb
.
It is strongly recomendedd to use a virtual environment because in the file will be downloaded all the dependencies.