# pratham-nayak1/pothole-detector architecture

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

- Interactive diagram: https://gitdiagram.com/pratham-nayak1/pothole-detector
- Repository: https://github.com/pratham-nayak1/pothole-detector

## Overview

Road Pothole Detection is an offline computer-vision application for road-defect images and video. Its documented main workflow is a user submitting a built-in or uploaded clip in Streamlit; the video runner detects and filters defects, assigns clip-level track IDs, optionally predicts pothole severity, then produces an annotated MP4 and track-level CSV/JSON reports. The repository also includes image inference, detector evaluation, and severity data review and training utilities. Some subsystem paths and connections are documented, but their source was not sampled; those links are omitted rather than inferred.

Main entry points: [`src/video/runner.py`](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/video/runner.py) (Video runner), [`src/pipeline/runner.py`](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/pipeline/runner.py) (Image runner), [`src/common/config.py`](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/common/config.py) (Pipeline settings), [`src/app.py`](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/app.py) (Streamlit dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Video application"]
  node_dashboard["Streamlit dashboard<br/>[app.py]"]
  node_video_runner["Video runner<br/>[runner.py]"]
  node_video_outputs["Video and reports"]
end

subgraph group_inference["Inference runtime"]
  node_settings["Pipeline settings<br/>[config.py]"]
  node_detector_model["Detector model<br/>[models.py]"]
  node_image_runner["Image runner<br/>[runner.py]"]
  node_pipeline_io["Pipeline I/O<br/>[io.py]"]
  node_postprocess["Detection filtering<br/>[postprocess.py]"]
  node_tracker["RoadTracker<br/>[tracker.py]"]
  node_track_summary["Track summaries<br/>[tracks.py]"]
end

subgraph group_severity["Severity workflow"]
  node_severity_data["Severity dataset<br/>[dataset.py]"]
  node_severity_review["Severity review<br/>[review.py]"]
  node_review_app["Review application<br/>[review_app.py]"]
  node_severity_training["Severity training"]
  node_severity_prep["Severity preparation<br/>[prepare_dataset.py]"]
  node_severity_labels["Label collection<br/>[collect_labels.py]"]
end

subgraph group_detector["Detector development"]
  node_detector_training["Detector training<br/>[train_yolo11s.py]"]
  node_detector_tools["Detector experiments"]
end

subgraph group_evaluation["Evaluation"]
  node_dataset_audit["Dataset audit<br/>[dataset_audit.py]"]
  node_detector_evaluation["Detector evaluation"]
end

node_user(("Video user"))
node_video_input["Video input"]

node_user -->|"uses"| node_dashboard
node_dashboard -->|"calls"| node_video_runner
node_user -->|"provides"| node_video_input
node_video_runner -->|"loads"| node_settings
node_video_runner -->|"loads"| node_detector_model
node_video_runner -->|"filters"| node_postprocess
node_video_runner -->|"assigns tracks"| node_tracker
node_video_runner -->|"updates summaries"| node_track_summary
node_video_runner -->|"uses"| node_pipeline_io
node_video_runner -->|"reads"| node_video_input
node_video_runner -->|"writes"| node_video_outputs
node_image_runner -->|"loads"| node_settings
node_image_runner -->|"uses"| node_detector_model
node_image_runner -->|"filters"| node_postprocess
node_image_runner -->|"uses"| node_pipeline_io
node_review_app -->|"uses"| node_severity_review
node_severity_training -->|"loads"| node_severity_data
node_severity_prep -.->|"prepares"| node_severity_data
node_severity_labels -.->|"supplies labels"| node_severity_review
node_detector_tools -.->|"fine-tunes"| node_detector_training
node_detector_evaluation -->|"loads"| node_settings

click node_dashboard "https://github.com/pratham-nayak1/pothole-detector/blob/main/src/app.py"
click node_video_runner "https://github.com/pratham-nayak1/pothole-detector/blob/main/src/video/runner.py"
click node_settings "https://github.com/pratham-nayak1/pothole-detector/blob/main/src/common/config.py"
click node_detector_model "https://github.com/pratham-nayak1/pothole-detector/blob/main/src/pipeline/models.py"
click node_image_runner "https://github.com/pratham-nayak1/pothole-detector/blob/main/src/pipeline/runner.py"
click node_pipeline_io "https://github.com/pratham-nayak1/pothole-detector/blob/main/src/pipeline/io.py"
click node_postprocess "https://github.com/pratham-nayak1/pothole-detector/blob/main/src/detection/postprocess.py"
click node_tracker "https://github.com/pratham-nayak1/pothole-detector/blob/main/src/video/tracker.py"
click node_track_summary "https://github.com/pratham-nayak1/pothole-detector/blob/main/src/video/tracks.py"
click node_severity_data "https://github.com/pratham-nayak1/pothole-detector/blob/main/src/severity/dataset.py"
click node_severity_review "https://github.com/pratham-nayak1/pothole-detector/blob/main/src/severity/review.py"
click node_review_app "https://github.com/pratham-nayak1/pothole-detector/blob/main/src/severity/review_app.py"
click node_severity_training "https://github.com/pratham-nayak1/pothole-detector/blob/main/src/severity/train_efficientnet.py"
click node_severity_prep "https://github.com/pratham-nayak1/pothole-detector/blob/main/src/severity/prepare_dataset.py"
click node_severity_labels "https://github.com/pratham-nayak1/pothole-detector/blob/main/src/severity/collect_labels.py"
click node_detector_training "https://github.com/pratham-nayak1/pothole-detector/blob/main/src/detection/train_yolo11s.py"
click node_detector_tools "https://github.com/pratham-nayak1/pothole-detector/blob/main/src/detection/finetune_yolo11s_800.py"
click node_dataset_audit "https://github.com/pratham-nayak1/pothole-detector/blob/main/src/evaluation/dataset_audit.py"
click node_detector_evaluation "https://github.com/pratham-nayak1/pothole-detector/blob/main/src/evaluation/evaluate_detector.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_dashboard,node_video_runner,node_video_outputs,node_user toneBlue
class node_settings,node_detector_model,node_image_runner,node_pipeline_io,node_postprocess,node_tracker,node_track_summary toneAmber
class node_severity_data,node_severity_review,node_review_app,node_severity_training,node_severity_prep,node_severity_labels toneMint
class node_detector_training,node_detector_tools toneRose
class node_dataset_audit,node_detector_evaluation,node_video_input toneIndigo
```

## Components

### Video application

- [Streamlit dashboard](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/app.py): `src/app.py`
- [Video runner](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/video/runner.py): `src/video/runner.py`
- **Video and reports**

### Inference runtime

- [Pipeline settings](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/common/config.py): `src/common/config.py`
- [Detector model](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/pipeline/models.py): `src/pipeline/models.py`
- [Image runner](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/pipeline/runner.py): `src/pipeline/runner.py`
- [Pipeline I/O](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/pipeline/io.py): `src/pipeline/io.py`
- [Detection filtering](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/detection/postprocess.py): `src/detection/postprocess.py`
- [RoadTracker](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/video/tracker.py): `src/video/tracker.py`
- [Track summaries](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/video/tracks.py): `src/video/tracks.py`

### Severity workflow

- [Severity dataset](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/severity/dataset.py): `src/severity/dataset.py`
- [Severity review](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/severity/review.py): `src/severity/review.py`
- [Review application](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/severity/review_app.py): `src/severity/review_app.py`
- [Severity training](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/severity/train_efficientnet.py): `src/severity/train_efficientnet.py`
- [Severity preparation](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/severity/prepare_dataset.py): `src/severity/prepare_dataset.py`
- [Label collection](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/severity/collect_labels.py): `src/severity/collect_labels.py`

### Detector development

- [Detector training](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/detection/train_yolo11s.py): `src/detection/train_yolo11s.py`
- [Detector experiments](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/detection/finetune_yolo11s_800.py): `src/detection/finetune_yolo11s_800.py`

### Evaluation

- [Dataset audit](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/evaluation/dataset_audit.py): `src/evaluation/dataset_audit.py`
- [Detector evaluation](https://github.com/pratham-nayak1/pothole-detector/blob/main/src/evaluation/evaluate_detector.py): `src/evaluation/evaluate_detector.py`

### Other components

- **Video user**
- **Video input**

## Connections

- Video user → Streamlit dashboard: uses (evidence: `README.md`)
- Streamlit dashboard → Video runner: calls (evidence: `README.md`)
- Video user → Video input: provides (evidence: `README.md`)
- Video runner → Pipeline settings: loads (evidence: `src/video/runner.py`)
- Video runner → Detector model: loads (evidence: `src/video/runner.py`)
- Video runner → Detection filtering: filters (evidence: `src/video/runner.py`)
- Video runner → RoadTracker: assigns tracks (evidence: `src/video/runner.py`)
- Video runner → Track summaries: updates summaries (evidence: `src/video/runner.py`)
- Video runner → Pipeline I/O: uses (evidence: `src/video/runner.py`)
- Video runner → Video input: reads (evidence: `README.md`)
- Video runner → Video and reports: writes (evidence: `README.md`)
- Image runner → Pipeline settings: loads (evidence: `src/pipeline/runner.py`)
- Image runner → Detector model: uses (evidence: `src/pipeline/runner.py`)
- Image runner → Detection filtering: filters (evidence: `src/pipeline/runner.py`)
- Image runner → Pipeline I/O: uses (evidence: `src/pipeline/runner.py`)
- Review application → Severity review: uses (evidence: `src/severity/review_app.py`)
- Severity training → Severity dataset: loads (evidence: `src/severity/train_efficientnet.py`)
- Severity preparation → Severity dataset: prepares
- Label collection → Severity review: supplies labels
- Detector experiments → Detector training: fine-tunes
- Detector evaluation → Pipeline settings: loads (evidence: `src/evaluation/evaluate_detector.py`)
