How aprendeingenia/control-de-acceso-facial-con-ia works
Project Type and Purpose
• This is a standalone full‐stack Python application for “facial access control.”
• It combines a GUI frontend, computer‐vision/AI face‐processing backend, a simple file‐based database, and a hardware interface (serial COM) to actuate a door lock.
File Structure
Top‐level directories:
• door_control/ – Entry point for door hardware control (likely wraps serial interface).
• process/ – Core application logic, subdivided into:
– com_interface/ – Serial communication with the door lock device.
– database/ – File‐based storage of user records and face data.
– face_processing/ – AI/vision modules: detection, matching, mesh, signup, login, utilities.
– gui/ – User interface elements and setup images.
• examples/ – Sample usage scripts.
• test/ – Automated test artifacts for face matcher evaluation.
• main.py (and door_control/src/main.py) – Application entry points.
• requirements.txt – Third‐party dependencies (OpenCV, TensorFlow, NumPy, etc.).
Important Architectural Patterns
• Modular organization by concern (GUI, Face Processing, Database, COM Interface).
• Sequential data flow: GUI → Face Capture → Face Processing → Database Check → COM Interface → Door Actuation.
• File‐based database (no external DB server) simplifies deployment.
• Pluggable AI models (face_detect_models, face_matcher_models, face_mesh_models) for extensibility.
Main Components and Their Responsibilities
1. Frontend GUI
• Modules under process/gui/
• Captures user action (signup vs. login), displays camera feed, buttons, status.
2. Face Processing Backend
• Face detection (face_detect_models/face_detect.py)
• Face mesh (face_mesh_models/face_mesh.py)
• Face feature extraction/matching (face_matcher_models/face_matcher.py)
• Signup and login workflows (face_signup.py, face_login.py)
3. Database Layer
• File‐based storage of user IDs and associated face embeddings (database/users/*.txt, database/faces_path.py, users_path.py).
• Configurable paths (config.py).
4. Hardware Interface
• Serial communication to door lock controller (serial_com.py under com_interface/).
• Wrapped by door_control/src/main.py to provide high‐level “open door” API.
5. Entry Point(s)
• process/main.py orchestrates GUI startup, event loop, and backend interactions.
• examples/example.py shows usage.
Relationships and Data Flow
• User interacts with GUI → GUI captures image from camera.
• Image passed to Face Processing:
• Detection → Mesh → Embedding extraction → Matching/Signup.
• Decision (match/no‐match) triggers:
• On success: Database lookup/update, then signal COM interface to unlock door.
• On failure: GUI shows error, no COM signal.
• The COM interface sends serial commands to the hardware.
Guidance
a. Components to include:
• GUI Layer (process/gui/)
• Face Processing Layer (face_detect, face_mesh, face_matcher, signup/login modules)
• Database Layer (file store modules)
• COM Interface Layer (serial_com + door_control wrapper)
• External: Camera device, Door‐lock hardware
• Camera → GUI → Face Processing → Database
• Face Processing → (Decision) → COM Interface → Door Lock
• Database ←→ Face Processing (read/write)
c. Patterns:
• Modular, layered architecture
• Pluggable AI model components
• File‐based persistence
d. Technologies:
• Python 3.10, OpenCV, TensorFlow, NumPy
• Serial (pySerial) for COM interface