This project implements a real-time face recognition system using the DeepFace library in Python. The system captures video from a webcam, detects faces in the video frames, and matches them against a reference image using DeepFace's facial recognition capabilities.
- Python 3.x
- OpenCV (
cv2
library) - DeepFace library
- Install Python 3.x from the official Python website.
- Install OpenCV library using
pip install opencv-python
. - Install DeepFace library using
pip install deepface
.
- Clone or download the project repository.
- Replace the
reference.jpg
file with your own reference image. This image will be used as the template for face matching. - Run the Python script
main.py
- The webcam will be activated, and the system will start capturing video.
- As faces are detected in the video frames, the system will compare them against the reference image.
- If a match is found, the system will display "MATCH!" on the video frame; otherwise, it will display "NO MATCH!".
- The program initializes a video capture object from the default webcam.
- The check_face function is defined to perform face verification using DeepFace's verify function.
- Within the main loop, the program reads frames from the video capture object.
- Every 30 frames, a new thread is spawned to asynchronously check for face matches using the check_face function.
- If a match is found, the system displays "MATCH!" on the video frame; otherwise, it displays "NO MATCH!".
- Press 'q' to exit the program.
- The system may not perform optimally in low-light conditions or with poor camera quality.
- Performance may vary depending on the hardware capabilities of the system.