# iciamyplant/amyplant-security architecture

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

- Interactive diagram: https://gitdiagram.com/iciamyplant/amyplant-security
- Repository: https://github.com/iciamyplant/amyplant-security

## Overview

amyplant-security is a collection of face-analysis experiments and webcam applications. Its clearest user-facing workflow serves a live camera stream through Flask, detects faces, estimates age and gender, annotates frames, and streams them to a browser. A separate recognition app matches detected faces against known-face images; another Flask app streams recognized faces. The README also describes a from-scratch detection-data and model-training workflow, while UDP camera-frame transport is an independent deployment experiment. Some capabilities are documented or evident from the tree but their implementation was not sampled, so uncertain internal links are omitted.

Main entry points: [`App/app_vdef.py`](https://github.com/iciamyplant/amyplant-security/blob/main/App/app_vdef.py) (Flask video app), [`Face_recognition/Opencv_firstproject/camera_stream/app.py`](https://github.com/iciamyplant/amyplant-security/blob/main/Face_recognition/Opencv_firstproject/camera_stream/app.py) (Recognition stream app), [`Face_recognition/Opencv_firstproject/simplefacerec.py`](https://github.com/iciamyplant/amyplant-security/blob/main/Face_recognition/Opencv_firstproject/simplefacerec.py) (Face matching engine), [`Face_detection/First_model_VGG16`](https://github.com/iciamyplant/amyplant-security/tree/main/Face_detection/First_model_VGG16) (Detection data/model workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_age_stream["Age-gender streaming"]
  node_age_flask["Flask video app<br/>[app_vdef.py]"]
  node_face_box["Face localization<br/>[app_vdef.py]"]
  node_demographic_models["Age/gender models<br/>[app_vdef.py]"]
  node_age_page["Stream page<br/>[index.html]"]
  node_gender_cli["Age/gender webcam app<br/>[main.py]"]
  node_gender_models["Face/gender model assets"]
end

subgraph group_recognition["Face recognition"]
  node_recognition_cli["Recognition webcam app<br/>[main.py]"]
  node_recognition_web["Recognition stream app<br/>[app.py]"]
  node_recognition_engine["Face matching engine<br/>[simplefacerec.py]"]
  node_known_faces[("Known-face images")]
  node_recognition_page["Recognition page<br/>[index.html]"]
end

subgraph group_detection_training["Detection development"]
  node_detection_data[("Annotated face dataset<br/>[face_images.csv]")]
  node_detection_workflow["Detection data/model workflow"]
  node_trained_detector["Saved VGG16 model"]
end

subgraph group_transport["Camera transport"]
  node_frame_client["UDP frame sender<br/>[OpenCVClient.py]"]
  node_frame_server["UDP frame receiver<br/>[OpenCVServer.py]"]
end

node_viewer(("Browser viewer"))
node_camera(("Local webcam"))
node_udp_network(("UDP network"))

node_viewer -->|"requests page/stream"| node_age_flask
node_age_flask -->|"renders page"| node_age_page
node_age_flask -->|"captures frames"| node_camera
node_age_flask -->|"localizes faces"| node_face_box
node_age_flask -->|"infers attributes"| node_demographic_models
node_age_flask -->|"streams annotated frames"| node_viewer
node_camera -->|"provides frames"| node_recognition_cli
node_recognition_cli -->|"detects and matches"| node_recognition_engine
node_recognition_engine -->|"loads image encodings"| node_known_faces
node_camera -->|"provides frames"| node_recognition_web
node_recognition_web -->|"detects and matches"| node_recognition_engine
node_recognition_web -->|"renders page"| node_recognition_page
node_viewer -->|"requests stream"| node_recognition_web
node_recognition_web -->|"streams recognized frames"| node_viewer
node_detection_workflow -->|"uses annotated data"| node_detection_data
node_detection_workflow -->|"trains model"| node_trained_detector
node_camera -->|"provides frames"| node_gender_cli
node_gender_cli -->|"loads and runs models"| node_gender_models
node_camera -->|"captures frames"| node_frame_client
node_frame_client -->|"sends frames"| node_udp_network
node_udp_network -->|"delivers frames"| node_frame_server

click node_age_flask "https://github.com/iciamyplant/amyplant-security/blob/main/App/app_vdef.py"
click node_face_box "https://github.com/iciamyplant/amyplant-security/blob/main/App/app_vdef.py"
click node_demographic_models "https://github.com/iciamyplant/amyplant-security/blob/main/App/app_vdef.py"
click node_age_page "https://github.com/iciamyplant/amyplant-security/blob/main/App/Templates/index.html"
click node_recognition_cli "https://github.com/iciamyplant/amyplant-security/blob/main/Face_recognition/Opencv_firstproject/main.py"
click node_recognition_web "https://github.com/iciamyplant/amyplant-security/blob/main/Face_recognition/Opencv_firstproject/camera_stream/app.py"
click node_recognition_engine "https://github.com/iciamyplant/amyplant-security/blob/main/Face_recognition/Opencv_firstproject/simplefacerec.py"
click node_known_faces "https://github.com/iciamyplant/amyplant-security/tree/main/Face_recognition/Opencv_firstproject/Known_Faces"
click node_recognition_page "https://github.com/iciamyplant/amyplant-security/blob/main/Face_recognition/Opencv_firstproject/camera_stream/templates/index.html"
click node_detection_data "https://github.com/iciamyplant/amyplant-security/blob/main/Face_detection/First_model_VGG16/face_images.csv"
click node_detection_workflow "https://github.com/iciamyplant/amyplant-security/tree/main/Face_detection/First_model_VGG16"
click node_trained_detector "https://github.com/iciamyplant/amyplant-security/tree/main/Face_detection/First_model_VGG16/saved_model/my_model"
click node_gender_cli "https://github.com/iciamyplant/amyplant-security/blob/main/Age_gender/Final_age_gender/main.py"
click node_gender_models "https://github.com/iciamyplant/amyplant-security/tree/main/Age_gender/Final_age_gender"
click node_frame_client "https://github.com/iciamyplant/amyplant-security/blob/main/Deployment/sockets_for_camerastream/OpenCVClient.py"
click node_frame_server "https://github.com/iciamyplant/amyplant-security/blob/main/Deployment/sockets_for_camerastream/OpenCVServer.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_age_flask,node_face_box,node_demographic_models,node_age_page,node_gender_cli,node_gender_models,node_viewer toneBlue
class node_recognition_cli,node_recognition_web,node_recognition_engine,node_known_faces,node_recognition_page toneAmber
class node_detection_data,node_detection_workflow,node_trained_detector toneMint
class node_frame_client,node_frame_server toneRose
class node_camera,node_udp_network toneIndigo
```

## Components

### Age-gender streaming

- [Flask video app](https://github.com/iciamyplant/amyplant-security/blob/main/App/app_vdef.py): `App/app_vdef.py`
- [Face localization](https://github.com/iciamyplant/amyplant-security/blob/main/App/app_vdef.py): `App/app_vdef.py`
- [Age/gender models](https://github.com/iciamyplant/amyplant-security/blob/main/App/app_vdef.py): `App/app_vdef.py`
- [Stream page](https://github.com/iciamyplant/amyplant-security/blob/main/App/Templates/index.html): `App/Templates/index.html`
- [Age/gender webcam app](https://github.com/iciamyplant/amyplant-security/blob/main/Age_gender/Final_age_gender/main.py): `Age_gender/Final_age_gender/main.py`
- [Face/gender model assets](https://github.com/iciamyplant/amyplant-security/tree/main/Age_gender/Final_age_gender): `Age_gender/Final_age_gender`

### Face recognition

- [Recognition webcam app](https://github.com/iciamyplant/amyplant-security/blob/main/Face_recognition/Opencv_firstproject/main.py): `Face_recognition/Opencv_firstproject/main.py`
- [Recognition stream app](https://github.com/iciamyplant/amyplant-security/blob/main/Face_recognition/Opencv_firstproject/camera_stream/app.py): `Face_recognition/Opencv_firstproject/camera_stream/app.py`
- [Face matching engine](https://github.com/iciamyplant/amyplant-security/blob/main/Face_recognition/Opencv_firstproject/simplefacerec.py): `Face_recognition/Opencv_firstproject/simplefacerec.py`
- [Known-face images](https://github.com/iciamyplant/amyplant-security/tree/main/Face_recognition/Opencv_firstproject/Known_Faces): `Face_recognition/Opencv_firstproject/Known_Faces`
- [Recognition page](https://github.com/iciamyplant/amyplant-security/blob/main/Face_recognition/Opencv_firstproject/camera_stream/templates/index.html): `Face_recognition/Opencv_firstproject/camera_stream/templates/index.html`

### Detection development

- [Annotated face dataset](https://github.com/iciamyplant/amyplant-security/blob/main/Face_detection/First_model_VGG16/face_images.csv): `Face_detection/First_model_VGG16/face_images.csv`
- [Detection data/model workflow](https://github.com/iciamyplant/amyplant-security/tree/main/Face_detection/First_model_VGG16): `Face_detection/First_model_VGG16`
- [Saved VGG16 model](https://github.com/iciamyplant/amyplant-security/tree/main/Face_detection/First_model_VGG16/saved_model/my_model): `Face_detection/First_model_VGG16/saved_model/my_model`

### Camera transport

- [UDP frame sender](https://github.com/iciamyplant/amyplant-security/blob/main/Deployment/sockets_for_camerastream/OpenCVClient.py): `Deployment/sockets_for_camerastream/OpenCVClient.py`
- [UDP frame receiver](https://github.com/iciamyplant/amyplant-security/blob/main/Deployment/sockets_for_camerastream/OpenCVServer.py): `Deployment/sockets_for_camerastream/OpenCVServer.py`

### Other components

- **Browser viewer**
- **Local webcam**
- **UDP network**

## Connections

- Browser viewer → Flask video app: requests page/stream
- Flask video app → Stream page: renders page
- Flask video app → Local webcam: captures frames
- Flask video app → Face localization: localizes faces
- Flask video app → Age/gender models: infers attributes
- Flask video app → Browser viewer: streams annotated frames
- Local webcam → Recognition webcam app: provides frames
- Recognition webcam app → Face matching engine: detects and matches
- Face matching engine → Known-face images: loads image encodings
- Local webcam → Recognition stream app: provides frames
- Recognition stream app → Face matching engine: detects and matches
- Recognition stream app → Recognition page: renders page
- Browser viewer → Recognition stream app: requests stream
- Recognition stream app → Browser viewer: streams recognized frames
- Detection data/model workflow → Annotated face dataset: uses annotated data
- Detection data/model workflow → Saved VGG16 model: trains model
- Local webcam → Age/gender webcam app: provides frames
- Age/gender webcam app → Face/gender model assets: loads and runs models
- Local webcam → UDP frame sender: captures frames
- UDP frame sender → UDP network: sends frames
- UDP network → UDP frame receiver: delivers frames
