How rfypych/face-attendance works
Main Components
• Backend Service: Built with Python, using FastAPI as the web framework. It houses the API routes (located in app/api/routes.py) and the main entry point (app/main.py).
• Face Recognition Module: Located in app/models (specifically face_recognition.py) which handles the facial recognition logic using MobileFaceNet via ONNX Runtime and OpenCV for Haar Cascade face detection.
• Database: The SQLite database (app/database/face_attendance.db) managed by app/database/db.py for storing user data and face embeddings.
• Frontend Application: A web application built with React (inside app/frontend). It provides the user interface including components for Admin Dashboard, Login, Attendance, Registration, etc.
• External Libraries & Tools: These include OpenCV for image processing, ONNX Runtime for optimized face recognition, and Node.js & npm for the frontend dependencies.
Relationships and Data Flow
• Users interact with the React frontend through a web browser. The frontend communicates with the backend API (FastAPI) via HTTP calls.
• The backend processes API requests, invoking the face recognition module for operations such as registration and attendance checking.
• Data is stored or retrieved from the SQLite database. This includes user information and facial embeddings.
• The face recognition component accesses the deep learning model (MobileFaceNet) optimized using ONNX Runtime, while also using Haar Cascades (from OpenCV) for initial face detection.
• The backend (and its API routes) serves as the integration point that connects the user inputs from the frontend with the underlying services (database and recognition module).
Architectural Patterns and Key Technologies
• Separation of Concerns: The clear distinction between backend (API, database, face recognition) and frontend (React client).
• MVC / Layered Pattern: Although not strictly MVC, the design separates presentation (frontend), business logic (FastAPI routes), and data access (SQLite database).
• Asynchronous and RESTful API: The FastAPI structure that manages asynchronous API requests ensuring efficient back-end operations for CPU-optimized tasks.
Elements
• Use clear labels for each component:
• "Web Client (React Frontend)"
• "API Server (FastAPI)"
• "Face Recognition Module (MobileFaceNet, ONNX Runtime, OpenCV)"
• "Database (SQLite)"
• Optionally, include deployment details like port numbers if desired (e.g., FastAPI on port 8000, React on port 3000).
Additional Recommendations
• Configuration or initialization files (such as __init__.py) briefly to note that the project is modular.
• While it is good to include many details, avoid clutter: make sure the main interactions and responsibilities are prominent.
Happy diagramming!