Demo of Face Recognition web service.
- The web wrapper is implemented using Django 2.2.
- LFW is used as a main dataset.
- PyTorch for working with neural networks.
- Faiss for ANN search + vector quantization.
- ResNet50 pretrained on MS1M-Arcface.
- For Linux and Mac OS.
- Build image from Dockerfile
$ docker build -t l4fimage .
- Run container as daemon and expose 8000 port
$ docker run -d --name look4face -p 8000:8000 l4fimage
If you have CUDA installed, all calculations will be performed on the GPU, otherwise - on the CPU.
- Clone this repository:
$ git clone https://github.com/sankovalev/Look4Face.git
- Load the default backbone weights and the lfw dataset:
- put Backbone.pth into 'backbone' folder
- unpack dataset.zip and replace an empty 'media/media_root/dataset' folder You may change paths and filenames in Look4Face/Look4Face/settings.py
- Create virtualenv and activate it:
$ virtualenv -p python3 Look4Face
$ cd Look4Face
$ source bin/activate
- Make sure that you are using python3 & pip3 from virtual environment:
$ which python3
$ which pip3
- Install all requirements:
$ pip3 install -r requirements.txt
- Start web server
$ cd Look4Face
$ python3 manage.py runserver
- Open 127.0.0.1:8000 with browser.
Repo | Link |
---|---|
face.evoLVe.PyTorch | https://github.com/ZhaoJ9014/face.evoLVe.PyTorch |
facenet_pytorch | https://github.com/liorshk/facenet_pytorch |
arcface-pytorch | https://github.com/ronghuaiyang/arcface-pytorch |
insightface | https://github.com/deepinsight/insightface |
sudo docker build -t l4fimage . |
I strongly recommend to use the face.evoLVe.PyTorch repository for train your own models.
- Put your dataset to Look4Face/dataset with structure:
Look4Face/dataset/your_db/
-> id1/
-> filename_1.jpg
-> ...
-> id2/
-> filename_1.jpg
-> ...
-> ...
-> ...
-> ...
and set variable in Look4Face/Look4Face/settings.py:
DATASET_FOLDER = 'your_db'
- Similarly, put your Faiss index and meta information for labels (dict with pairs id:PersonName) to the same folder, set variables:
DATASET_INDEX = 'your_index.bin'
DATASET_LABELS = 'your_labels.pkl'
- Update Backbone.pth if you need:
Look4Face/backbone/
-> your_backbone.pth
and set variable in Look4Face/Look4Face/settings.py:
BACKBONE_FILE = 'your_backbone.pth'
- Write notification if there are no faces on photo.
- Write tutorial about using own dataset.
MIT