Utilising the face recognition library built on top of dlib to create a REST API using Flask
Dependencies:
- Python 3.6
- Visual Studio Build Tools
- Face-recognition
- openCV
- dlib
- cmake
- flask
-
Clone the repository
git clone https://github.com/ash2703/Face-Recognition-Api.git
Navigate to the root of the above cloned repo.
-
Install Dependencies
Refer this for detailed instructions
CMake : https://cmake.org/download/ Visual Studio : https://visualstudio.microsoft.com/visual-cpp-build-tools/ Add Cmake to system PATH pip install -r requirements.txt
-
Create Face Database
Follow this directory structure, store multiple photos of same person in a single folder
face_gallery ├───person │ photo1.jpg │ photo2.jpg │ ├───obama │ obama.jpg │ └───trump donald-trump-premiere-king-kong trump.jpg
To run the recogniton alone
python recognizer.py
python api.py #Run the api
curl -XPOST -F "file=@sample/obamas.jpg" http://127.0.0.1:5001