This project is a Real-Time Face Attendance System that uses computer vision and face recognition technology to automate attendance tracking. The system captures video from a webcam, detects faces, and marks attendance based on recognized individuals. It utilizes Firebase for storing user data and attendance records.
- Features
- Technologies Used
- Setup Instructions
- Usage
- Code Structure
- Firebase Configuration
- Contributing
- License
- Real-time face detection and recognition.
- Attendance tracking with automatic updates in Firebase.
- Displays student information such as name, major, and total attendance.
- Supports adding new students to the Firebase database.
- Python
- OpenCV
- Face Recognition
- Firebase Admin SDK
- NumPy
- CVZone
- Pickle
-
Clone the repository:
git clone https://github.com/yourusername/your-repo-name.git cd your-repo-name -
Install the required packages: Ensure you have Python installed. You can create a virtual environment and install the required libraries:
pip install opencv-python face_recognition firebase-admin numpy
-
Firebase Configuration:
- Create a Firebase project.
- Download the service account key (JSON file) and place it in the project directory. Rename it to serviceAccountKey.json.
- Set up a Realtime Database and Storage bucket in your Firebase project.
- Prepare Images:
Place student images in a folder named images in the project directory. Ensure the images are named with the corresponding student IDs (e.g., 518468.png).
- Add Student Data:
- Modify the addDataToDatabase.py file to include student details.
- Run addDataToDatabase.py to upload student information to Firebase.
-
Generate Face Encodings: Run EncodeGenerator.py to encode the student images and create the encoding file (encodeFile.p).
python EncodeGenerator.py
-
Run the Main Application:
python main.py
The application will open a window displaying the webcam feed and attendance interface.
- Attendance Process:
- As students enter the frame, their faces will be detected and matched against the database.
- When a match is found, the system will update the attendance record in Firebase and display the corresponding student information on the screen.
.
├── images # Directory for student images
├── resources # Directory for background and mode images
│ ├── background.png
│ └── Modes # Directory for mode images
├── EncodeGenerator.py # Script to encode student images
├── main.py # Main attendance system script
├── addDataToDatabase.py # Script to add student data to Firebase
└── serviceAccountKey.json # Firebase service account key
Make sure to set the following rules in your Firebase Realtime Database for testing purposes:
{
"rules": {
".read": "auth != null",
".write": "auth != null"
}
}