# shinryujin03/cameraai2 architecture

> Architecture diagram of the GitHub repository shinryujin03/cameraai2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shinryujin03/cameraai2
- Repository: https://github.com/shinryujin03/cameraai2

## Overview

CameraAI2 is a Flask computer-vision API whose main workflow accepts uploaded images, dispatches them to task-specific recognition or detection services, persists image/results in MySQL, and returns JSON. Its domain capabilities include face location, landmarks, attributes, verification and name recognition, plus human and general-object detection. Face enrollment data is read for verification and recognition; the README describes adding training images through face-related endpoints. The graph follows sampled router, service and database calls; unsampled endpoint implementations are shown only where the tree and README establish them.

Main entry points: [`database/database.py`](https://github.com/shinryujin03/cameraai2/blob/master/database/database.py) (Metadata database), [`app/services/face/face_detection_services.py`](https://github.com/shinryujin03/cameraai2/blob/master/app/services/face/face_detection_services.py) (Face location), [`app/routers/face_routers.py`](https://github.com/shinryujin03/cameraai2/blob/master/app/routers/face_routers.py) (Face routes), [`app/main/main.py`](https://github.com/shinryujin03/cameraai2/blob/master/app/main/main.py) (Flask application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API entry"]
  node_app["Flask application<br/>[main.py]"]
  node_face_routes["Face routes<br/>[face_routers.py]"]
  node_human_routes["Human route"]
  node_objects_routes["Object route"]
  node_test_routes["Test routes<br/>[test_routers.py]"]
end

subgraph group_face["Face analysis"]
  node_face_location["Face location"]
  node_landmarks["Face landmarks"]
  node_attributes["Facial attributes"]
  node_verification["Face verification"]
  node_recognition["Name recognition"]
end

subgraph group_objects["Object analysis"]
  node_human_detection["Human detection"]
  node_object_detection["Multiple objects"]
  node_test_service["Image test tools"]
end

subgraph group_persistence["Metadata storage"]
  node_database["Metadata database<br/>[database.py]"]
end

node_client(("API client"))
node_face_lib["Face recognition library"]
node_deepface["DeepFace"]
node_yolo["YOLO model<br/>[yolov8n.pt]"]
node_mysql[("MySQL")]

node_client -->|"sends requests"| node_app
node_app -->|"registers routes"| node_face_routes
node_app -->|"registers routes"| node_human_routes
node_app -->|"registers routes"| node_objects_routes
node_app -->|"registers routes"| node_test_routes
node_face_routes -->|"dispatches"| node_face_location
node_face_routes -->|"dispatches"| node_landmarks
node_face_routes -->|"dispatches"| node_attributes
node_face_routes -->|"dispatches"| node_verification
node_face_routes -->|"dispatches"| node_recognition
node_human_routes -->|"dispatches"| node_human_detection
node_objects_routes -->|"dispatches"| node_object_detection
node_test_routes -->|"dispatches"| node_test_service
node_face_location -->|"detects faces"| node_face_lib
node_landmarks -->|"requests locations"| node_face_location
node_attributes -->|"requests locations"| node_face_location
node_attributes -->|"analyzes attributes"| node_deepface
node_verification -->|"requests locations"| node_face_location
node_verification -->|"encodes and compares"| node_face_lib
node_recognition -->|"requests locations"| node_face_location
node_recognition -->|"encodes and compares"| node_face_lib
node_human_detection -->|"runs inference"| node_yolo
node_object_detection -->|"runs inference"| node_yolo
node_face_location -->|"saves results and image"| node_database
node_landmarks -->|"saves results"| node_database
node_attributes -->|"saves results and image"| node_database
node_verification -->|"reads and saves"| node_database
node_recognition -->|"reads enrolled faces"| node_database
node_recognition -->|"saves high-confidence image"| node_database
node_human_detection -->|"saves results and image"| node_database
node_object_detection -->|"saves results and image"| node_database
node_database -->|"queries and writes"| node_mysql

click node_app "https://github.com/shinryujin03/cameraai2/blob/master/app/main/main.py"
click node_face_routes "https://github.com/shinryujin03/cameraai2/blob/master/app/routers/face_routers.py"
click node_human_routes "https://github.com/shinryujin03/cameraai2/blob/master/app/routers/human_detection_routers.py"
click node_objects_routes "https://github.com/shinryujin03/cameraai2/blob/master/app/routers/multiple_objects_detection_routers.py"
click node_test_routes "https://github.com/shinryujin03/cameraai2/blob/master/app/routers/test_routers.py"
click node_face_location "https://github.com/shinryujin03/cameraai2/blob/master/app/services/face/face_detection_services.py"
click node_landmarks "https://github.com/shinryujin03/cameraai2/blob/master/app/services/face/face_landmarks_sevices.py"
click node_attributes "https://github.com/shinryujin03/cameraai2/blob/master/app/services/face/facial_attribute_recognition_services.py"
click node_verification "https://github.com/shinryujin03/cameraai2/blob/master/app/services/face/face_verification_services.py"
click node_recognition "https://github.com/shinryujin03/cameraai2/blob/master/app/services/face/face_recognition_services.py"
click node_human_detection "https://github.com/shinryujin03/cameraai2/blob/master/app/services/objects/human_detection_services.py"
click node_object_detection "https://github.com/shinryujin03/cameraai2/blob/master/app/services/objects/multiple_objects_detection_services.py"
click node_test_service "https://github.com/shinryujin03/cameraai2/tree/master/app/services/test"
click node_yolo "https://github.com/shinryujin03/cameraai2/blob/master/model/yolov8n.pt"
click node_database "https://github.com/shinryujin03/cameraai2/blob/master/database/database.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_face_routes,node_human_routes,node_objects_routes,node_test_routes,node_client toneBlue
class node_face_location,node_landmarks,node_attributes,node_verification,node_recognition,node_mysql toneAmber
class node_human_detection,node_object_detection,node_test_service toneMint
class node_database toneRose
class node_face_lib,node_deepface,node_yolo toneIndigo
```

## Components

### API entry

- [Flask application](https://github.com/shinryujin03/cameraai2/blob/master/app/main/main.py): `app/main/main.py`
- [Face routes](https://github.com/shinryujin03/cameraai2/blob/master/app/routers/face_routers.py): `app/routers/face_routers.py`
- [Human route](https://github.com/shinryujin03/cameraai2/blob/master/app/routers/human_detection_routers.py): `app/routers/human_detection_routers.py`
- [Object route](https://github.com/shinryujin03/cameraai2/blob/master/app/routers/multiple_objects_detection_routers.py): `app/routers/multiple_objects_detection_routers.py`
- [Test routes](https://github.com/shinryujin03/cameraai2/blob/master/app/routers/test_routers.py): `app/routers/test_routers.py`

### Face analysis

- [Face location](https://github.com/shinryujin03/cameraai2/blob/master/app/services/face/face_detection_services.py): `app/services/face/face_detection_services.py`
- [Face landmarks](https://github.com/shinryujin03/cameraai2/blob/master/app/services/face/face_landmarks_sevices.py): `app/services/face/face_landmarks_sevices.py`
- [Facial attributes](https://github.com/shinryujin03/cameraai2/blob/master/app/services/face/facial_attribute_recognition_services.py): `app/services/face/facial_attribute_recognition_services.py`
- [Face verification](https://github.com/shinryujin03/cameraai2/blob/master/app/services/face/face_verification_services.py): `app/services/face/face_verification_services.py`
- [Name recognition](https://github.com/shinryujin03/cameraai2/blob/master/app/services/face/face_recognition_services.py): `app/services/face/face_recognition_services.py`

### Object analysis

- [Human detection](https://github.com/shinryujin03/cameraai2/blob/master/app/services/objects/human_detection_services.py): `app/services/objects/human_detection_services.py`
- [Multiple objects](https://github.com/shinryujin03/cameraai2/blob/master/app/services/objects/multiple_objects_detection_services.py): `app/services/objects/multiple_objects_detection_services.py`
- [Image test tools](https://github.com/shinryujin03/cameraai2/tree/master/app/services/test): `app/services/test`

### Metadata storage

- [Metadata database](https://github.com/shinryujin03/cameraai2/blob/master/database/database.py): `database/database.py`

### Other components

- **API client**
- **Face recognition library**
- **DeepFace**
- [YOLO model](https://github.com/shinryujin03/cameraai2/blob/master/model/yolov8n.pt): `model/yolov8n.pt`
- **MySQL**

## Connections

- API client → Flask application: sends requests
- Flask application → Face routes: registers routes
- Flask application → Human route: registers routes
- Flask application → Object route: registers routes
- Flask application → Test routes: registers routes
- Face routes → Face location: dispatches
- Face routes → Face landmarks: dispatches
- Face routes → Facial attributes: dispatches
- Face routes → Face verification: dispatches
- Face routes → Name recognition: dispatches
- Human route → Human detection: dispatches
- Object route → Multiple objects: dispatches
- Test routes → Image test tools: dispatches
- Face location → Face recognition library: detects faces
- Face landmarks → Face location: requests locations
- Facial attributes → Face location: requests locations
- Facial attributes → DeepFace: analyzes attributes
- Face verification → Face location: requests locations
- Face verification → Face recognition library: encodes and compares
- Name recognition → Face location: requests locations
- Name recognition → Face recognition library: encodes and compares
- Human detection → YOLO model: runs inference
- Multiple objects → YOLO model: runs inference
- Face location → Metadata database: saves results and image
- Face landmarks → Metadata database: saves results
- Facial attributes → Metadata database: saves results and image
- Face verification → Metadata database: reads and saves
- Name recognition → Metadata database: reads enrolled faces
- Name recognition → Metadata database: saves high-confidence image
- Human detection → Metadata database: saves results and image
- Multiple objects → Metadata database: saves results and image
- Metadata database → MySQL: queries and writes
