This is a backend project for face detection and recognition. The frontend project is RealGuard-Frontend.
This project is aimed to provide a real-time face detection and recognition system for security purpose such as door access control. This project is based on dlib and OpenCV.
You can start the program with a RGBD camera (we use Realsense D435 and D430) or other camera that can generate both 2D and 3D images. Because of the lack of the depth information, 3D images are only used for face validation, which means that the program will judge whether the face is from a real person or a photo. If you don't have a RGBD camera, you can also use a normal camera to start the program, but the face validation will be skipped.
Thanks to dlib, which provides a lot of pretrained models that we can use for our recognition, it saves us much time to train our own models.
Use pip to install the following packages:
pip install opencv-python
pip install dlib
If you want to use Realsense camera, you need to install:
pip install pyrealsense2
Models are also needed, you can download them from here. The models we use are:
- dlib_face_recognition_resnet_model_v1.dat
- shape_predictor_68_face_landmarks.dat
- mmod_human_face_detector.dat
Put the models in ./model/ folder.
To begin with, put the picture in ./face/person_name/ folder.
Then, run pretrain.py to get the face feature array.
python pretrain.py
If you currently have a RGBD camera, you can start the program with:
python test.py
If you want to work with frontend, you can start with:
python grpcServer.py