# durgaprasaddammu/pedestrian-detection architecture

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

- Interactive diagram: https://gitdiagram.com/durgaprasaddammu/pedestrian-detection
- Repository: https://github.com/durgaprasaddammu/pedestrian-detection

## Overview

This is a pedestrian-detection dashboard backed by a FastAPI service, with a separate script for dataset preparation, model training, evaluation, and plotting. The main user flow uploads or selects an image, routes it to a detector, and displays annotated results. The dashboard also presents model metrics and training histories. Some implementation details are only documented in the README; those relationships are cited there rather than inferred from unsampled code.

Main entry points: [`app.py`](https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/app.py) (FastAPI service), [`static/script.js`](https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/static/script.js) (Browser dashboard), [`Pedestriansdetection.py`](https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/Pedestriansdetection.py) (Model training), [`model`](https://github.com/durgaprasaddammu/pedestrian-detection/tree/main/model) (Saved models and data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Dashboard and API"]
  node_dashboard["Browser dashboard<br/>[script.js]"]
  node_api["FastAPI service<br/>[app.py]"]
  node_sample_images["Sample images"]
end

subgraph group_detect["Detection and models"]
  node_image_input["Image decoding and routing<br/>[app.py]"]
  node_hog["OpenCV HOG detector<br/>[app.py]"]
  node_custom_yolo["Custom YOLO detector<br/>[app.py]"]
  node_attention["Attention layer<br/>[Attention.py]"]
  node_model_artifacts["Saved models and data"]
  node_annotate["Annotation and response<br/>[app.py]"]
end

subgraph group_insights["Model comparisons"]
  node_metrics["Metrics cache and endpoint<br/>[app.py]"]
  node_history["History cache and endpoint<br/>[app.py]"]
  node_charts["Comparison charts<br/>[script.js]"]
end

subgraph group_training["Training and evaluation"]
  node_data_prep["Dataset preparation"]
  node_model_training["Model training"]
  node_evaluation["Metrics evaluation"]
  node_plots["Training plots"]
end

node_user(("Dashboard user"))

node_user -->|"uses"| node_dashboard
node_dashboard -->|"requests predictions"| node_api
node_dashboard -->|"fetches metrics"| node_api
node_dashboard -->|"fetches history"| node_api
node_dashboard -->|"loads samples"| node_api
node_api -->|"routes upload"| node_image_input
node_image_input -->|"selects color path"| node_hog
node_image_input -->|"selects grayscale path"| node_custom_yolo
node_custom_yolo -->|"loads weights"| node_model_artifacts
node_custom_yolo -->|"uses layer"| node_attention
node_hog -->|"provides detections"| node_annotate
node_custom_yolo -->|"provides detections"| node_annotate
node_annotate -->|"returns result"| node_api
node_api -->|"lists and reads"| node_sample_images
node_api -->|"serves metrics"| node_metrics
node_api -->|"serves history"| node_history
node_metrics -->|"supplies comparisons"| node_charts
node_history -->|"supplies chart data"| node_charts
node_data_prep -->|"saves processed data"| node_model_artifacts
node_data_prep -->|"provides dataset"| node_model_training
node_model_training -->|"uses layer"| node_attention
node_model_training -->|"saves models and histories"| node_model_artifacts
node_model_training -->|"evaluates models"| node_evaluation
node_evaluation -->|"feeds comparisons"| node_plots
node_model_artifacts -->|"provides histories"| node_history

click node_dashboard "https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/static/script.js"
click node_api "https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/app.py"
click node_sample_images "https://github.com/durgaprasaddammu/pedestrian-detection/tree/main/testImages"
click node_image_input "https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/app.py"
click node_hog "https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/app.py"
click node_custom_yolo "https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/app.py"
click node_attention "https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/Attention.py"
click node_model_artifacts "https://github.com/durgaprasaddammu/pedestrian-detection/tree/main/model"
click node_annotate "https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/app.py"
click node_metrics "https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/app.py"
click node_history "https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/app.py"
click node_charts "https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/static/script.js"
click node_data_prep "https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/Pedestriansdetection.py"
click node_model_training "https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/Pedestriansdetection.py"
click node_evaluation "https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/Pedestriansdetection.py"
click node_plots "https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/Pedestriansdetection.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_api,node_sample_images,node_user toneBlue
class node_image_input,node_hog,node_custom_yolo,node_attention,node_model_artifacts,node_annotate toneAmber
class node_metrics,node_history,node_charts toneMint
class node_data_prep,node_model_training,node_evaluation,node_plots toneRose
```

## Components

### Dashboard and API

- [Browser dashboard](https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/static/script.js): `static/script.js`
- [FastAPI service](https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/app.py): `app.py`
- [Sample images](https://github.com/durgaprasaddammu/pedestrian-detection/tree/main/testImages): `testImages`

### Detection and models

- [Image decoding and routing](https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/app.py): `app.py`
- [OpenCV HOG detector](https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/app.py): `app.py`
- [Custom YOLO detector](https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/app.py): `app.py`
- [Attention layer](https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/Attention.py): `Attention.py`
- [Saved models and data](https://github.com/durgaprasaddammu/pedestrian-detection/tree/main/model): `model`
- [Annotation and response](https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/app.py): `app.py`

### Model comparisons

- [Metrics cache and endpoint](https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/app.py): `app.py`
- [History cache and endpoint](https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/app.py): `app.py`
- [Comparison charts](https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/static/script.js): `static/script.js`

### Training and evaluation

- [Dataset preparation](https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/Pedestriansdetection.py): `Pedestriansdetection.py`
- [Model training](https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/Pedestriansdetection.py): `Pedestriansdetection.py`
- [Metrics evaluation](https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/Pedestriansdetection.py): `Pedestriansdetection.py`
- [Training plots](https://github.com/durgaprasaddammu/pedestrian-detection/blob/main/Pedestriansdetection.py): `Pedestriansdetection.py`

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Browser dashboard: uses (evidence: `README.md`)
- Browser dashboard → FastAPI service: requests predictions (evidence: `static/script.js`)
- Browser dashboard → FastAPI service: fetches metrics (evidence: `static/script.js`)
- Browser dashboard → FastAPI service: fetches history (evidence: `static/script.js`)
- Browser dashboard → FastAPI service: loads samples (evidence: `static/script.js`)
- FastAPI service → Image decoding and routing: routes upload (evidence: `app.py`)
- Image decoding and routing → OpenCV HOG detector: selects color path (evidence: `README.md`)
- Image decoding and routing → Custom YOLO detector: selects grayscale path (evidence: `README.md`)
- Custom YOLO detector → Saved models and data: loads weights (evidence: `README.md`)
- Custom YOLO detector → Attention layer: uses layer (evidence: `app.py`)
- OpenCV HOG detector → Annotation and response: provides detections (evidence: `README.md`)
- Custom YOLO detector → Annotation and response: provides detections (evidence: `README.md`)
- Annotation and response → FastAPI service: returns result (evidence: `app.py`)
- FastAPI service → Sample images: lists and reads (evidence: `app.py`)
- FastAPI service → Metrics cache and endpoint: serves metrics (evidence: `app.py`)
- FastAPI service → History cache and endpoint: serves history (evidence: `app.py`)
- Metrics cache and endpoint → Comparison charts: supplies comparisons (evidence: `static/script.js`)
- History cache and endpoint → Comparison charts: supplies chart data (evidence: `static/script.js`)
- Dataset preparation → Saved models and data: saves processed data (evidence: `Pedestriansdetection.py`)
- Dataset preparation → Model training: provides dataset (evidence: `Pedestriansdetection.py`)
- Model training → Attention layer: uses layer (evidence: `Pedestriansdetection.py`)
- Model training → Saved models and data: saves models and histories (evidence: `README.md`)
- Model training → Metrics evaluation: evaluates models (evidence: `Pedestriansdetection.py`)
- Metrics evaluation → Training plots: feeds comparisons (evidence: `Pedestriansdetection.py`)
- Saved models and data → History cache and endpoint: provides histories (evidence: `README.md`)
