Face recognition using python and mysql.
Create virtual environment using Anaconda.
conda create -n face python=3.x
conda activate face
pip install -r requirements.txt
You'll obtain an account and password after installation, then you should modify the faces.py, with the corresponding
user and passwd:
# create database connection
myconn = mysql.connector.connect(host="localhost", user="root", passwd="xxxxx", database="facerecognition")
"""
user_name = "Jack" # the name
NUM_IMGS = 400 # the number of saved images
"""
python face_capture.py
The camera will be activated and the captured images will be stored in data/Jack folder.
Note: Only one person’s images can be captured at a time.
python train.py
train.yml and labels.pickle will be created at the current folder.
Our database now:
Users(user_id, user_name, user_email, user_login_time, user_login_date)
Teachers(user_id, student_id_string)
Students(user_id, teacher_office)
Courses(course_id, course_code, course_name, teacher_user_id, welcome_message)
Coursetimeslots(course_id, start_time, end_time, day_in_week, course_venue)
Registercourse(user_id, course_id)
Open mysql server and import the file facerecognition.sql.
# login the mysql command
mysql -u root -p
# create database. 'mysql>' indicates we are now in the mysql command line
mysql> CREATE DATABASE facerecognition;
mysql> USE facerecognition;
# import from sql file
mysql> source facerecognition.sql
python faces.py
python faces_gui.py
The camera will be activated and recognize your face using the pretrained model.
You need to implement other useful functions in this part.