This project demonstrates a simple face recognition system using AI and machine learning libraries in Python.
- Train on a dataset of labeled face images
- Real-time detection and recognition via webcam
- Utilizes OpenCV (Haar cascade & LBPH recognizer) for detection and recognition
-
Create a Python virtual environment:
python -m venv venv venv\Scripts\activate
-
Install dependencies (make sure you get the contrib package):
pip install -r requirements.txt # if you still have errors with cv2.face module: python -m pip install opencv-contrib-python -
Prepare the dataset
- Create a directory named
datasetat the project root - Inside
dataset, create one folder per person using their name - Put sample face images (JPEG/PNG) in each person's folder
- Create a directory named
-
Run the application:
python src/main.py
- Press
qto quit the video window - Ensure a webcam is connected and accessible
- You can extend this by saving encodings and using a database
A companion notebook face_recognition_colab.ipynb is provided for users who prefer to run the project in a browser. It contains step-by-step instructions for mounting Google Drive, uploading the dataset, training the model, and testing on images. Open the notebook in Colab and follow the cells.