How tharushaudana/python-student-attendance-by-face-recognition works
Project Type and Purpose
• This is a standalone desktop/edge application (not a distributed web service) that uses a webcam to perform real-time face recognition and automatically log daily attendance into Excel sheets.
File Structure
• Top‐Level Scripts & Config
• main.py → application entry point and GUI orchestration
• config.py → camera index, paths for images, student data, output sheets
• test.py → basic smoke tests
• Core Functional Modules (“system/” folder)
• capturing.py → video‐capture pipeline (uses OpenCV)
• simple_facerec.py → face encoding & matching logic (uses face_recognition)
• students.py → loads student metadata from Excel
• Attendance & Persistence
• mark_attendance.py → decides when to mark a student present
• attendsheet.py → generates/dumps daily .xlsx attendance files
• Assets & Outputs
• assets/ → input: student_data.xlsx, student_images/
• “Attend Sheets/” → output: per-day attendance spreadsheets
• Dependencies
• requirements.txt → OpenCV, face_recognition, pandas, openpyxl, GUI libs
Extract Architecture Insights from README
• GUI front‐end with real‐time video feed and overlays
• Automated Excel output (one file per day)
• Configurable parameters (camera, file paths)
Core Components & Their Interactions
a. Video Capture Module (capturing.py)
• Grabs frames from camera → outputs raw images
b. Face Recognition Engine (simple_facerec.py)
• Pre‐loads student face encodings (from assets/student_images)
c. Student Data Module (students.py)
• Reads student_data.xlsx → builds in-memory mapping of student IDs to names/metadata
d. Attendance Manager (mark_attendance.py)
• Receives face_recognition results + timestamp → ensures one mark per student per day → hands off to attendsheet
e. Excel Writer (attendsheet.py)
• Creates or appends to today’s spreadsheet in “Attend Sheets/”
f. GUI & Main Orchestrator (main.py)
• Initializes modules based on config → starts capture → displays live feed with overlays → listens for quit events
Data Flow:
Architectural Patterns & Principles
• Pipeline pattern: capture → process → output
• Single‐process, modular layering (config layer, capture layer, processing layer, persistence layer, presentation layer)
• Separation of concerns: face logic isolated from I/O & UI
• Extensibility point: swap out simple_facerec.py for another recognition engine
Technologies & Frameworks
• OpenCV (video capture & drawing overlays)
• face_recognition (dlib/Python wrapper for face encoding & matching)
• pandas / openpyxl (Excel I/O)
• tkinter or similar GUI (not explicitly named but implied)