This GitHub repository contains a Face Recognition System built using Python, OpenCV, and Firebase. The system can recognize faces, manage attendance records, and store user data in a Firebase Realtime Database. It includes two main Python scripts: Face_Recognition.py
and EncodeGenerator.py
.
- Real-Time Face Recognition: Detects and recognizes faces using the
face_recognition
library. - Attendance Management: Logs attendance with timestamps and updates total attendance count.
- Firebase Integration: Uses Firebase Realtime Database and Cloud Storage for data storage and retrieval.
- Encoding Generation: Generates face encodings from images and stores them in a pickle file for quick access.
Install the following packages:
pip install opencv-python face_recognition numpy cvzone firebase-admin python-dotenv
- Realtime Database: Enable and configure Firebase Realtime Database.
- Cloud Storage: Configure Firebase Cloud Storage.
- Credentials: Download the Firebase credentials JSON file and place it in the project directory.
Create a .env
file and add:
FIREBASE_DATABASE_URL = "your-firebase-database-url"
FIREBASE_STORAGE_BUCKET = "your-firebase-storage-bucket"
FIREBASE_CREDENTIALS = "path-to-your-firebase-credentials.json"
- Clone the repository:
git clone https://github.com/HariPasapuleti/Face-Recognition.git cd Face-Recognition
- Install dependencies:
pip install -r requirements.txt
- Set up resources:
- Create a
resource
folder and add:- A background image (
background.png
). - A
modes
folder containing mode images.
- A background image (
- Create an
images
folder for student images.
- Create a
Run the EncodeGenerator.py
script to generate face encodings from student images:
python EncodeGenerator.py
This script:
- Uploads student images to Firebase Storage.
- Generates a
EncodFile.p
file containing face encodings and IDs.
Run the face_recognition.py
script to start the recognition system:
python Face_Recognition.py
Press n
to exit the program.
EncodeGenerator.py
:- Generates face encodings and uploads images to Firebase.
Face_Recognition.py
:- Detects faces in real time, recognizes them, and logs attendance.
resource/
:background.png
: Background image for UI.modes/
: Images representing different modes in the UI.
images/
:- Stores student images for encoding.
{
"Students": {
"123": {
"name": "Hari Pasapuleti",
"gender": "Male",
"company": "XYZ Corp",
"id": "123",
"nationality": "India",
"Joined year": "2023",
"total attendance": 5,
"last attendance time": "2025-02-01 10:00:00"
}
}
}
Store student images in the images/
folder within Firebase Storage.
Add relevant screenshots showcasing:
- Application UI.
- Firebase setup.
- Sample outputs.
Contributions are welcome! Please:
- Open an issue for bugs or feature requests.
- Submit a pull request for fixes or enhancements.
This project is licensed under the MIT License.
For any queries, feel free to reach out via Email.
- Improved section organization with clear headings.
- Simplified repetitive instructions into concise steps.
- Clarified resource and setup details for better user experience.
- Added proper Markdown formatting for readability.