Tensorflow pipeline to recognize faces - Pycon Colombia 2018
Switch branches/tags
Nothing to show
Clone or download

README.md

Facial Recognition with Tensorflow

GudarJS Pycon Profile

Tensorflow pipeline to recognize faces for python 3.6.

Slides

Google Slides

1. Installing Dependencies

FaceNet

Run the following command.

git clone https://github.com/davidsandberg/facenet.git
export PYTHONPATH=~/<facenet_path>/src:~/<facenet_path>/contributed
  • Replace <facenet_path> with the facenet installation folder.

Python modules

Run the following command.

pip install -r requirements.txt

2. Download resources

3. Align the LFW dataset

Run the following command.

for N in {1..4}; do python ~/<facenet_path>/src/align/align_dataset_mtcnn.py ~/<lfw_path>/raw ~/<lfw_path>/lfw_mtcnnpy_160 --image_size 160 --margin 32 --random_order --gpu_memory_fraction 0.25 & done
  • Replace <facenet_path> with the facenet installation folder.
  • Replace <lfw_path> with the lfw installation folder.

4. Copy the aligned faces to the dataset

Run the following command.

cp ~/<lfw_path>/lfw_mtcnnpy_160/* ~/<repo_path>/datasets
  • Replace <repo_path> with this repository installation folder.
  • Replace <lfw_path> with the lfw installation folder.

5. Add a new person

Run the following command.

~/<repo_path>/bin/add_new_face
  • Replace <repo_path> with this repository installation folder.

6. Train a classifier

Run the following command.

python ~/<facenet_path>/src/classifier.py TRAIN ~/<repo_path>/datasets ~/<repo_path>/models/20170512-110547/20170512-110547.pb ~/<repo_path>/classifier/face_classifier.pkl --batch_size 1000 --min_nrof_images_per_class 40 --nrof_train_images_per_class 40
  • Replace <facenet_path> with the facenet installation folder.
  • Replace <repo_path> with this repository installation folder.

7. Start the webserver

Run the following command.

python server.py

Credits

License

MIT License