/Real-Time-Face-Recognition

Real Time face recognition using OpenCV

Primary LanguagePython

Real-Time-Face-Recognition (OpenCV)

This is a full step Python program to create an efficient real-time face recognition app.

$ xhost +local:docker

Build docker image

$ docker build -t fr-py .

Find out device that can stream video

$ ls -ltrh /dev/video*

Run docker container

$ docker run -it --privileged -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix --device="/dev/video0:/dev/video0" -v `pwd`:/app/ fr-py:latest bash

Steps:

cmd: python face_taker.py

  1. Take pictures using the face_taker.py script. The script will save 30 images of your face in the images folder after you entered the ID number (MUST be integer and incremental (starts with 1 then 2, 3, ...) Note: Make sure your face is centered. The window will collapse when all the 30 pictures are taken.

cmd: python face_train.py

  1. The face_tain.py script will train a model to recognize all the faces from the 30 images taken using face_taker.py script, and save the training output in the training.yml file.

cmd: python face_recognizer.py

  1. The face_recognizer.py is the main script. You need to append the name of each person who sees his/her picture taken in the face_taker.py script. The program will recognize the face according to the id given in the face_taker.py script. If Joe has an id 1, his name should appear in the list as index 1 like this names = ['None', 'Joe'] # keep None and append a name into this list