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.
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.
$ git clone https://github.com/ttthanhf/face-recognition.git
$ pip3 install -r requirements.txt"
- Download weights : Click here to download weights (Put arcface_h5 folder and ultralight_onnx folder in weights folder)
$ 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 !
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
}
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
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)
url: http://localhost:5000/api_v3/scan (method GET)
*Example in folder webapp (it using fetch or axios)
! 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
- https://github.com/ipazc/mtcnn
- https://github.com/serengil/deepface
- https://github.com/deepinsight/insightface
- https://github.com/davidsandberg/facenet/
- https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB
- https://viblo.asia/p/paper-explained-some-face-recognition-approaches-facenet-arcface-cosface-Do754zgLZM6
if you have any problem, you can contact to me ! :)
This project is licensed under the MIT License - see MIT LICENSE for more details.