# harishwaran25/weapon-detection-yolo architecture

> Architecture diagram of the GitHub repository harishwaran25/weapon-detection-yolo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harishwaran25/weapon-detection-yolo
- Repository: https://github.com/harishwaran25/weapon-detection-yolo

## Overview

Sentinel AI is a weapon-detection surveillance system with a browser command center, a FastAPI service, standalone PyTorch detection, and a Raspberry Pi TFLite mode. The main workflow is camera or uploaded media → inference → annotated evidence and incident alerts → operator review and status updates. Separate branches cover metrics, host telemetry, benchmark samples, model training/evaluation, and edge deployment. Backend internals and some dashboard integrations are represented from README claims; those files were not excerpted, so the graph does not infer unshown implementation details.

Main entry points: [`dashboard/src/App.tsx`](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/dashboard/src/App.tsx) (Dashboard app), [`src/alerting/alert.py`](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/src/alerting/alert.py) (Alert manager), [`src/server.py`](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/src/server.py) (FastAPI service), [`dashboard/src/components/LiveSurveillance.tsx`](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/dashboard/src/components/LiveSurveillance.tsx) (Live surveillance)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Operations dashboard"]
  node_app["Dashboard app<br/>[App.tsx]"]
  node_live["Live surveillance"]
  node_inspector["Threat inspector"]
  node_incident_ui["Incident command<br/>[AlertPanel.tsx]"]
  node_analytics_ui["Analytics panel<br/>[AnalyticsPanel.tsx]"]
  node_telemetry_ui["Edge telemetry<br/>[EdgeNodePanel.tsx]"]
  node_dataset_ui["Dataset panel<br/>[DatasetPanel.tsx]"]
  node_camera_canvas["Stream canvas"]
  node_audio["Browser alarm audio<br/>[audio.ts]"]
end

subgraph group_backend["Detection backend"]
  node_api["FastAPI service<br/>[server.py]"]
  node_pytorch["PyTorch detection<br/>[detect.py]"]
end

subgraph group_incidents["Incident handling"]
  node_incident_mgr["Alert manager<br/>[alert.py]"]
  node_alert_store[("Alert JSON log<br/>[alerts.json]")]
  node_snapshots["Incident snapshots"]
end

subgraph group_edge["Edge deployment"]
  node_edge_detector["TFLite inference loop<br/>[detect_tflite.py]"]
end

subgraph group_modelops["Model lifecycle"]
  node_data_config["Dataset configuration<br/>[data.yaml]"]
  node_samples["Benchmark samples"]
  node_evaluation["Model evaluation<br/>[evaluate.py]"]
  node_training["Custom training<br/>[train_custom.py]"]
  node_exporter["TFLite export<br/>[export_tflite.py]"]
end

node_operator(("Security operator"))
node_browser(("Browser"))
node_webhook(("Webhook destination"))
node_gpio(("GPIO buzzer"))
node_edge_device(("Raspberry Pi"))

node_operator -->|"uses"| node_browser
node_browser -->|"opens"| node_app
node_app -->|"renders"| node_live
node_app -->|"renders"| node_inspector
node_app -->|"renders"| node_incident_ui
node_app -->|"renders"| node_analytics_ui
node_app -->|"renders"| node_telemetry_ui
node_app -->|"renders"| node_dataset_ui
node_live -->|"streams frames"| node_api
node_inspector -->|"uploads media"| node_api
node_app -->|"polls alerts"| node_api
node_incident_ui -->|"requests status updates"| node_app
node_live -.->|"displays stream"| node_camera_canvas
node_live -->|"triggers siren"| node_audio
node_api -->|"runs inference"| node_pytorch
node_pytorch -->|"triggers alerts"| node_incident_mgr
node_api -->|"records incidents"| node_incident_mgr
node_incident_mgr -->|"appends alerts"| node_alert_store
node_incident_mgr -->|"saves evidence"| node_snapshots
node_incident_mgr -.->|"notifies"| node_webhook
node_incident_mgr -.->|"activates buzzer"| node_gpio
node_edge_device -->|"runs"| node_edge_detector
node_edge_detector -->|"triggers alerts"| node_incident_mgr
node_dataset_ui -->|"browses samples"| node_samples
node_evaluation -->|"validates against"| node_data_config
node_analytics_ui -->|"shows metrics"| node_evaluation
node_training -.->|"trains on"| node_data_config
node_exporter -->|"produces model for"| node_edge_detector

click node_app "https://github.com/harishwaran25/weapon-detection-yolo/blob/main/dashboard/src/App.tsx"
click node_live "https://github.com/harishwaran25/weapon-detection-yolo/blob/main/dashboard/src/components/LiveSurveillance.tsx"
click node_inspector "https://github.com/harishwaran25/weapon-detection-yolo/blob/main/dashboard/src/components/ThreatInspector.tsx"
click node_incident_ui "https://github.com/harishwaran25/weapon-detection-yolo/blob/main/dashboard/src/components/AlertPanel.tsx"
click node_analytics_ui "https://github.com/harishwaran25/weapon-detection-yolo/blob/main/dashboard/src/components/AnalyticsPanel.tsx"
click node_telemetry_ui "https://github.com/harishwaran25/weapon-detection-yolo/blob/main/dashboard/src/components/EdgeNodePanel.tsx"
click node_dataset_ui "https://github.com/harishwaran25/weapon-detection-yolo/blob/main/dashboard/src/components/DatasetPanel.tsx"
click node_camera_canvas "https://github.com/harishwaran25/weapon-detection-yolo/blob/main/dashboard/src/components/CameraStreamCanvas.tsx"
click node_audio "https://github.com/harishwaran25/weapon-detection-yolo/blob/main/dashboard/src/utils/audio.ts"
click node_api "https://github.com/harishwaran25/weapon-detection-yolo/blob/main/src/server.py"
click node_pytorch "https://github.com/harishwaran25/weapon-detection-yolo/blob/main/src/detect.py"
click node_incident_mgr "https://github.com/harishwaran25/weapon-detection-yolo/blob/main/src/alerting/alert.py"
click node_alert_store "https://github.com/harishwaran25/weapon-detection-yolo/blob/main/outputs/alerts.json"
click node_snapshots "https://github.com/harishwaran25/weapon-detection-yolo/tree/main/outputs"
click node_edge_detector "https://github.com/harishwaran25/weapon-detection-yolo/blob/main/src/detect_tflite.py"
click node_data_config "https://github.com/harishwaran25/weapon-detection-yolo/blob/main/data/data.yaml"
click node_samples "https://github.com/harishwaran25/weapon-detection-yolo/tree/main/data/samples"
click node_evaluation "https://github.com/harishwaran25/weapon-detection-yolo/blob/main/src/evaluate.py"
click node_training "https://github.com/harishwaran25/weapon-detection-yolo/blob/main/src/train_custom.py"
click node_exporter "https://github.com/harishwaran25/weapon-detection-yolo/blob/main/src/export_tflite.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_live,node_inspector,node_incident_ui,node_analytics_ui,node_telemetry_ui,node_dataset_ui,node_camera_canvas,node_audio,node_browser toneBlue
class node_api,node_pytorch toneAmber
class node_incident_mgr,node_alert_store,node_snapshots,node_webhook toneMint
class node_edge_detector toneRose
class node_data_config,node_samples,node_evaluation,node_training,node_exporter,node_operator,node_gpio,node_edge_device toneIndigo
```

## Components

### Operations dashboard

- [Dashboard app](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/dashboard/src/App.tsx): `dashboard/src/App.tsx`
- [Live surveillance](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/dashboard/src/components/LiveSurveillance.tsx): `dashboard/src/components/LiveSurveillance.tsx`
- [Threat inspector](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/dashboard/src/components/ThreatInspector.tsx): `dashboard/src/components/ThreatInspector.tsx`
- [Incident command](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/dashboard/src/components/AlertPanel.tsx): `dashboard/src/components/AlertPanel.tsx`
- [Analytics panel](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/dashboard/src/components/AnalyticsPanel.tsx): `dashboard/src/components/AnalyticsPanel.tsx`
- [Edge telemetry](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/dashboard/src/components/EdgeNodePanel.tsx): `dashboard/src/components/EdgeNodePanel.tsx`
- [Dataset panel](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/dashboard/src/components/DatasetPanel.tsx): `dashboard/src/components/DatasetPanel.tsx`
- [Stream canvas](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/dashboard/src/components/CameraStreamCanvas.tsx): `dashboard/src/components/CameraStreamCanvas.tsx`
- [Browser alarm audio](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/dashboard/src/utils/audio.ts): `dashboard/src/utils/audio.ts`

### Detection backend

- [FastAPI service](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/src/server.py): `src/server.py`
- [PyTorch detection](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/src/detect.py): `src/detect.py`

### Incident handling

- [Alert manager](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/src/alerting/alert.py): `src/alerting/alert.py`
- [Alert JSON log](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/outputs/alerts.json): `outputs/alerts.json`
- [Incident snapshots](https://github.com/harishwaran25/weapon-detection-yolo/tree/main/outputs): `outputs`

### Edge deployment

- [TFLite inference loop](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/src/detect_tflite.py): `src/detect_tflite.py`

### Model lifecycle

- [Dataset configuration](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/data/data.yaml): `data/data.yaml`
- [Benchmark samples](https://github.com/harishwaran25/weapon-detection-yolo/tree/main/data/samples): `data/samples`
- [Model evaluation](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/src/evaluate.py): `src/evaluate.py`
- [Custom training](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/src/train_custom.py): `src/train_custom.py`
- [TFLite export](https://github.com/harishwaran25/weapon-detection-yolo/blob/main/src/export_tflite.py): `src/export_tflite.py`

### Other components

- **Security operator**
- **Browser**
- **Webhook destination**
- **GPIO buzzer**
- **Raspberry Pi**

## Connections

- Security operator → Browser: uses (evidence: `README.md`)
- Browser → Dashboard app: opens (evidence: `README.md`)
- Dashboard app → Live surveillance: renders (evidence: `dashboard/src/App.tsx`)
- Dashboard app → Threat inspector: renders (evidence: `dashboard/src/App.tsx`)
- Dashboard app → Incident command: renders (evidence: `dashboard/src/App.tsx`)
- Dashboard app → Analytics panel: renders (evidence: `dashboard/src/App.tsx`)
- Dashboard app → Edge telemetry: renders (evidence: `dashboard/src/App.tsx`)
- Dashboard app → Dataset panel: renders (evidence: `dashboard/src/App.tsx`)
- Live surveillance → FastAPI service: streams frames (evidence: `README.md`)
- Threat inspector → FastAPI service: uploads media (evidence: `README.md`)
- Dashboard app → FastAPI service: polls alerts (evidence: `dashboard/src/App.tsx`)
- Incident command → Dashboard app: requests status updates (evidence: `dashboard/src/components/AlertPanel.tsx`)
- Live surveillance → Stream canvas: displays stream
- Live surveillance → Browser alarm audio: triggers siren (evidence: `README.md`)
- FastAPI service → PyTorch detection: runs inference (evidence: `README.md`)
- PyTorch detection → Alert manager: triggers alerts (evidence: `src/detect.py`)
- FastAPI service → Alert manager: records incidents (evidence: `README.md`)
- Alert manager → Alert JSON log: appends alerts (evidence: `src/alerting/alert.py`)
- Alert manager → Incident snapshots: saves evidence (evidence: `README.md`)
- Alert manager → Webhook destination: notifies (evidence: `src/alerting/alert.py`)
- Alert manager → GPIO buzzer: activates buzzer (evidence: `src/alerting/alert.py`)
- Raspberry Pi → TFLite inference loop: runs (evidence: `README.md`)
- TFLite inference loop → Alert manager: triggers alerts (evidence: `src/detect_tflite.py`)
- Dataset panel → Benchmark samples: browses samples (evidence: `README.md`)
- Model evaluation → Dataset configuration: validates against (evidence: `README.md`)
- Analytics panel → Model evaluation: shows metrics (evidence: `README.md`)
- Custom training → Dataset configuration: trains on
- TFLite export → TFLite inference loop: produces model for (evidence: `README.md`)
