The Smart Attendance System automates attendance calculation during lectures using a video uploaded through a user-friendly interface. The system processes the video frames with OpenCV, identifies students using pre-trained face encodings, and calculates attendance based on a threshold of 75% frame presence. It ensures concurrency with threading and provides results in a downloadable Excel format.
To automate attendance calculation efficiently using face recognition, ensuring accuracy and convenience for faculty and students.
- Video is pre-processed and uploaded from the frontend and sent to a Flask server.
- Frames are processed using OpenCV for face recognition.
- Captured
face Locations
are compared against pre-saved encodings usingface distance
andface encodings
to identify individuals. - Face encodings are a one-time process completed during registration of new student.
- Attendance is calculated based on frame presence with a threshold of 75%.
- Results are rendered on a webpage and made downloadable in Excel format.
- Upload video for attendance processing.
- Real-time face recognition with concurrency using threading, locking for consistent read-write operations.
- Faster operation and time-saving due to parallel processing.
- Threshold-based attendance marking for customizable and accurate results.
- Faculty access to detailed results and downloadable attendance records.
- Web-based interface for ease of use.
- Backend: Python, Flask
- Frontend: HTML, CSS, JavaScript
- Libraries: OpenCV, face_recognition, threading
- Data Formats: JSON, Excel
- Tools: Virtual environment (venv), Python's standard libraries
-
Clone the repository:
git clone --depth 1 https://github.com/Bbs1412/SmartAttendanceSystem
-
Navigate to the project directory:
cd SmartAttendanceSystem
-
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
- Windows
venv\Scripts\activate
- Linux
source venv/bin/activate
- Windows
-
Install the required packages:
pip install -r requirements.txt
-
Set the environment variables (Optional):
- Open the
.env
file and update the environment variables if needed or keep the default values
- Open the
-
Adding the images:
- Create a folder named
Pics
in the project directorymkdir Pics
- Add the images of the people you want to recognize in the
Pics
folder.
- Create a folder named
-
Train the models:
- Open the
face_train.py
file - Scroll down (~ line 73) to update the people list
- Add all the people you want to recognize in the people list by calling:
Person( reg='registration_number', name='Name', image='person_name.jpg', # Image should be in the 'Pics' folder display_name='Display Name', # optional pickle_name='person_name.pkl' # optional )
- Run the
face_train.py
filepython face_train.py
- Open the
-
Run the app:
python app.py
-
Open the browser and go to the following URL (default):
http://localhost:5000
- Using Conda for environment creation may help ease the process and might make it faster.
- If some errors occurs:
- First try deleting the
__pycache__
folder - Restart the server and run the application again.
- First try deleting the
- Although the code includes conditions to dynamically check and resolve issues, if an error occurs or for re-verification, please check the following folders:
Folder Detail Checking assets/
Should contain all the css, js, images, etc. Cloned from repository Templates/
Should contain all the html files Cloned from repository Pics/
Should contain all the images of people to be recognized Must be done by user Excels/
Empty initially Dynamically Checked in app.py
Uploads/
Empty initially Dynamically Checked in image_processor.py
Jsons/
Empty initially Dynamically Checked in face_train.py
Models/
Empty initially Dynamically Checked in face_train.py
.env
(File) Should contain all the environment variables Cloned from repository - In case you have changed the env variables, check folders accordingly
Templates/
might give some error on linux, check the 'T' being either capital or small- Or else, Set the Templates folder path in the
app.py
file manually:app = Flask(__name__, template_folder='Templates')
Any contributions or suggestions are welcome!
- This project is licensed under the
GNU General Public License v3.0
- See the LICENSE file for details.
- You can use the code with proper credits to the author.
- Email - [email protected]