This project is a face recognition attendance system using Python, OpenCV, face_recognition, and Firebase. It captures images of students, encodes their faces, stores the encodings and student information in Firebase, and updates attendance records based on real-time face recognition.
- Upload student images and encode faces.
- Store face encodings and student information in Firebase.
- Capture real-time webcam feed and recognize faces.
- Retrieve student information and update attendance records in Firebase.
- Display real-time attendance information on screen.
- Python 3.7+
- Anaconda
- Firebase account with Realtime Database and Storage enabled
- OpenCV
- face_recognition library
-
Clone the repository:
git clone https://github.com/amphitter/face-recognition-attendance.git cd face-recognition-attendance
-
Create a new Anaconda environment and activate it:
conda create -n face_recognition python=3.8 conda activate face_recognition
-
Install the required packages:
pip install opencv-python pip install face-recognition pip install firebase-admin pip install numpy pip install cvzone
-
Set up Firebase:
- Download your serviceAccountKey.json from Firebase Console and place it in the project directory.
- Ensure your Firebase project has a Realtime Database and Storage bucket enabled.
-
Encode Student Images:
-
Place student images in the Images folder. The images should be named with the student ID (e.g., 123456.png).
-
Run EncodeGernator.py to upload images to Firebase Storage and create face encodings:
python EncodeGernator.py
-
-
Add Student Data to Database:
-
Modify AddDatatoDatabase.py to include your student data.
-
Run AddDatatoDatabase.py to upload data to Firebase Realtime Database:
python AddDatatoDatabase.py
-
-
Run the Face Recognition System:
-
Ensure your webcam is connected.
-
Run main.py to start the face recognition system and update attendance records in real-time:
python main.py
-
This script uploads student images to Firebase Storage and encodes faces.
- Initializes Firebase app with credentials.
- Reads images from the Images folder.
- Encodes the faces and saves the encodings to EncodeFile.p using pickle.
This script adds student data to Firebase Realtime Database.
- Initializes Firebase app with credentials.
- Defines student data in a dictionary.
- Uploads the data to the Realtime Database.
This script captures real-time webcam feed and performs face recognition.
- Initializes Firebase app with credentials.
- Loads face encodings from EncodeFile.p.
- Captures frames from the webcam.
- Recognizes faces and retrieves student information from the Realtime Database.
- Updates attendance records and displays student information on the screen.
Contributions are welcome! Please open an issue or submit a pull request for any changes.
This project is licensed under the MIT License.
This should maintain the formatting when you copy it into your README file. Let me know if you need any further adjustments!