Skip to content

Latest commit

 

History

History
19 lines (10 loc) · 1.13 KB

README.md

File metadata and controls

19 lines (10 loc) · 1.13 KB

Count the number of scenes with a person using facial recognition

Note: This is very hacky and a work in progress

This is modified from Jason Brownlee's tutorial: https://machinelearningmastery.com/how-to-develop-a-face-recognition-system-using-facenet-in-keras-and-an-svm-classifier/

This code takes a movie file and goes scene by scene and counts the number of scenes with each person from a trained model. It checks how many CPU cores your machine has and runs parrellel processes for each core. It also skips over some number of frames (currently set to 15) to save time.

Setup details

You need facenet_keras.h5 in your directory. Find it in the tutorial linked above.

First, make sure you create a trained model using a folder with subfolders for each person saved as a pickle file (currently set to svc_model.sav) and encoder classes (currently set to classes.npy).

Make sure to change {video/location.mp4} to your video location.

Other details

Check out how I used this to try to predict who gets eliminated in Top Chef: https://www.ifoundanifty.com/2021/04/can-you-predict-the-winner-of-top-chef-based-on-screentime/