Existing Face Recognition systems fail in recognizing the persons when they are masked but I have developed a face recognition system that is capable of recognizing persons even when they are masked with different kinds of occlusion such as Facemasks, templates, Handkerchiefs, and so on. I have even deployed my model using Streamlit.
1. Collect images of persons that are to be recognized using the model. The images that you collect should contain various kinds of occlusions. For good accuray, make sure that the images that you collect are as follows
```
a. Non masked face images
b. Non masked face images with Spectacles or Goggles
c. Masked face with any kind of masks such as N-95, Cloth or surgical masks
d. Masked face with any kind of mask such as N-95, Cloth or surgical mask along with spectacles or goggles.
e. Masked face with a handkerchief or any cloth or scarf.
f. Masked face with a handkerchief or any cloth or scarf when you are wearing either Spectacles or Goggles.
```
The images of every individual person should be placed in a seperate directory. The directory structure of the images that you have collected should be as follows
- Make sure that you have installed the MTCNN package before running this file. You can download the package by using the command 'pip install mtcnn'.
- Downlaod the Facenet model file from this link https://drive.google.com/open?id=1pwQ3H4aJ8a6yyJHZkTwtjcL4wYWQb7bn and place it in the same directory that contains 'embeddings_generator.py' file and rename the downloaded file as 'facenet.h5'.
- The modification to be done to the code in 'embeddings_generator.py' file is providing the path to the directory that contain directories of images of each individual.
- Change the value of the variable 'base_dir' in the first line of the file with your local location of the dataset directory.
To run the streamlit file, move the directory location in the command prompt and enter the command streamlit run face_recognizer.py which will open a tab in your default browser by default. The inteface of the webapp will be as follows
Now upload a image into the Webapp.
If the image uploaded contains face of a trained person then the name of the person will be displayed if not the person will be recognized as Unknown.
The result of the model on the image of a trained person is as follows