Skip to content

ishtiuk/Face-Sense

Repository files navigation

Face Sense - Real-time Computer Vision Face Recognition Attendance System

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.

Project Structure

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

Installation

  1. Clone the repository:

    git clone https://github.com/ishtiuk/Face-Sense.git
    cd Face-Sense
  2. Set up the environment:

    Ensure you have Python 3.7 or higher installed. Install the required Python packages using the requirements.txt file:

    pip install -r requirements/requirements.txt
  3. Prepare the model data:

    Ensure you have the student photos in the student_photos/ directory. Run the info_storing.py script to generate face encodings and save them:

    python info_storing.py

Usage

Running the Application

  1. Start the Flask server:

    Run the engine.py script to start the Flask server and initiate the face recognition process:

    python engine.py

    The server will be accessible at http://localhost:5000.

  2. View the video feed and attendance data:

    • Open your web browser and navigate to http://localhost:5000 to 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_data endpoint.

Stopping the Application

To stop the application, press q in the terminal where the video feed is displayed or terminate the Flask server using Ctrl+C.

Code Explanation

  • 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 to engine.py for standalone execution without Flask)

Notes

  • Ensure the webcam is properly connected and accessible by the application.
  • Modify the known_names and known_encodings files if you add or remove students from the student_photos/ directory.
  • The system assumes that student names in the student_photos/ directory are formatted as [first_name]_[last_name].jpg.

Troubleshooting

  • 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.py to update the encodings.
  • Issue: Flask server fails to start.

    • Solution: Ensure all required packages are installed and that no other process is using port 5000.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A Flask-based UI integrated application that uses OpenCV and the face_recognition library to automate attendance tracking The system captures faces, identifies students, and logs attendance data into both CSV and SQLite databases. The project includes face detection, recognition, and data storage, with a focus on simplicity and real-time processing

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors