- Create python virtual environment
# create virtual environment python -m venv env # activate the environment source env/bin/activate
- Install opencv requirement
# Install requirements.txt pip install -r requirements.txt
NOTE" Make sure to have good camera
-
Create a folder named datasets
mkdir datasets
-
Run datacollect.py and enter id of the user.
#This id is to differentiate each users by id in an array list of name inside the main code Enter Your ID:
-
Run trainingdemo.py to create a yml file to store the trained data of faces.
#Processing the datasets of a face and turn into yml file Training Completed............
NOTE" Make sure to put the name of the users in the dataset. Sort by ID in an array
- Enter image recognition code, Modify the name_list array. number of array based on the id inside datasets.
#Input name of users
name_list = ["", "Joshua", "Vinilis", "Johnny"]
- Run facial recognition code like default_Main.py
#Output
ID: 2 Confidence: 47.35577424898243
Detected Face - Name: Vinilis
ID: 0 Confidence: 35.25912327297898
Detected Face - Name: Unknown
...
Kept a few other ways of coding for facial recognition.
#extra requirement may needed for code within others folder
pip install face_recognition
https://drive.google.com/file/d/1Uo808jFDhK97ae7zPob7KiKHU6pBl2Wv/view?usp=sharing