# divaprof0912-cyber/traffic-violation-detection-system architecture

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

- Interactive diagram: https://gitdiagram.com/divaprof0912-cyber/traffic-violation-detection-system
- Repository: https://github.com/divaprof0912-cyber/traffic-violation-detection-system

## Overview

The product is a Streamlit image-based traffic-violation detector. A user uploads an image; the app converts it to an array, runs YOLO inference, checks detections for helmet violations or triple riding, and displays an annotated image or a no-violation warning. The README also describes vehicle–violation association using IoU, but the sampled app excerpt does not show that step. The runtime map is based on app.py; no other source modules appear in the tree.

Main entry points: [`app.py`](https://github.com/divaprof0912-cyber/traffic-violation-detection-system/blob/main/app.py) (YOLO Inference), [`best.pt`](https://github.com/divaprof0912-cyber/traffic-violation-detection-system/blob/main/best.pt) (Model Weights)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_upload["Image Upload<br/>[app.py]"]
  node_display["Result Display<br/>[app.py]"]
end

subgraph group_detection["Detection Workflow"]
  node_prepare["Image Conversion<br/>[app.py]"]
  node_inference["YOLO Inference<br/>[app.py]"]
  node_weights["Model Weights<br/>[best.pt]"]
  node_violation["Violation Check<br/>[app.py]"]
end

node_user(("User"))

node_user -->|"uploads image"| node_upload
node_upload -->|"provides image"| node_prepare
node_prepare -->|"passes array"| node_inference
node_inference -->|"loads weights"| node_weights
node_inference -->|"returns detections"| node_violation
node_violation -->|"shows outcome"| node_display

click node_upload "https://github.com/divaprof0912-cyber/traffic-violation-detection-system/blob/main/app.py"
click node_prepare "https://github.com/divaprof0912-cyber/traffic-violation-detection-system/blob/main/app.py"
click node_inference "https://github.com/divaprof0912-cyber/traffic-violation-detection-system/blob/main/app.py"
click node_weights "https://github.com/divaprof0912-cyber/traffic-violation-detection-system/blob/main/best.pt"
click node_violation "https://github.com/divaprof0912-cyber/traffic-violation-detection-system/blob/main/app.py"
click node_display "https://github.com/divaprof0912-cyber/traffic-violation-detection-system/blob/main/app.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_upload,node_display,node_user toneBlue
class node_prepare,node_inference,node_weights,node_violation toneAmber
```

## Components

### User Interface

- [Image Upload](https://github.com/divaprof0912-cyber/traffic-violation-detection-system/blob/main/app.py): `app.py`
- [Result Display](https://github.com/divaprof0912-cyber/traffic-violation-detection-system/blob/main/app.py): `app.py`

### Detection Workflow

- [Image Conversion](https://github.com/divaprof0912-cyber/traffic-violation-detection-system/blob/main/app.py): `app.py`
- [YOLO Inference](https://github.com/divaprof0912-cyber/traffic-violation-detection-system/blob/main/app.py): `app.py`
- [Model Weights](https://github.com/divaprof0912-cyber/traffic-violation-detection-system/blob/main/best.pt): `best.pt`
- [Violation Check](https://github.com/divaprof0912-cyber/traffic-violation-detection-system/blob/main/app.py): `app.py`

### Other components

- **User**

## Connections

- User → Image Upload: uploads image (evidence: `app.py`)
- Image Upload → Image Conversion: provides image (evidence: `app.py`)
- Image Conversion → YOLO Inference: passes array (evidence: `app.py`)
- YOLO Inference → Model Weights: loads weights (evidence: `app.py`)
- YOLO Inference → Violation Check: returns detections (evidence: `app.py`)
- Violation Check → Result Display: shows outcome (evidence: `app.py`)
