How fyp-hyz-mjj-2024/posture-face-compare works
Main Components
• API Server: Represented mainly by the entry point (main.py) and auxiliary scripts such as auth.py and query.py.
• CRUD Modules: Two major submodules under the CRUD package—one for “face” and one for “user”—each implemented with models, schemas, and service layers that encapsulate business logic.
• Face Comparison Service: Found in the face_compare package, which suggests additional functionality for comparing or validating face images.
• Database: PostgreSQL is clearly the dedicated datastore with setup instructions in the README.
• External Deployment Infrastructure: A depiction of the DigitalOcean Ubuntu server equipped with Nginx as a reverse proxy, SSL via Certbot, and terminal tools like “screen” for session management.
• External Dependencies: For building and running computer vision tasks (e.g., using dlib, OpenCV, cmake, and build-essential).
Relationships and Interactions
• Client requests (from a mobile app or a web frontend) hit the Nginx reverse proxy (depicted as an edge component) which forwards the requests to the API Server running main.py.
• The API Server exposes endpoints that trigger CRUD operations for both user and face data. These endpoints are mapped to service layers in the CRUD folder.
• The “user” module handles user-related operations including authentication (hinted by auth.py) and uses schemas to validate data.
• The face_compare package likely serves as a specialized component to perform advanced image matching or comparisons by consuming models provided in the “face” component.
• The API Server interfaces with the PostgreSQL database via database.py for all persistent storage operations.
• Additional environment and deployment management details (Conda virtual environments, .env configuration) should be noted as part of the infrastructure setup.
Important Architectural Patterns and Design Principles
• The project follows a modular design approach. Each major domain (user and face) is separated into its own submodule with clearly segregated responsibilities (models, schemas, services).
• There is an explicit separation of concerns: business logic (services) is kept separate from data representation (models and schemas) and from deployment/infrastructure concerns.
• External dependencies are “plugged” into the project via package requirements and manual installations (e.g., cmake, opencv-python-headerless) which enhance the backend’s computer vision capabilities.
• The overall architecture looks like a typical 3-tier backend service (API layer, Service/Business Logic layer, and Data Layer) with added support for dedicated face recognition functionalities.
Relevant Technologies and Frameworks
• Programming Language: Python.
• Libraries/Frameworks: dlib and OpenCV (for face detection/recognition), possibly FastAPI (or a similar Python web framework, inferred by the modular package structure and deployment via Python command).
• Database: PostgreSQL.
• Deployment Tools: Nginx, Certbot (for SSL), DigitalOcean Ubuntu server.
• Build Tools: cmake and build-essential for compiling computer vision libraries.
• Environment Management: Conda for virtual environments.
• Clear labels for each component (e.g., “API Server (main.py)”, “Auth & Query Module”, “Face CRUD”, “User CRUD”, “Face Comparison Service”, “PostgreSQL Database”, “DigitalOcean / Nginx Reverse Proxy”).
• Optionally, include notes on external dependencies like “dlib models loaded here” under the Face CRUD module.