# tgcabuang/guardian-vision architecture

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

- Interactive diagram: https://gitdiagram.com/tgcabuang/guardian-vision
- Repository: https://github.com/tgcabuang/guardian-vision

## Overview

Guardian Vision is an Electron-based surveillance application for live, multi-camera activity recognition and post-investigation review. Its documented inference path combines person detection, pose estimation and skeleton-based action recognition; the backend also handles alerts and recording/timeline functions. A separate model-development path prepares NTU video data and trains CTR-GCN weights for inference. The excerpts show backend component imports and recorder setup, but omit most routes and inference calls, so uncertain frontend-to-backend links are marked unverified rather than asserted.

Main entry points: [`backend/server_ws.py`](https://github.com/tgcabuang/guardian-vision/blob/main/backend/server_ws.py) (API and WebSocket), [`backend/detection_core.py`](https://github.com/tgcabuang/guardian-vision/blob/main/backend/detection_core.py) (Detection Runner), [`main.js`](https://github.com/tgcabuang/guardian-vision/blob/main/main.js) (Electron Shell), [`builder and trainer/training_with_cctv_aug.py`](https://github.com/tgcabuang/guardian-vision/blob/main/builder%20and%20trainer/training_with_cctv_aug.py) (CTR-GCN Training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop Application"]
  node_electron["Electron Shell<br/>[main.js]"]
  node_login["Login Screen<br/>[login.html]"]
  node_dashboard["Live Dashboard<br/>[ws_dashboard.js]"]
  node_admin["Admin Users<br/>[admin_users.html]"]
end

subgraph group_inference["Live Inference"]
  node_backend["API and WebSocket<br/>[server_ws.py]"]
  node_detection["Detection Runner<br/>[detection_core.py]"]
  node_actionmodel["CTR-GCN Model<br/>[ctrgcn_model.py]"]
  node_pose["RTMPose"]
  node_persondetector["YOLOv8"]
end

subgraph group_review["Recording and Review"]
  node_continuous["Continuous Recorder"]
  node_timeline["Timeline Utilities<br/>[timeline_utils.py]"]
  node_clips["Event Clips<br/>[clip_recorder.py]"]
  node_records[("Video Records")]
end

subgraph group_modeling["Model Development"]
  node_dataset["Dataset Builder"]
  node_training["CTR-GCN Training"]
  node_trainmodel["Training Model<br/>[ctrgcn_model.py]"]
  node_weights["Model Weights"]
end

node_operator(("Operator"))
node_cameras(("Camera Streams"))
node_ntu(("NTU RGB+D Videos"))

node_operator -->|"uses"| node_electron
node_electron -->|"loads first"| node_login
node_operator -->|"monitors"| node_dashboard
node_operator -->|"manages users"| node_admin
node_electron -->|"starts backend"| node_backend
node_dashboard -.->|"opens WebSocket"| node_backend
node_cameras -.->|"supply video"| node_detection
node_backend -->|"imports"| node_detection
node_detection -->|"uses model"| node_actionmodel
node_detection -.->|"estimates pose"| node_pose
node_detection -.->|"detects people"| node_persondetector
node_backend -->|"initializes manager"| node_continuous
node_backend -->|"imports"| node_timeline
node_backend -->|"inserts events"| node_timeline
node_continuous -.->|"writes segments"| node_records
node_clips -.->|"writes event clips"| node_records
node_timeline -.->|"indexes segments"| node_records
node_ntu -->|"provides videos"| node_dataset
node_dataset -->|"creates training data"| node_training
node_training -.->|"trains"| node_trainmodel
node_training -->|"generates weights"| node_weights
node_weights -->|"loaded for inference"| node_actionmodel

click node_electron "https://github.com/tgcabuang/guardian-vision/blob/main/main.js"
click node_login "https://github.com/tgcabuang/guardian-vision/blob/main/login.html"
click node_dashboard "https://github.com/tgcabuang/guardian-vision/blob/main/ws_dashboard.js"
click node_admin "https://github.com/tgcabuang/guardian-vision/blob/main/admin_users.html"
click node_backend "https://github.com/tgcabuang/guardian-vision/blob/main/backend/server_ws.py"
click node_detection "https://github.com/tgcabuang/guardian-vision/blob/main/backend/detection_core.py"
click node_actionmodel "https://github.com/tgcabuang/guardian-vision/blob/main/backend/ctrgcn_model.py"
click node_pose "https://github.com/tgcabuang/guardian-vision/tree/main/backend/assets"
click node_persondetector "https://github.com/tgcabuang/guardian-vision/tree/main/backend/assets"
click node_continuous "https://github.com/tgcabuang/guardian-vision/blob/main/backend/continuous_recorder.py"
click node_timeline "https://github.com/tgcabuang/guardian-vision/blob/main/backend/timeline_utils.py"
click node_clips "https://github.com/tgcabuang/guardian-vision/blob/main/backend/clip_recorder.py"
click node_dataset "https://github.com/tgcabuang/guardian-vision/blob/main/builder%20and%20trainer/dataset_builder_combine_recommended.py"
click node_training "https://github.com/tgcabuang/guardian-vision/blob/main/builder%20and%20trainer/training_with_cctv_aug.py"
click node_trainmodel "https://github.com/tgcabuang/guardian-vision/blob/main/builder%20and%20trainer/ctrgcn_model.py"
click node_weights "https://github.com/tgcabuang/guardian-vision/tree/main/backend/assets"

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_electron,node_login,node_dashboard,node_admin toneBlue
class node_backend,node_detection,node_actionmodel,node_pose,node_persondetector toneAmber
class node_continuous,node_timeline,node_clips,node_records toneMint
class node_dataset,node_training,node_trainmodel,node_weights toneRose
class node_operator,node_cameras,node_ntu toneIndigo
```

## Components

### Desktop Application

- [Electron Shell](https://github.com/tgcabuang/guardian-vision/blob/main/main.js): `main.js`
- [Login Screen](https://github.com/tgcabuang/guardian-vision/blob/main/login.html): `login.html`
- [Live Dashboard](https://github.com/tgcabuang/guardian-vision/blob/main/ws_dashboard.js): `ws_dashboard.js`
- [Admin Users](https://github.com/tgcabuang/guardian-vision/blob/main/admin_users.html): `admin_users.html`

### Live Inference

- [API and WebSocket](https://github.com/tgcabuang/guardian-vision/blob/main/backend/server_ws.py): `backend/server_ws.py`
- [Detection Runner](https://github.com/tgcabuang/guardian-vision/blob/main/backend/detection_core.py): `backend/detection_core.py`
- [CTR-GCN Model](https://github.com/tgcabuang/guardian-vision/blob/main/backend/ctrgcn_model.py): `backend/ctrgcn_model.py`
- [RTMPose](https://github.com/tgcabuang/guardian-vision/tree/main/backend/assets): `backend/assets`
- [YOLOv8](https://github.com/tgcabuang/guardian-vision/tree/main/backend/assets): `backend/assets`

### Recording and Review

- [Continuous Recorder](https://github.com/tgcabuang/guardian-vision/blob/main/backend/continuous_recorder.py): `backend/continuous_recorder.py`
- [Timeline Utilities](https://github.com/tgcabuang/guardian-vision/blob/main/backend/timeline_utils.py): `backend/timeline_utils.py`
- [Event Clips](https://github.com/tgcabuang/guardian-vision/blob/main/backend/clip_recorder.py): `backend/clip_recorder.py`
- **Video Records**

### Model Development

- [Dataset Builder](https://github.com/tgcabuang/guardian-vision/blob/main/builder%20and%20trainer/dataset_builder_combine_recommended.py): `builder and trainer/dataset_builder_combine_recommended.py`
- [CTR-GCN Training](https://github.com/tgcabuang/guardian-vision/blob/main/builder%20and%20trainer/training_with_cctv_aug.py): `builder and trainer/training_with_cctv_aug.py`
- [Training Model](https://github.com/tgcabuang/guardian-vision/blob/main/builder%20and%20trainer/ctrgcn_model.py): `builder and trainer/ctrgcn_model.py`
- [Model Weights](https://github.com/tgcabuang/guardian-vision/tree/main/backend/assets): `backend/assets`

### Other components

- **Operator**
- **Camera Streams**
- **NTU RGB+D Videos**

## Connections

- Operator → Electron Shell: uses (evidence: `README.md`)
- Electron Shell → Login Screen: loads first (evidence: `main.js`)
- Operator → Live Dashboard: monitors (evidence: `README.md`)
- Operator → Admin Users: manages users
- Electron Shell → API and WebSocket: starts backend (evidence: `README.md`)
- Live Dashboard → API and WebSocket: opens WebSocket
- Camera Streams → Detection Runner: supply video
- API and WebSocket → Detection Runner: imports (evidence: `backend/server_ws.py`)
- Detection Runner → CTR-GCN Model: uses model (evidence: `backend/detection_core.py`)
- Detection Runner → RTMPose: estimates pose
- Detection Runner → YOLOv8: detects people
- API and WebSocket → Continuous Recorder: initializes manager (evidence: `backend/server_ws.py`)
- API and WebSocket → Timeline Utilities: imports (evidence: `backend/server_ws.py`)
- API and WebSocket → Timeline Utilities: inserts events (evidence: `backend/server_ws.py`)
- Continuous Recorder → Video Records: writes segments
- Event Clips → Video Records: writes event clips
- Timeline Utilities → Video Records: indexes segments
- NTU RGB+D Videos → Dataset Builder: provides videos (evidence: `README.md`)
- Dataset Builder → CTR-GCN Training: creates training data (evidence: `README.md`)
- CTR-GCN Training → Training Model: trains
- CTR-GCN Training → Model Weights: generates weights (evidence: `README.md`)
- Model Weights → CTR-GCN Model: loaded for inference (evidence: `README.md`)
