Skip to content

peterjpxie/face_rec_api

Repository files navigation

face_rec_api

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)

Installation

Install face_recognition together with dlib first. Then run: pip install -r requirements.txt

How to Run

Prerequisites

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'),
              ]

Run API Server

python flask_server.py

Run API client - Web

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.

Run API client - Python

python demo_client.py

Run API client Advanced (draw face features)

python find_facial_features_in_picture_w_api.py

Example

Medium Post

Check out the medium post for more details.

Notes

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.

About

face recognition as REST API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages