This repository contains code for Face recognition with ArcFace blogpost.
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!
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.
Download checkpoint for a model from GoogleDrive/Baidu and move it to checkpoint/backbone_ir50_ms1m_epoch120.pth
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.
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.
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.
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.
Want to become an expert in AI? AI Courses by OpenCV is a great place to start.