Face recognition implemented in Tensorflow. It uses a CNN to train on faces which are detected by OpenCV
- Take a 10 second video of subject's face. So if you want to recognise 3 people (which is what this coded for), take a 10 second videos of each of them.
- Put your subject's (one of them) video in a folder with preprocess_script.py with.
- Edit the paths in preprocess_scripts.py to that of the subject. Do this for every subject.
- Run the preprocess_script.py for each person and it'll extract as many faces it can find. These faces will then be used to train a CNN.
- Before feeding your data to the CNN, use data.py so it's normalized and label data can be generated. Make sure to edit path names. It has 3 loops because I did it for 3 people.
- After running data.py, data.pkl will be generated. That file is then used in faceid.py where the CNN is trained.
- Just run faceid.py and wait until the training is complete.
-
When training cnn in faceid.py make sure you have set save location for model. If the location doesn't exists, all your training will be gone.
-
In faceid.py you'll find 4 parameters: a) VERSION: It's used to have different versions of models so you could see which one's better. For now, you don't have to change it but if you do make sure to have different save paths. b) TRAIN_MODEL: If this is true, the model will be trained. c) SAVE_MODEL: If the is true, the model will be saved after training. d) RESTORE_MODEL: If this is used the model will restored from path so you could resume training. Make sure restore paths are correct.