Build a REST API for face recognition so you can use it to develop your own face recognition applications without the need to learn complicated machine learning.
API Endpoints:
- face_match : return if two images are matched for the same person.
- face_rec : return a matched person's ID, name, and optional face details (face location and facial features)
Install face_recognition together with dlib first. Then run: pip install -r requirements.txt
Prepare some known faces as a database for face_rec API in sample_images folder, and modify known_faces in face_util.py accordingly.
# Each face is tuple of (Name,sample image)
known_faces = [('Obama','sample_images/obama.jpg'),
('Peter','sample_images/peter.jpg'),
]
python flask_server.py
Simply open a web browser and enter:
http://127.0.0.1:5001/face_rec
http://127.0.0.1:5001/face_match
and upload image files.
python demo_client.py
python find_facial_features_in_picture_w_api.py
Check out the medium post for more details.
Many open source face recognition projects, like face recognition, are easy to install in or only for Linux / POSIX systems. Building a REST API for them is a much easier solution than trying to convert and deploy them for mobile devices.