This project implements a self‑learning face recognition system using OpenCV’s LBPH algorithm. It can detect new users, register them automatically, recognise returning users and optionally log attendance.
dataset/— folder where captured face images are stored. Each user’s images are saved asUser.<id>.<count>.jpg.labels.json— JSON file mapping user IDs to names.trainer.yml— trained LBPH model. Generated automatically when the system retrains.smart_recognize.py— main Python script that performs real‑time detection, registration and recognition.attendance.csv— optional log of recognised users with timestamps.
- Python 3.8+
- Packages:
opencv-contrib-python(notopencv-python),numpy - A webcam
Install dependencies with:
pip install opencv-contrib-python numpyRun the main script from this folder:
python smart_recognize.pyThe program opens a webcam window. When a face appears:
- If it recognises the face, it displays a welcome message and logs attendance.
- If it does not recognise the face, it prompts you to press n to register a new user. Type the name when prompted. The system automatically captures 30 images of the user’s face for training and retrains the model.
Press q to quit at any time.
Refer to the accompanying guide for more details.