This project is a Face Recognition Attendance System developed using Python. It captures and processes real-time video from a webcam to recognize faces, logs attendance in both CSV and SQLite formats, and serves attendance data via a Flask web application.
Face-Sense
│
├── attendance_data/
│ ├── attendance.db # SQLite database for attendance records
│ ├── YYYY-MM-DD.csv # Daily attendance CSV files
│
├── model_data/
│ ├── known_names.bin # Pickle file containing the names of known faces
│ ├── known_encodings.bin # Pickle file containing the encodings of known faces
│
├── student_photos/
│ ├── [student_name].jpg # Photos of students used for face encoding
│
├── templates/
│ ├── index.html # HTML template for the Flask web application
│
├── requirements/
│ └── requirements.txt # List of required Python packages
│
├── engine.py # Main script to start the Flask server and process video
├── info_storing.py # Script to encode student faces and store encodings
└── main.py # Main script for face recognition and attendance logging-
Clone the repository:
git clone https://github.com/ishtiuk/Face-Sense.git cd Face-Sense -
Set up the environment:
Ensure you have Python 3.7 or higher installed. Install the required Python packages using the
requirements.txtfile:pip install -r requirements/requirements.txt
-
Prepare the model data:
Ensure you have the student photos in the
student_photos/directory. Run theinfo_storing.pyscript to generate face encodings and save them:python info_storing.py
-
Start the Flask server:
Run the
engine.pyscript to start the Flask server and initiate the face recognition process:python engine.py
The server will be accessible at
http://localhost:5000. -
View the video feed and attendance data:
- Open your web browser and navigate to
http://localhost:5000to view the live video feed from the webcam. - The video feed will display the recognized faces with their names and confidence scores.
- The attendance data can be accessed via the
/get_attendance_dataendpoint.
- Open your web browser and navigate to
To stop the application, press q in the terminal where the video feed is displayed or terminate the Flask server using Ctrl+C.
-
engine.py: Contains the Flask application and the main face recognition logic. It captures video from the webcam, processes each frame to detect and recognize faces, and logs attendance data to both a CSV file and an SQLite database. -
info_storing.py: Prepares the model by encoding student faces and saving the encodings and names to binary files. Run this script once to prepare the face recognition model. -
main.py: (Not actively used in this setup but similar toengine.pyfor standalone execution without Flask)
- Ensure the webcam is properly connected and accessible by the application.
- Modify the
known_namesandknown_encodingsfiles if you add or remove students from thestudent_photos/directory. - The system assumes that student names in the
student_photos/directory are formatted as[first_name]_[last_name].jpg.
-
Issue: Faces not being recognized or attendance not being logged.
- Solution: Check the student photos and ensure they are clear and correctly formatted. Re-run
info_storing.pyto update the encodings.
- Solution: Check the student photos and ensure they are clear and correctly formatted. Re-run
-
Issue: Flask server fails to start.
- Solution: Ensure all required packages are installed and that no other process is using port 5000.
This project is licensed under the MIT License - see the LICENSE file for details.