This is the distributed processing version of the Smart Attendance System project, utilizing distributed processing for attendance calculation through face recognition.
Important
- This README contains demonstration videos which your browser or device might not support.
- In case the demo videos are not visible, try refreshing the page.
- If they remain unplayable, switch to a different browser or try accessing from another device.
- Leverage the power of multiple clients to process video frames for attendance marking using face recognition.
- Implement both Static and Dynamic load balancing for efficient processing and faster results.
-
Server Initialization:
- A web server starts the distributed server, which connects to multiple clients (as configured in the
.envfile). - Initialization includes:
- Accepting client connections and registering their details.
- Sending pre-trained face models and essential files to each client.
Server_Initialization_H264.mp4
- Setting clients on standby mode for task distribution.
Client_Initialization_H264.mp4
- A web server starts the distributed server, which connects to multiple clients (as configured in the
-
Task Distribution:
- The server accepts video uploads from the frontend.
- Tasks are assigned to clients based on the selected load balancing mode:
-
Static Load Balancing:- Tasks are evenly distributed before processing begins.
- All clients must finish their tasks before results can be combined.
Client_Static_H264.mp4
- Means, the server has to wait for all clients to complete the task.
- One client has been purposely delayed to simulate the difference in processing time.
Server_Static_H264.mp4
-
Dynamic Load Balancing:- Tasks are assigned based on client processing speed in real-time, ensuring efficient resource utilization.
Client_Dynamic_H264.mp4
- All the clients finish the task approximately at the same time.
Server_Dynamic_H264.mp4
-
-
Processing:
- Clients process video frames using OpenCV and
face_recognition. - Results are returned to the server.
- Separate results from clients are combined, and rendered as attendance data.
- Clients process video frames using OpenCV and
-
Output:
- Results are displayed on a web page and can be downloaded in Excel format as well.
- Web-based Interface: Upload videos and view/download attendance results.
- Parallel Processing: Faster processing through distributed clients.
- Customizable Load Balancing: Switch between static and dynamic modes.
- Thread locking: For consistent read-write operations on shared resources.
- Accurate Attendance Marking: Threshold-based attendance marking ensures precision.
- Detailed Reporting: Faculty can access detailed results and downloadable attendance records.
- Backend: Python, Flask
- Frontend: HTML, CSS, JavaScript
- Libraries: OpenCV, face_recognition, threading, socket
- Data Formats: JSON, Excel
- Tools: Virtual environment (venv), Python's standard libraries
-
Clone the repository:
git clone --depth 1 https://github.com/Bbs1412/DistributedAttendanceSystem.git
-
Navigate to the project directory:
cd DistributedAttendanceSystem -
Create a virtual environment and install dependencies:
python -m venv venv venv\Scripts\activate pip install -r "requirements_all.txt"
-
Configure the number of clients in the
.envfile:no_of_clients = 2
-
Train the face recognition models:
- Create a folder named
Picsin the project directory and add the images of the people you want to recognize in thePicsfolder. - Update the people list in
face_train.py(~line 73)::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 training script:
python face_train.py
- Create a folder named
-
Start the web server:
python app.py
-
Connect clients:
- Run the
distributed_client.pyon all the clients within span of set timeout.
- Run the
-
Open the browser at:
http://localhost:5000
-
Clone the repository:
git clone --depth 1 https://github.com/Bbs1412/DistributedAttendanceSystem.git
-
Copy
networking.pyandlogger.pyfrom the root directory toClient/directory. -
Navigate to the client directory:
cd DistributedAttendanceSystem/Client -
Create a virtual environment and install dependencies:
python -m venv venv venv\Scripts\activate cp ../requirements_all.txt . pip install -r "requirements_all.txt"
-
Rest all files outside
Client/can be deleted. -
Run the client once main server is up:
python distributed_client.py
-
Repeat the above steps for all the clients.
-
Networking module:- The
networking.pymodule provides abstraction for client-server communication. - It uses a structured JSON based custom protocol, which can be checked in
Protocol.jsonfile. - Includes functions for sending and receiving data over sockets.
- Robust error handling and logging are implemented for better debugging.
- Sender-side: Retries sending the same message up to 3 times if an error occurs (can be adjusted in the
networking.pyfile). - Receiver-side: Sends
NACK(negative acknowledgment) to the sender if an error is detected, prompting the sender to resend the data. - Data sent in parts over the network is reassembled at the receiver's end.
- The
-
Logger module:- The
logger.pymodule is also implemented using the same protocol. - It provides logging functionality for efficient debugging and status tracking of the distributed system.
- Can be disabled in high performance scenarios, as it may impact the performance due to frequent I/O operations.
- The
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 - bhushanbsongire@gmail.com