Skip to content

Latest commit

 

History

History
 
 

Face-Recognition-with-ArcFace

Face recognition with ArcFace

This repository contains code for Face recognition with ArcFace blogpost.

download

Original source code

Some parts of the code and trained face identification model are from face.evoLVe repository which is released under the MIT License. Huge thanks to them!

Installation

Use your Python virtual environment such as virtualenv to isolate project.

virtualenv -p python3.7 face-recognition
source face-recognition/bin/activate

Then install all dependencies.

pip install -r requirements.txt

Note: GPU is not required to run this code, but model inference will be faster if you have one.

Model

Download checkpoint for a model from GoogleDrive/Baidu and move it to checkpoint/backbone_ir50_ms1m_epoch120.pth

Data

All datasets with faces must support ImageFolder format. Look at the prepared examples in data directory. For all subsequent commands use tags argument to select specific datasets in data directory.

Data preprocessing

To prepare data with cropped and aligned faces from your original images, run:

python face_alignment.py --tags actors actresses musk woman --crop_size 112

Note: crop_size argument must be either 112 or 224.

Similarity visualization

To visualize similarity between faces in table format, run:

python similarity.py --tags actors actresses musk woman

The result for each dataset will be saved in images directory.

t-SNE visualization

To use t-SNE for dimensionality reduction and 2D visualization of face embeddings, run:

python tsne.py --tags actors actresses musk woman

Results will be plotted in a separate window. You can enlarge the image to look at details.

AI Courses by OpenCV

Want to become an expert in AI? AI Courses by OpenCV is a great place to start.