This project is a Python-based face recognition system that detects faces from images, encodes them, and stores the embeddings in a pickle file (embeddings.pkl). It can dynamically update with new faces and supports real-time identification.
βββ dataset/
β βββ Person1/
β β βββ img1.jpg
β β βββ img2.jpg
β βββ Person2/
β β βββ img1.jpg
βββ collectingDatasets.py
βββ embeddings.pkl
βββ generate_embeddings.py
βββ face_recognition_live.py
βββ requirements.txt
βββ README.md- Generate face encodings using
face_recognition - Automatically update
embeddings.pklif it already exists - Warns if no face is found in an image
- Real-time face recognition support (optional)
- Error-handling and logging for easy debugging
git clone https://github.com/your-username/face-recognition-system.git
cd face-recognition-systempython -m venv venv
venv\Scripts\activate # On Windows
source venv/bin/activate # On Linux/Macpip install -r requirements.txtTo generate/update face embeddings:
python generate_embeddings.pyIf embeddings.pkl already exists, new embeddings will be added without duplicating existing ones.
To recognize faces (optional):
python recognize_faces.pyYour dataset/ folder should be structured like:
dataset/
βββ Alice/
β βββ alice_1.jpg
β βββ alice_2.jpg
βββ Bob/
β βββ bob_1.jpgEach subfolder represents a different person. Images should have clear frontal faces.
Python 3.8+
face_recognition
numpy
Pillow
dlib (C++ build tools required)
π Note: Installing dlib requires Microsoft C++ Build Tools on Windows.
This project is licensed under the MIT License.