Skip to content

Divyanshu-hash/face-recognition-system

Repository files navigation

🧠 Real-Time Face Recognition System

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.


πŸ“‚ Project Structure

β”œβ”€β”€ dataset/
β”‚ β”œβ”€β”€ Person1/
β”‚ β”‚ β”œβ”€β”€ img1.jpg
β”‚ β”‚ └── img2.jpg
β”‚ β”œβ”€β”€ Person2/
β”‚ β”‚ └── img1.jpg
β”œβ”€β”€  collectingDatasets.py
β”œβ”€β”€ embeddings.pkl
β”œβ”€β”€ generate_embeddings.py
β”œβ”€β”€ face_recognition_live.py
β”œβ”€β”€ requirements.txt
└── README.md

πŸ”§ Features

  • Generate face encodings using face_recognition
  • Automatically update embeddings.pkl if 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

πŸ› οΈ Installation

1. Clone the repository

git clone https://github.com/your-username/face-recognition-system.git
cd face-recognition-system

2. Create a virtual environment (optional but recommended)

python -m venv venv
venv\Scripts\activate  # On Windows
source venv/bin/activate  # On Linux/Mac

3. Install dependencies

pip install -r requirements.txt

▢️ Usage

To generate/update face embeddings:

python generate_embeddings.py

If embeddings.pkl already exists, new embeddings will be added without duplicating existing ones.

To recognize faces (optional):

python recognize_faces.py

πŸ—‚οΈ Dataset Format

Your dataset/ folder should be structured like:

dataset/
β”œβ”€β”€ Alice/
β”‚   β”œβ”€β”€ alice_1.jpg
β”‚   └── alice_2.jpg
β”œβ”€β”€ Bob/
β”‚   β”œβ”€β”€ bob_1.jpg

Each subfolder represents a different person. Images should have clear frontal faces.

πŸ“¦ Requirements

Python 3.8+

face_recognition

numpy

Pillow

dlib (C++ build tools required)

πŸ“Œ Note: Installing dlib requires Microsoft C++ Build Tools on Windows.

πŸ“„ License

This project is licensed under the MIT License.

πŸ™‹β€β™‚οΈ Author

Divyansu Giri

About

🎯 A Python-based real-time face recognition system that detects faces, encodes them, stores in embeddings.pkl, and supports dynamic updates with new faces.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages