Skip to content

ravip18596/face_verification_api

Repository files navigation

Keras Face Verification System deployed as Flask REST API

What

A POST request can be used to integrate face verification in your system.

POST Request Format

  • Add
curl -X POST -F image=@sachin1.png 'http://localhost:5000/add?name=sachin'
  • Verify
curl -X POST -F image=@sachin2.png 'http://localhost:5000/verify?name=sachin'

API Flow Diagram

image

Here name should be unique to the person like emailid or something and image should be the image file containing the person's face.

How to RUN

CMD

pip install -r requirements.txt
python app.py

Docker

docker build -t face_api:latest .
docker run -dp 5000:5000 face_api
curl -X GET http://0.0.0.0:5000/

Pre-built docker image at docker pull ravip18597/face-api:v1

Kubernetes

kubectl apply -f ./deployment.yaml
minikube servive face-api

Output Response

Verify

  • First
{
	"code":1,
	"message":"Person is verified correctly",
	"score":"0.8051153"
}
  • Second
{
	"code":0,
	"message":"Person is not verified",
	"score":"1.051153"
}
  • Third
{
    "code": -3,
    "message": "Name does not exist in database"
}
  • Fourth
{
	"code":-1,
	"message":"No frontal face detected on picture"
}
  • Fifth
{
	"code":-2,
	"message":"Model could not be loaded"
}

Score is the value of the similarity of the face with the registered face. Lower the value of score , means more similarity

ADD

  • First
{
	"code":1,
	"message":"Face added to the database",
}
  • Second
{
	"code":-1,
	"message":"No frontal face detected",
}