This project is a Python-based real-time face recognition system that detects, encodes, and identifies human faces using a webcam. Built using powerful libraries like OpenCV, MediaPipe, and face_recognition, the system performs accurate detection and recognition with additional features such as logging, screenshot capture, and sound alerts.
- Real-time face detection using MediaPipe
- 128-dimensional face encoding using
face_recognition - Save face data as
.npyfiles - Recognize and label known faces from dataset
- Logs every successful recognition with timestamp and confidence
- Automatically captures screenshots of recognized faces
- Displays number of known individuals and watermark
- Optional sound alert on successful recognition
- Python 3.x
- OpenCV
- MediaPipe
- face_recognition
- NumPy
- playsound or pygame (for optional sound)
project/ ├── Face_Data.py # Script to collect face encodings ├── Face_Recognition.py # Real-time face detection & recognition ├── face_dataset/ # Stores .npy encoding files ├── screenshots/ # Captured images of recognized faces ├── logs/ # Log of recognized faces ├── .gitignore # Git ignore rules └── README.md # This file
- Collect Face Data Run the following script and follow on-screen instructions:
python Face_Data.py
a) Look into the webcam
b)Press s to stop when enough data is collected
2. Run Real-Time Face Recognition
python Face_Recognition.py
a) The system will identify any known face
b) Logs and screenshots will be saved automatically
c) Press s to stop the recognition
Requirements
Install dependencies:
pip install opencv-python face_recognition mediapipe numpy playsound
For sound support, ensure beep.wav is placed in the project directory.
Notes
Works best in good lighting
.npy files and logs are ignored from Git using .gitignore
Easy to extend for video file input, GUI, or mobile integration
Credits
Developed by Swapno
Inspired by clean Python practices, real-world deployment needs, and a love for knowledge.