How turhancan97/intelligent-face-recognition-attendance-system works
Project type and purpose
• This is a full-stack, monolithic Flask web application that automates attendance by performing real-time face recognition.
• The system’s key responsibilities are:
• Serving HTML/CSS/JavaScript pages to students and teachers
• Capturing webcam frames and matching them against a face database
• Persisting user profiles, face embeddings, and attendance records in Firebase Realtime Database and Firebase Storage
File structure
• Top level
• app.py – Flask entry point, defines routes and glue logic
• configs/database.yaml – Firebase configuration (URL, storage bucket, service account key path, teacher-login hash)
• requirements.txt – Python dependencies (Flask, OpenCV, firebase-admin, etc.)
• Modules
• detection/face_matching.py – encapsulates face detection, alignment, embedding extraction, and matching logic
• utils/configuration.py – loads YAML, provides config to app and detection module
• Presentation layer
• template/… – Jinja2 HTML templates for home, add_info, attendance, teacher_login, select_class
• static/images – stored face images (mirrors Firebase storage) and UI assets
• Supporting scripts/tests
• generate_password_hash.py – initial teacher-login hash generator
• test/face-detection.py – basic unit/integration test for face detection
README for additional insights
• The “System Architecture Design” section describes three logical components:
1. Face Recognition System (OpenCV + dlib + FaceNet embeddings)
2. User Interface (Flask + HTML/CSS/JS)
3. Firebase Database & Storage
• It also shows a high-level interaction flow: capture → detect/recognize → update DB → render UI
a. Main components
• Browser / Webcam (client hardware & front-end)
• Flask Web Server (app.py + templates + static)
• Face Recognition Engine (detection.face_matching)
• Configuration & Utilities (utils.configuration, configs/database.yaml)
• Firebase Services (Realtime Database, Storage, Service Account)
b. Relationships & data flows
1. User opens browser → HTTP GET to Flask → Jinja2 template rendered
2. “Upload / Capture Face” action → browser sends image or triggers webcam stream → Flask route receives image data
3. Flask invokes detection.face_matching:
• Detect & align face, compute embedding
• Compare embedding against stored embeddings (in local folder or fetched from Firebase Storage + Database)
4. On match, Flask writes attendance record (userID + timestamp + class) to Firebase Realtime Database via firebase-admin SDK
5. Teacher login route: Flask verifies hash, queries attendance data from Firebase, and renders attendance.html
c. Architectural patterns & principles
• Layered architecture: Presentation → Business Logic → Data Access
• Single-process monolith (all modules loaded in one Flask app)
• Dependency injection of configuration via utils.configuration
• Clear separation of cross-cutting concerns: face logic isolated in detection/, persistence abstracted by firebase-admin calls
d. Key technologies
• Python 3.8, Flask
• OpenCV, dlib, FaceNet (DeepFace) for face recognition
• Firebase Realtime Database & Firebase Storage
• Jinja2 templates, Werkzeug file-upload handler, Pillow, numpy
Essential architectural elements
• Firebase interactions separately for user data vs. attendance records vs. raw image storage.