Face Recognition for Attendance Management

Face recognition is quickly establishing itself as a standard for many companies to manage attendace, analyze behaviour and predict patterns. I have messed around with applied face recognition in three ways - web application in Flask, fixing API in Django, and full secured API in FastAPI. It sounds weird but at the same time funny that I worked on the same thing in three major python web frameworks and also three different face recognition libraries. Each time I upgraded my understanding of the overall process, and finally deployed API (in fastapi) for one of the clients. Below sections describe my experience with face recognition in more detail.

FaceRek: Web application in Flask

Here is the github link of the project. This was the first capstone project under the course MMML by Siraj Raval where I teamed up randomly with Sanjeev Gupta. Eventually, Siraj had some plagiarism issues due to which this course was not properly delivered, but that's a story for another day. Anyways, tt was quite a fun and challenging project because I had very little experience with Flask before, no practical experience in databases and Sanjeev was senior to me and had non-tech background which made this work even more interesting. Even after all these challenges, we managed to submit the project which includes login-signup, user database, face verification, and payment gateway integration using stripe. We used OpenCV for encoding and verifying the faces. Here are some snapshots of the final web app:

facerek screenshot 1
Fig.1 - Process flow.
facerek screenshot 2
Fig.2 - Homepage.
facerek screenshot 3
Fig.3 - Demo screen.

This was the period where I gradually started learning about software engineering aspects of machine learning project as well, and this project was the start of my full stack data scientist journey.

Face Recognition API in Django

2 years later, I got opportunity to fix some bugs in Face Recognition Django API for 30Days Technologies Pvt. Ltd. It was using awesome face_recognition library by Adam Gietgey. The problem was that the image orientation and face alignment was not correct, thus giving inconsistent results and additionally the server was getting filled up on each request. First I learnt about Django models for MySql and rest_framework, as it was completely new to me and then I solved all issues with the API. But then the database requirements changed, so I offered to create new secure API from scratch with custom in-app database. And then comes the FastAPI..

Finally, FastAPI Face Recognition !!

I wanted to code this project in FastAPI because one I love this framework, second easy to handle concurrent operations and third the automatic swagger docs. I successfully built this project using one of my favourite libraries i.e deepface by Serengil for face recognition, and now this piece of work is being used in their products like EZHRM. Key features:

Conclusion

These face recognition projects came to me from nowhere and helped me practically learn about APIs and databases which are used by other backend engines like PHP and NodeJS. Also, got hands-on experience with libraries like openCV, face-recognition and deepface. I would love to get more knowledge about handling scale issues in low budget, contact me.