/face-embeddings-generator

A simple tool to generate face embeddings using dlib and/or facenet networks

Primary LanguagePythonApache License 2.0Apache-2.0

Face embeddings generator

This is a set of scripts to generate a json file containing the embeddings (descriptors) using various neural networks.

Setup / Install instructions

# create a python virtual environment
virtualenv -p python3 .env3
# activate the environment
source .env3/bin/activate
# install the required libraries
pip install -r requirements.txt

Download LFW

You can download Labeled Faces in the Wild (LFW) database from here - http://vis-www.cs.umass.edu/lfw/

To use the FaceNet model for embedding generation, download the model here - https://drive.google.com/open?id=1EXPBSXwTaqrSC0OhUdXNmKSh9qJUQ55-

Run it

You can see various options by issuing the following command

python main.py --help

You will see that there are options to specify various paths (lfw-dir, models-dir and out-dir) as well as options related to number of classes to process etc

Here is an example command -

# This command will generate the embeddings for 20 classes where every class in LFW
# has *atleast* 10 images
python main.py dlib --lfw-dir <path_to_lfw>/lfw --models-dir ./models --max-num-classes 20 --min-images-per-class 10 --out-dir <path_to_dir_where_you_want_the_output_file>