This project is a Python-based real-time Face Recognition system that uses OpenCV, MediaPipe, and a machine learning model to detect and recognize faces. Users must collect data, process it, train the model, and then test it for face recognition.
- Real-time face detection using MediaPipe Face Detection.
- Face landmark mapping with MediaPipe Face Mesh.
- Accurate face recognition powered by a user-trained machine learning model.
- Easily extensible for adding new individuals or improving recognition accuracy.
-
Clone the Repository:
git clone https://github.com/your-repo/face-recognition-project.git cd face-recognition-project
-
Set Up Virtual Environment:
python -m venv env source env/bin/activate # On Windows: env\Scripts\activate
-
Install Dependencies:
pip install -r requirements.txt
-
Organize Data for Training:
- Create a folder
Data_Collection
with subfolders named after each person's name. - Place corresponding images in each folder.
- Create a folder
-
Train the Model:
- Run the training script:
python Data_Training.py
- Save the generated model as
model.p
in the project directory.
- Run the training script:
After training the model, run the following command to start the application:
python Data_Testing.py
- Press
Q
to quit the application.
To train a new model with your dataset:
- Ensure the dataset is organized in the
Data_Collection
folder. - Run the training script:
python training.py
- Save the generated model as
model.p
.
- Python 3.7+
- OpenCV
- MediaPipe
- NumPy
- Scikit-learn
face-recognition-project/
├── Data_Collection/ # Dataset folder with subfolders for each person
├── model.p # Trained model (generated by the user)
├── testing.py # Script for real-time face recognition
├── training.py # Script for training the face recognition model
├── requirements.txt # Python dependencies
└── README.md # Project documentation
- Add support for multiple cameras.
- Improve recognition accuracy with more training data.
- Implement GUI for user-friendly interaction.
This project leverages the following libraries and tools:
This project is licensed under the MIT License. See LICENSE
for more details.