Skip to content

ttthanhf/face-recognition

Repository files navigation

Face Regconition



This is the project face recognition using MTCNN to handle scan function, ultralight to detect face and ArcFace to recognition.

Supported by the F-Code club.


Introduction

In this face recognition problem, I use a Learning Similarity method so that I don't have to retrain the model when add a new face.


How to setup!

$ git clone https://github.com/ttthanhf/face-recognition.git
$ pip3 install -r requirements.txt"

To start server:

$ py main.py server start

(It will start localhost with port 5000)

If your computer has 16gb ram or more you can use docker to run this model !


API

using json in body web request.

  • api_v1 : using upload image.
  • api_v2 : using path of image in local. (Body: Json: {path: "your url", name: "your name"})
  • api_v3 : using url of image. (Body: Json: {url: "your url", name: "your name"})


  • / (method: POST) : recognition face

Input: (look)

=> Output { status , 
            name , 
            execute_time 
          }

  • /create (method: POST) : insert new image
=> Output { status , 
            execute_time
          }

  • /add (method: POST) : add more image
=> Output { status , 
            execute_time 
          }

  • /delete (method POST) : delete data user

Input: json ({name: "your name"})

> => Output { status , 
              execute_time 
            }

  • /scan (method: GET) : generate data face
> => Output { add , 
              exist , 
              total , 
              execute_time 
            }

  • /list (method: GET) : show all user
> => Output { 
               *json list* 
            }

  • /rename (method POST) : rename user in database

Input: Json ({oldname: "your oldname", newname: "your newname"})

> => Output { status , 
              execute_time 
            }

Example

To easily interact with users as well as being able to add one project to another, I use RESTful API to interact with Model.

I use POSTMAN for this example with api_v3

POSTMAN

Step 1: create a new face to start recognition. Here I use the image of Harry Potter character.

(link: https://gocsaoviet.com/wp-content/uploads/2021/06/photo-1-1622984031118226200693.jpg)


url: http://localhost:5000/api_v3/create (method POST)

Step 2 : Use "scan" to generate the face data into database.

url: http://localhost:5000/api_v3/scan (method GET)


*Example in folder webapp (it using fetch or axios)

Note

! You need to scan face before create new face !

! => To avoid unexpected errors, use the python version 3.7.9 <= !

Ff you are in python 3.7.9 and still not working, delete that python version and reinstall it. Python 3.7.9

Reference :

Contact

if you have any problem, you can contact to me ! :)

License

This project is licensed under the MIT License - see MIT LICENSE for more details.

About

this is my project face recognition

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published