Look4Face Save

Demo of Face Recognition web service

Project README

Look4Face

Demo of Face Recognition web service.


One face

Briefly

  • 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.

Multiple faces


  1. Build image from Dockerfile
$ docker build -t l4fimage .
  1. Run container as daemon and expose 8000 port
$ docker run -d --name look4face -p 8000:8000 l4fimage

Installation

If you have CUDA installed, all calculations will be performed on the GPU, otherwise - on the CPU.

  1. Clone this repository:
$ git clone https://github.com/sankovalev/Look4Face.git
  1. 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
  1. Create virtualenv and activate it:
$ virtualenv -p python3 Look4Face
$ cd Look4Face
$ source bin/activate
  1. Make sure that you are using python3 & pip3 from virtual environment:
$ which python3
$ which pip3
  1. Install all requirements:
$ pip3 install -r requirements.txt
  1. Start web server
$ cd Look4Face
$ python3 manage.py runserver
  1. 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 .

How to use with other data

I strongly recommend to use the face.evoLVe.PyTorch repository for train your own models.

  1. 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'
  1. 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'
  1. Update Backbone.pth if you need:
  Look4Face/backbone/
                     -> your_backbone.pth

and set variable in Look4Face/Look4Face/settings.py:

BACKBONE_FILE = 'your_backbone.pth'

Todos

  • Write notification if there are no faces on photo.
  • Write tutorial about using own dataset.

License

MIT

Open Source Agenda is not affiliated with "Look4Face" Project. README Source: sankovalev/Look4Face

Open Source Agenda Badge

Open Source Agenda Rating