This is simple real Time face recognization using FaceNet. FaceNet provides a unified embedding for face recognition, verification and clustering tasks. It maps each face image into a euclidean space such that the distances in that space correspond to face similarity, i.e. an image of person A will be placed closer to all the other images of person A as compared to images of any other person present in the dataset.
Here in this face recognition system, we are able to recognize a person’s identity by just feeding one picture of that person’s face to the system. And, in case, it fails to recognize the picture, it means that this person’s image is not stored in the system’s database.
To solve this problem, we cannot use only a convolutional neural network for two reasons:
1) CNN doesn’t work on a small training set.
2) It is not convenient to retrain the model every time we add a picture of a new person to the system.
However, we can use Siamese neural network for face recognition.
You can install Conda for python which resolves all the dependencies for machine learning. OR You can use CMD or terminals.
pip install requirements.txt
- Download this pretrained Facenet model and copy to model folder.
- Download this pretrained MTCNN models and copy to mtcnn_model.
- Download the code or git clone https://github.com/nidhisri99/Face_Recognization-FaceNet-.git.
- Add your images to the "images" folder. (Only one image is enough)
- Run face_recognition.py.
To run use command.
python face_recognition.py
After running your face_recognition.py it should look like this.
Examples
If the face is found in the images folder.
If face is not found.