An intelligent ROS2-based Automated Attendance System that leverages computer vision and face recognition to automate student attendance recording.
This system captures faces in real time, performs anti-spoofing checks, matches them against a pre-stored database, and updates attendance records in an Excel sheet.
The project is structured into ROS2 nodes that communicate through topics:
-
Node1 (Camera & Face Detection)
- Captures live camera feed
- Detects faces using Haar Cascade Classifier
- Performs basic anti-spoofing
- Publishes detected images
-
Node2 (Face Recognition & Attendance Update)
- Receives detected faces
- Compares against known student dataset using
face_recognition - Updates attendance in
attendance.xlsxwith timestamp, date, name, and match score
-
Node3 (Display & Record Keeping)
- Annotates recognized face image with student details
- Displays result on screen
- Saves annotated images in
attendance_record/
-
Launch File
- Orchestrates all nodes to run together
✔️ Live camera-based face detection
✔️ Anti-spoofing mechanism (basic image variance check)
✔️ Face recognition using deep feature embeddings (face_recognition)
✔️ Automatic attendance logging in Excel (openpyxl)
✔️ Annotated visual feedback with student details
✔️ Modular ROS2 architecture – nodes can run independently or via launch file
- Face Detection → Implemented with Haar Cascade Classifier from OpenCV for locating faces in video frames.
- Face Recognition → Uses the face_recognition library, built on dlib’s deep learning model, which extracts 128-dimensional encodings for each face.
- Face Matching → Recognition is performed by computing the Euclidean distance between encodings. A match score = 1 – distance is derived for easier interpretation.
- Anti-Spoofing Check → A color variance–based method ensures that flat images (e.g., photos shown to the camera) are rejected, reducing spoof attempts.
- Thresholding → Only matches with a score above 0.60 are accepted, balancing accuracy and reliability.
- Attendance Logging → Attendance is updated in an Excel sheet (openpyxl) with timestamp, date, student name, and match score.
- ROS2 Middleware → ROS2 topics provide modular communication between nodes, ensuring scalability (e.g., replacing camera source or adding cloud logging without changing core logic).
- Data Storage →
- attendance.xlsx → Central attendance record
- attendance_record → Annotated face images with overlayed names and scores
- face_detected → Raw cropped face snapshots for debugging
automated_attendance_system/
│── launch/
│ └── launch_file.py
│── src/automated_attendance_system/
│ ├── node1.py # Camera, face detection, anti-spoofing, image publisher
│ ├── node2.py # Face recognition, attendance logging
│ ├── node3.py # Display recognized student, save annotated record
│ ├── print_and_launch.py # Entry script to launch system
│── resource/
│ └── automated_attendance_system
│── setup.py
│── setup.cfg
│── package.xml
│── requirements.txt
│── README.md
- Ubuntu 20.04 / 22.04 with ROS2 Foxy/Humble
- Python ≥ 3.8
- Camera/webcam
sudo apt update
sudo apt install python3-colcon-common-extensions ros-${ROS_DISTRO}-cv-bridge ros-${ROS_DISTRO}-image-transport
pip install -r requirements.txtrequirements.txt includes:
opencv-pythonface_recognitionpandasopenpyxlnumpyrclpycv_bridge
git clone https://github.com/<your-username>/automated_attendance_system.git
cd automated_attendance_system
colcon build
source install/setup.bashros2 run automated_attendance_system print_and_launchPress q in the image window to quit.
-
attendance.xlsx→ Logs attendance with- Timestamp
- Date
- Student Name
- Match Score
-
face_detected/→ Saves detected face snapshots -
attendance_record/→ Stores annotated images with details
- Capture → Camera feed captured via OpenCV.
- Detection → Haar cascade detects faces.
- Anti-Spoofing → Color variance check filters spoof attempts.
- Recognition → Matches face encodings with student dataset.
- Attendance Marking → Updates
attendance.xlsx. - Annotation & Storage → Saves/display annotated image.
- Face Detected: Captured via webcam.
- Recognition: Matches against known dataset.
- Attendance Record: Automatically updated in Excel.
- Annotated Image: Displayed & saved with details.
- Manvendra Pratap Singh