A demo python application for face recognition based attendance system using enhancement of low resolution images by super resolution deep learning models.
This was part of a research project on making face recognition models work in low resolutions. The final project report with all the details of the research can be found here.
This demo project was extended from the awesome pyimagesearch blog for face recognition. Check the blog for good explanations of the basic code.
Uses face_recognition
and ISR
libraries for face recognition and Super resolution respectively.
- Install dlib library by following this guide
- Install all other packages using the command
pip install -r requirements.txt
After installing the prerequesites, follow the steps
- Create a folder
mydatabase
which has several folders each having photos of a single person and the folder name being the identity (name) of that person. Check the sampledataset3
folder in the repository. - Create high level embeddings from these images using the deep learning model and store it in pickle file. To do this just run
python encode_faces.py -e my_encodings.pickle -i mydatabase -d hog
. This will create a file calledmy_encodings.pickle
. Details about other options are explained in the python script. - Run the application with encoding file as an argument.
python recognize_faces_video_async.py -e my_encodings.pickle -d hog
- Once the application starts, face detection happens in real time. Face recognition with resolution enhacement is done on a seperate thread. To start recognising, press the r key on keyboard. To store the attendance of the recognised faces on a csv file, press s. To quit the program, press q.
In order to try out various super resolution models for enhancing the resolution before recognition task,
change the value of IMAGE_SUPER_RESOLUTION_METHOD
in the file recognize_faces_video_async.py
IMAGE_SUPER_RESOLUTION_METHOD = 'psnr-small'
IMAGE_SUPER_RESOLUTION_METHOD = 'psnr-large'
IMAGE_SUPER_RESOLUTION_METHOD = 'gans' # GAN based Super Resolution
IMAGE_SUPER_RESOLUTION_METHOD = None # No super resolution
Refer the docs of ISR
module for more details about the super resolution models.