# asilyn/traffic-sign-ml architecture

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

- Interactive diagram: https://gitdiagram.com/asilyn/traffic-sign-ml
- Repository: https://github.com/asilyn/traffic-sign-ml

## Overview

Traffic Sign Recognition ML is a browser-based traffic-sign detection product backed by a Flask inference API. Users choose an image or camera feed, submit frames for classification, and view confidence-ranked results; the UI also supports live overlays and locally cached history. The backend preprocesses images and returns class metadata and alternate predictions. Training scripts are a separate model-preparation capability. Several frontend and ML modules are unsampled, so their internal links are omitted or marked unverified rather than inferred from filenames.

Main entry points: [`client/src/components/image-input/Image-input.tsx`](https://github.com/asilyn/traffic-sign-ml/blob/main/client/src/components/image-input/Image-input.tsx) (Image input), [`server/app/api/routes.py`](https://github.com/asilyn/traffic-sign-ml/blob/main/server/app/api/routes.py) (API routes), [`server/app/ml/predict_service.py`](https://github.com/asilyn/traffic-sign-ml/blob/main/server/app/ml/predict_service.py) (CNN predictor), [`client/src/components/detection-page/DetectionPage.tsx`](https://github.com/asilyn/traffic-sign-ml/blob/main/client/src/components/detection-page/DetectionPage.tsx) (Detection page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_landing["Landing page<br/>[LandingPage.tsx]"]
  node_detect_page["Detection page<br/>[DetectionPage.tsx]"]
  node_history["Detection history"]
  node_results["Detection results"]
  node_prediction_types["Prediction types<br/>[prediction.ts]"]
end

subgraph group_capture["Image capture"]
  node_input["Image input<br/>[Image-input.tsx]"]
  node_upload["Upload view<br/>[UploadView.tsx]"]
  node_camera["Camera view<br/>[CameraView.tsx]"]
  node_capture_utils["Capture utilities"]
end

subgraph group_service["Inference service"]
  node_api_client["API client<br/>[api.ts]"]
  node_flask_app["Flask app<br/>[__init__.py]"]
  node_routes["API routes<br/>[routes.py]"]
  node_predictor["CNN predictor<br/>[predict_service.py]"]
end

subgraph group_ml["ML lifecycle"]
  node_model_store[("Model artifacts")]
  node_train_model["Model training<br/>[train2.py]"]
  node_classifier_service["Detection classifier"]
  node_yolo_service["YOLO inference"]
end

node_driver(("Driver"))

node_driver -->|"opens"| node_landing
node_landing -->|"navigates to"| node_detect_page
node_driver -->|"provides image"| node_input
node_input -->|"renders"| node_upload
node_input -->|"renders"| node_camera
node_input -->|"uses"| node_capture_utils
node_input -.->|"submits frames"| node_api_client
node_api_client -->|"posts image"| node_routes
node_routes -->|"calls predictor"| node_predictor
node_predictor -->|"loads model"| node_model_store
node_predictor -->|"returns predictions"| node_routes
node_routes -->|"registers routes"| node_flask_app
node_detect_page -.->|"shows results"| node_results
node_detect_page -.->|"shows history"| node_history
node_api_client -->|"types results"| node_prediction_types
node_train_model -->|"produces artifacts"| node_model_store
node_classifier_service -.->|"optional classifier"| node_predictor
node_yolo_service -.->|"optional detection"| node_routes

click node_landing "https://github.com/asilyn/traffic-sign-ml/blob/main/client/src/components/landing-page/LandingPage.tsx"
click node_detect_page "https://github.com/asilyn/traffic-sign-ml/blob/main/client/src/components/detection-page/DetectionPage.tsx"
click node_input "https://github.com/asilyn/traffic-sign-ml/blob/main/client/src/components/image-input/Image-input.tsx"
click node_upload "https://github.com/asilyn/traffic-sign-ml/blob/main/client/src/components/image-input/UploadView.tsx"
click node_camera "https://github.com/asilyn/traffic-sign-ml/blob/main/client/src/components/image-input/CameraView.tsx"
click node_capture_utils "https://github.com/asilyn/traffic-sign-ml/tree/main/client/src/components/image-input/utils"
click node_api_client "https://github.com/asilyn/traffic-sign-ml/blob/main/client/src/lib/api.ts"
click node_history "https://github.com/asilyn/traffic-sign-ml/blob/main/client/src/components/detection-history/DetectionHistory.tsx"
click node_results "https://github.com/asilyn/traffic-sign-ml/blob/main/client/src/components/detection-result/DetectionResult.tsx"
click node_prediction_types "https://github.com/asilyn/traffic-sign-ml/blob/main/client/src/types/prediction.ts"
click node_flask_app "https://github.com/asilyn/traffic-sign-ml/blob/main/server/app/__init__.py"
click node_routes "https://github.com/asilyn/traffic-sign-ml/blob/main/server/app/api/routes.py"
click node_predictor "https://github.com/asilyn/traffic-sign-ml/blob/main/server/app/ml/predict_service.py"
click node_model_store "https://github.com/asilyn/traffic-sign-ml/tree/main/server/app/ml/dataset"
click node_train_model "https://github.com/asilyn/traffic-sign-ml/blob/main/server/app/ml/notebook/train2.py"
click node_classifier_service "https://github.com/asilyn/traffic-sign-ml/blob/main/server/app/ml/services/detection_classifier.py"
click node_yolo_service "https://github.com/asilyn/traffic-sign-ml/blob/main/server/app/ml/yolo_predict_service.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_landing,node_detect_page,node_history,node_results,node_prediction_types toneBlue
class node_input,node_upload,node_camera,node_capture_utils toneAmber
class node_api_client,node_flask_app,node_routes,node_predictor toneMint
class node_model_store,node_train_model,node_classifier_service,node_yolo_service toneRose
class node_driver toneIndigo
```

## Components

### Web experience

- [Landing page](https://github.com/asilyn/traffic-sign-ml/blob/main/client/src/components/landing-page/LandingPage.tsx): `client/src/components/landing-page/LandingPage.tsx`
- [Detection page](https://github.com/asilyn/traffic-sign-ml/blob/main/client/src/components/detection-page/DetectionPage.tsx): `client/src/components/detection-page/DetectionPage.tsx`
- [Detection history](https://github.com/asilyn/traffic-sign-ml/blob/main/client/src/components/detection-history/DetectionHistory.tsx): `client/src/components/detection-history/DetectionHistory.tsx`
- [Detection results](https://github.com/asilyn/traffic-sign-ml/blob/main/client/src/components/detection-result/DetectionResult.tsx): `client/src/components/detection-result/DetectionResult.tsx`
- [Prediction types](https://github.com/asilyn/traffic-sign-ml/blob/main/client/src/types/prediction.ts): `client/src/types/prediction.ts`

### Image capture

- [Image input](https://github.com/asilyn/traffic-sign-ml/blob/main/client/src/components/image-input/Image-input.tsx): `client/src/components/image-input/Image-input.tsx`
- [Upload view](https://github.com/asilyn/traffic-sign-ml/blob/main/client/src/components/image-input/UploadView.tsx): `client/src/components/image-input/UploadView.tsx`
- [Camera view](https://github.com/asilyn/traffic-sign-ml/blob/main/client/src/components/image-input/CameraView.tsx): `client/src/components/image-input/CameraView.tsx`
- [Capture utilities](https://github.com/asilyn/traffic-sign-ml/tree/main/client/src/components/image-input/utils): `client/src/components/image-input/utils`

### Inference service

- [API client](https://github.com/asilyn/traffic-sign-ml/blob/main/client/src/lib/api.ts): `client/src/lib/api.ts`
- [Flask app](https://github.com/asilyn/traffic-sign-ml/blob/main/server/app/__init__.py): `server/app/__init__.py`
- [API routes](https://github.com/asilyn/traffic-sign-ml/blob/main/server/app/api/routes.py): `server/app/api/routes.py`
- [CNN predictor](https://github.com/asilyn/traffic-sign-ml/blob/main/server/app/ml/predict_service.py): `server/app/ml/predict_service.py`

### ML lifecycle

- [Model artifacts](https://github.com/asilyn/traffic-sign-ml/tree/main/server/app/ml/dataset): `server/app/ml/dataset`
- [Model training](https://github.com/asilyn/traffic-sign-ml/blob/main/server/app/ml/notebook/train2.py): `server/app/ml/notebook/train2.py`
- [Detection classifier](https://github.com/asilyn/traffic-sign-ml/blob/main/server/app/ml/services/detection_classifier.py): `server/app/ml/services/detection_classifier.py`
- [YOLO inference](https://github.com/asilyn/traffic-sign-ml/blob/main/server/app/ml/yolo_predict_service.py): `server/app/ml/yolo_predict_service.py`

### Other components

- **Driver**

## Connections

- Driver → Landing page: opens (evidence: `client/src/components/landing-page/LandingPage.tsx`)
- Landing page → Detection page: navigates to (evidence: `client/src/components/landing-page/LandingPage.tsx`)
- Driver → Image input: provides image (evidence: `README.md`)
- Image input → Upload view: renders (evidence: `client/src/components/image-input/Image-input.tsx`)
- Image input → Camera view: renders (evidence: `client/src/components/image-input/Image-input.tsx`)
- Image input → Capture utilities: uses (evidence: `client/src/components/image-input/Image-input.tsx`)
- Image input → API client: submits frames
- API client → API routes: posts image (evidence: `client/src/lib/api.ts`)
- API routes → CNN predictor: calls predictor (evidence: `server/app/api/routes.py`)
- CNN predictor → Model artifacts: loads model (evidence: `server/app/ml/predict_service.py`)
- CNN predictor → API routes: returns predictions (evidence: `server/app/api/routes.py`)
- API routes → Flask app: registers routes (evidence: `server/app/__init__.py`)
- Detection page → Detection results: shows results
- Detection page → Detection history: shows history
- API client → Prediction types: types results (evidence: `client/src/lib/api.ts`)
- Model training → Model artifacts: produces artifacts (evidence: `README.md`)
- Detection classifier → CNN predictor: optional classifier
- YOLO inference → API routes: optional detection
