Skip to content

Instantly share code, notes, and snippets.

@ageitgey
Last active December 12, 2023 16:18
Show Gist options
  • Star 51 You must be signed in to star a gist
  • Fork 13 You must be signed in to fork a gist
  • Save ageitgey/ddbae3b209b6344a458fa41a3cf75719 to your computer and use it in GitHub Desktop.
Save ageitgey/ddbae3b209b6344a458fa41a3cf75719 to your computer and use it in GitHub Desktop.

Before you start

Make sure you have python, OpenFace and dlib installed. You can either install them manually or use a preconfigured docker image that has everying already installed:

docker pull bamos/openface
docker run -p 9000:9000 -p 8000:8000 -t -i bamos/openface /bin/bash
cd /root/openface

Step 1

Make a folder called /training-images/ somewhere on your computer.

Step 2

Make a subfolder for each person you want to recognize. For example:

  • /training-images/will-ferrell/
  • /training-images/chad-smith/
  • /training-images/jimmy-fallon/

Step 3

Copy all your images of each person into the correct sub-folders

Step 4

Run the openface scripts from inside the openface root directory:

First, do pose detection and alignment:

./util/align-dlib.py ./training-images/ align outerEyesAndNose ./aligned-images/ --size 96

Second, generate the representations from the aligned images:

./batch-represent/main.lua -outDir ./generated-embeddings/ -data ./aligned-images/

When you are done, the ./generated-embeddings/ folder will contain a csv file with the embeddings for each image.

@Bishree
Copy link

Bishree commented Jul 12, 2021

Is there any model to get face embedding features?

@aleksandra309303
Copy link

When executing lua batch-represent/main.lua -outDir generated-embeddings -data aligned-images I got :
table: 0x56399ed5d410
aligned-images
cache lotation: /mnt/c/Users/aleksandra/Desktop/Diplomski/openface/aligned-images/cache.t7
Creating metadata for cache.
table: 0x56399ee143d0
running "find" on each class directory, and concatenate all those filenames into a single file containing all image paths for a given class
now combine all the files to a single large file
load the large concatenated list of sample paths to self.imagePath
Segmentation fault
Did someone have this problem? Please, help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment