# shivammaurya14/road-defect-detector architecture

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

- Interactive diagram: https://gitdiagram.com/shivammaurya14/road-defect-detector
- Repository: https://github.com/shivammaurya14/road-defect-detector

## Overview

This repository is a road-defect detection platform: an operator starts collection or analysis in the Flask dashboard, which coordinates camera input, GPS, inference, telemetry and saved results. The dashboard also exposes mapping, settings and incident/recording management; a separate CLI runs YOLO dashcam inference. Training and the supplied dataset are documented product capabilities, though their implementation details are not sampled. Connections involving unsampled subsystems are included only where the README documents them; source excerpts do not show all runtime wiring.

Main entry points: [`deploy/app.py`](https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/app.py) (Dashboard Runtime), [`deploy/static/script.js`](https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/static/script.js) (Dashboard UI), [`deploy/infer_dashcam.py`](https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/infer_dashcam.py) (Standalone Dashcam), [`logs`](https://github.com/shivammaurya14/road-defect-detector/tree/main/logs) (Local Logs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Capture and Inference"]
  node_flask["Dashboard Runtime<br/>[app.py]"]
  node_yolo["YOLO Detection<br/>[app.py]"]
  node_unet["U-Net Segmentation<br/>[app.py]"]
  node_dashcam["Standalone Dashcam<br/>[infer_dashcam.py]"]
end

subgraph group_web["Dashboard"]
  node_browser["Dashboard UI<br/>[script.js]"]
  node_map["Live Defect Map<br/>[script.js]"]
  node_settings["Mode and Settings<br/>[script.js]"]
end

subgraph group_records["Telemetry and Records"]
  node_telemetry["HUD and Telemetry<br/>[app.py]"]
  node_incident["Incident Logs<br/>[app.py]"]
  node_recording["Video and GPS Recording<br/>[app.py]"]
  node_storage[("Local Logs")]
end

subgraph group_training["Training Assets"]
  node_training["Model Training"]
  node_dataset["Labeled Dataset"]
end

node_operator(("Operator"))
node_camera["Camera or Video"]
node_gps["GPS Source"]

node_operator -->|"uses"| node_browser
node_browser -->|"controls and polls"| node_flask
node_browser -->|"sends browser GPS"| node_flask
node_flask -->|"reads frames"| node_camera
node_flask -.->|"reads location"| node_gps
node_flask -->|"runs detection"| node_yolo
node_flask -->|"runs segmentation"| node_unet
node_flask -->|"updates"| node_telemetry
node_flask -->|"creates and serves"| node_incident
node_flask -->|"writes video and GPS"| node_recording
node_incident -->|"persists logs and images"| node_storage
node_recording -->|"persists recordings"| node_storage
node_browser -->|"shows location pins"| node_map
node_browser -->|"configures modes"| node_settings
node_operator -->|"runs standalone"| node_dashcam
node_dashcam -->|"reads frames"| node_camera
node_dashcam -->|"reads location"| node_gps
node_dashcam -->|"writes incident records"| node_storage
node_operator -->|"trains model"| node_training
node_training -.->|"uses labeled data"| node_dataset

click node_flask "https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/app.py"
click node_yolo "https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/app.py"
click node_unet "https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/app.py"
click node_dashcam "https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/infer_dashcam.py"
click node_browser "https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/static/script.js"
click node_map "https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/static/script.js"
click node_settings "https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/static/script.js"
click node_telemetry "https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/app.py"
click node_incident "https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/app.py"
click node_recording "https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/app.py"
click node_storage "https://github.com/shivammaurya14/road-defect-detector/tree/main/logs"
click node_training "https://github.com/shivammaurya14/road-defect-detector/tree/main/notebook"
click node_dataset "https://github.com/shivammaurya14/road-defect-detector/tree/main/dataset"

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_flask,node_yolo,node_unet,node_dashcam toneBlue
class node_browser,node_map,node_settings toneAmber
class node_telemetry,node_incident,node_recording,node_storage toneMint
class node_training,node_dataset toneRose
class node_operator,node_camera,node_gps toneIndigo
```

## Components

### Capture and Inference

- [Dashboard Runtime](https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/app.py): `deploy/app.py`
- [YOLO Detection](https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/app.py): `deploy/app.py`
- [U-Net Segmentation](https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/app.py): `deploy/app.py`
- [Standalone Dashcam](https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/infer_dashcam.py): `deploy/infer_dashcam.py`

### Dashboard

- [Dashboard UI](https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/static/script.js): `deploy/static/script.js`
- [Live Defect Map](https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/static/script.js): `deploy/static/script.js`
- [Mode and Settings](https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/static/script.js): `deploy/static/script.js`

### Telemetry and Records

- [HUD and Telemetry](https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/app.py): `deploy/app.py`
- [Incident Logs](https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/app.py): `deploy/app.py`
- [Video and GPS Recording](https://github.com/shivammaurya14/road-defect-detector/blob/main/deploy/app.py): `deploy/app.py`
- [Local Logs](https://github.com/shivammaurya14/road-defect-detector/tree/main/logs): `logs`

### Training Assets

- [Model Training](https://github.com/shivammaurya14/road-defect-detector/tree/main/notebook): `notebook`
- [Labeled Dataset](https://github.com/shivammaurya14/road-defect-detector/tree/main/dataset): `dataset`

### Other components

- **Operator**
- **Camera or Video**
- **GPS Source**

## Connections

- Operator → Dashboard UI: uses (evidence: `README.md`)
- Dashboard UI → Dashboard Runtime: controls and polls (evidence: `deploy/static/script.js`)
- Dashboard UI → Dashboard Runtime: sends browser GPS (evidence: `deploy/static/script.js`)
- Dashboard Runtime → Camera or Video: reads frames (evidence: `deploy/app.py`)
- Dashboard Runtime → GPS Source: reads location (evidence: `README.md`)
- Dashboard Runtime → YOLO Detection: runs detection (evidence: `deploy/app.py`)
- Dashboard Runtime → U-Net Segmentation: runs segmentation (evidence: `deploy/app.py`)
- Dashboard Runtime → HUD and Telemetry: updates (evidence: `deploy/app.py`)
- Dashboard Runtime → Incident Logs: creates and serves (evidence: `deploy/app.py`)
- Dashboard Runtime → Video and GPS Recording: writes video and GPS (evidence: `deploy/app.py`)
- Incident Logs → Local Logs: persists logs and images (evidence: `README.md`)
- Video and GPS Recording → Local Logs: persists recordings (evidence: `deploy/app.py`)
- Dashboard UI → Live Defect Map: shows location pins (evidence: `README.md`)
- Dashboard UI → Mode and Settings: configures modes (evidence: `deploy/static/script.js`)
- Operator → Standalone Dashcam: runs standalone (evidence: `README.md`)
- Standalone Dashcam → Camera or Video: reads frames (evidence: `deploy/infer_dashcam.py`)
- Standalone Dashcam → GPS Source: reads location (evidence: `deploy/infer_dashcam.py`)
- Standalone Dashcam → Local Logs: writes incident records (evidence: `deploy/infer_dashcam.py`)
- Operator → Model Training: trains model (evidence: `README.md`)
- Model Training → Labeled Dataset: uses labeled data (evidence: `README.md`)
