This is a simple Python/Flask application that intended to compare face that found in an image and short video. It will return a JSON whether face found in image and video, a confidence percentage and whether is matched or not
- Face_Recognition python package
- Flask
- Gunicorn
- OpenCV and FFMPEG
To run this project, install it locally using pip on a virtual environment
pip install -r requirements.txt
- Upload a picture of the person you want to compare
- Upload a short video (mp4, avi, webm)
- Click compare and it will compare the face found in picture and video
- Check the size of picture uploaded. If is above certain threshold, then it will be compress
- Extract frame per second from video uploaded
- Check the frame whether is rotated. If is rotated, rotate it back to portrait
- Check the size of frame extracted. If is above certain threshold, then it will be compress
- Loop through and comparing the picture and frames extracted. Confidence will be divided by how many frame counts
- Deployment was done by using Heroku
- Procfile is used to specifies the commands that are executed by the app on startup.
- Aptfile is used to install additional software packages that application requires
- newrelic.ini is use for New Relic add-on for monitoring
You can try the web app that hosted here https://matching-face.herokuapp.com/
Starting November 28, 2022, Heroku stop offering free product plans and plan to start shutting down free dynos and data services. Hence the web app is no longer available
There are some issues when trying to deploy this app on the web. Please see the link below for the fix.
Some of the issues are
- dlib not able to install.
- Additional buildpack / Linux packages needed for installing OpenCV and FFMPEG in VM.
- https://elements.heroku.com/buildpacks/j-a-m-e-5/heroku16-buildpack-python-opencv-dlib
- https://elements.heroku.com/buildpacks/jonathanong/heroku-buildpack-ffmpeg-latest
- https://elements.heroku.com/buildpacks/eventastic/heroku-buildpack-apt
- https://stackoverflow.com/questions/49469764/how-to-use-opencv-with-heroku/51004957
- https://stackoverflow.com/questions/47113029/importerror-libsm-so-6-cannot-open-shared-object-file-no-such-file-or-directo