Skip to content

A light weight face recognition implementation using a pre-trained facenet model

Notifications You must be signed in to change notification settings

timombre/Face_Recognition

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Face Recognition

A light weight face recognition implementation using a pre-trained facenet model. Most of the code is taken from David Sandberg's facenet repository.

Steps to follow:

  1. Make the following changes : In lib/src/create_face_embeddings.py replace the data and pb file paths by your owns (you can also optionally turn on your GPU : with tf.Session(config=tf.ConfigProto(device_count={'GPU': 0})) as sess: ) In server/rest-server.py modify the paths

  2. Create a dataset of faces for each person and arrange them in below order

root folder  
│
└───Person 1
│   │───IMG1
│   │───IMG2
│   │   ....
└───Person 2
|   │───IMG1
|   │───IMG2
|   |   ....
  1. Align the faces using MTCNN or dllib. Please use the scripts available in lib/src/align. For this project i aligned faces using MTCNN.(Please have a look at aligning faces if you need any clarifications)

[Before alignment] [After alignment]

  1. Download pre-trained-weight ,extract and keep it in lib/src/ckpt folder (for detailed info about availabe weights: available-weights)
  2. Create face embeddings using pre-trained facenet model. Run the below scripts by changing the folder paths.(edit paths in lines)
  python lib/src/create_face_embeddings.py 

Once you run the script succesfully, a pickle file with name face_embeddings.pickle will be generated inside lib/src folder

  1. Start the server by running the command
  python server/rest-server.py

access the UI using url https://127.0.0.1:5000. It will show a button with face recognition as label. Once you click on it, automatically your primary camera will get turned on and start recognizing the faces.

sample result

alt text

for more information, please go through my blog

NOTE: The faces are identified using retrievel method, instead if you have enough data, you can train a classifier on top of face embeddings (Train-a-classifier-on-own-images)

References:

About

A light weight face recognition implementation using a pre-trained facenet model

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 93.9%
  • MATLAB 5.8%
  • HTML 0.3%