# akashrajpuria/crowdcount architecture

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

- Interactive diagram: https://gitdiagram.com/akashrajpuria/crowdcount
- Repository: https://github.com/akashrajpuria/crowdcount

## Overview

CrowdCount is a browser dashboard for counting people in uploaded photos and videos and in live webcam frames. Users upload media or start the webcam; the backend runs adaptive YOLO detection, returns counts and annotated results, and records completed jobs for dashboard history and playback. The graph also preserves the standalone adaptive-counter CLI and the original HOG/SVM demo. Some image-job and webcam backend details are in omitted excerpts, so those links are documented or marked unverified rather than inferred from sibling modules.

Main entry points: [`web/app.py`](https://github.com/akashrajpuria/crowdcount/blob/main/web/app.py) (API and jobs), [`People_Detection.py`](https://github.com/akashrajpuria/crowdcount/blob/main/People_Detection.py) (YOLO counter), [`web/static/app.js`](https://github.com/akashrajpuria/crowdcount/blob/main/web/static/app.js) (Dashboard UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Browser dashboard"]
  node_browser["Dashboard UI<br/>[app.js]"]
end

subgraph group_service["Web service"]
  node_fastapi["API and jobs<br/>[app.py]"]
  node_history[("Job history<br/>[app.py]")]
  node_media["Media files<br/>[app.py]"]
end

subgraph group_vision["People detection"]
  node_counter["YOLO counter"]
  node_adaptive["Adaptive inference"]
  node_tilemerge["Tile and box merging"]
  node_smoothing["Count smoothing"]
  node_annotate["Frame annotation"]
end

subgraph group_standalone["Standalone demos"]
  node_hogdemo["HOG/SVM demo"]
end

node_user(("Dashboard user"))

node_user -->|"uses"| node_browser
node_browser -->|"requests APIs"| node_fastapi
node_browser -->|"streams webcam frames"| node_fastapi
node_fastapi -->|"invokes frame counting"| node_counter
node_fastapi -->|"reads and writes"| node_history
node_fastapi -->|"stores and serves"| node_media
node_counter -->|"detects people"| node_adaptive
node_adaptive -->|"merges detections"| node_tilemerge
node_counter -.->|"smooths counts"| node_smoothing
node_counter -.->|"annotates frames"| node_annotate

click node_browser "https://github.com/akashrajpuria/crowdcount/blob/main/web/static/app.js"
click node_fastapi "https://github.com/akashrajpuria/crowdcount/blob/main/web/app.py"
click node_history "https://github.com/akashrajpuria/crowdcount/blob/main/web/app.py"
click node_media "https://github.com/akashrajpuria/crowdcount/blob/main/web/app.py"
click node_counter "https://github.com/akashrajpuria/crowdcount/blob/main/People_Detection.py"
click node_adaptive "https://github.com/akashrajpuria/crowdcount/blob/main/People_Detection.py"
click node_tilemerge "https://github.com/akashrajpuria/crowdcount/blob/main/People_Detection.py"
click node_smoothing "https://github.com/akashrajpuria/crowdcount/blob/main/People_Detection.py"
click node_annotate "https://github.com/akashrajpuria/crowdcount/blob/main/People_Detection.py"
click node_hogdemo "https://github.com/akashrajpuria/crowdcount/blob/main/human-counting-project-code.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_browser,node_user toneBlue
class node_fastapi,node_history,node_media toneAmber
class node_counter,node_adaptive,node_tilemerge,node_smoothing,node_annotate toneMint
class node_hogdemo toneRose
```

## Components

### Browser dashboard

- [Dashboard UI](https://github.com/akashrajpuria/crowdcount/blob/main/web/static/app.js): `web/static/app.js`

### Web service

- [API and jobs](https://github.com/akashrajpuria/crowdcount/blob/main/web/app.py): `web/app.py`
- [Job history](https://github.com/akashrajpuria/crowdcount/blob/main/web/app.py): `web/app.py`
- [Media files](https://github.com/akashrajpuria/crowdcount/blob/main/web/app.py): `web/app.py`

### People detection

- [YOLO counter](https://github.com/akashrajpuria/crowdcount/blob/main/People_Detection.py): `People_Detection.py`
- [Adaptive inference](https://github.com/akashrajpuria/crowdcount/blob/main/People_Detection.py): `People_Detection.py`
- [Tile and box merging](https://github.com/akashrajpuria/crowdcount/blob/main/People_Detection.py): `People_Detection.py`
- [Count smoothing](https://github.com/akashrajpuria/crowdcount/blob/main/People_Detection.py): `People_Detection.py`
- [Frame annotation](https://github.com/akashrajpuria/crowdcount/blob/main/People_Detection.py): `People_Detection.py`

### Standalone demos

- [HOG/SVM demo](https://github.com/akashrajpuria/crowdcount/blob/main/human-counting-project-code.py): `human-counting-project-code.py`

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Dashboard UI: uses (evidence: `README.md`)
- Dashboard UI → API and jobs: requests APIs (evidence: `web/static/app.js`)
- Dashboard UI → API and jobs: streams webcam frames (evidence: `web/static/app.js`)
- API and jobs → YOLO counter: invokes frame counting (evidence: `web/app.py`)
- API and jobs → Job history: reads and writes (evidence: `web/app.py`)
- API and jobs → Media files: stores and serves (evidence: `web/app.py`)
- YOLO counter → Adaptive inference: detects people (evidence: `People_Detection.py`)
- Adaptive inference → Tile and box merging: merges detections (evidence: `People_Detection.py`)
- YOLO counter → Count smoothing: smooths counts (evidence: `People_Detection.py`)
- YOLO counter → Frame annotation: annotates frames (evidence: `People_Detection.py`)
