Skip to content

Shrek53/opencv_face_recognition

Repository files navigation

Create virtual env

virtualenv venv -p python3

Activate virtual env

source ./venv/bin/activate

Install requirements

pip install -r requirements.txt

Collect sample data for faces from webcam

python collect_data_set/collect_training_data.py

Write the name of the person in the terminal

In the opencv window
_Hit [SPACE] for taking pictures
Hit [ESC] to end
Images will be automatically putted in the correctly named folder

Extract Embadding from images

python extract_embeddings.py --dataset dataset \
	--embeddings output/embeddings.pickle \
	--detector face_detection_model \
	--embedding-model openface_nn4.small2.v1.t7

Train model from embaddings

python train_model.py --embeddings output/embeddings.pickle \
	--recognizer output/recognizer.pickle \
	--le output/le.pickle

Recognize persons from webcam video

python recognize_video.py --detector face_detection_model \
	--embedding-model openface_nn4.small2.v1.t7 \
	--recognizer output/recognizer.pickle \
	--le output/le.pickle