# rushidarge/traffic-signs-detection architecture

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

- Interactive diagram: https://gitdiagram.com/rushidarge/traffic-signs-detection
- Repository: https://github.com/rushidarge/traffic-signs-detection

## Overview

##### Project Type and Purpose
- This is a computer vision project focused on real-time traffic sign detection and classification using the YOLOv9 model.
- Its purpose is to detect and classify traffic signs to help improve urban routing/transport efficiency.
- It leverages multiple stages including data collection, preparation, analysis, prediction (model evaluation), and an application layer (app.py for running or demonstrating the model).

##### File Structure
- Top-level Files:
- README.md, app.py, requirements.txt indicate that the project is executable as a script and has dependencies declared.
- The model directory contains model metadata (e.g., model_file_path.txt), hinting at persistence for the trained model.
- Subdirectories in the "code" folder represent distinct stages:
- Data Collection (notebooks to download data).
- Data Preparation (notebooks like coco_to_yolo.ipynb, which likely converts annotations).
- Data Analysis (exploratory data analysis and image plotting notebooks).
- Prediction (includes notebooks for running detection, analyzing model performance, and preparing stats).
- There are also supporting assets (images) for visualization and PPT for presentation purposes.

##### Key Components
- Data Collection Module:
- Represented by "code/data_collection" with notebooks responsible for downloading and managing datasets.
- Data Preparation Module:
- Contained in "code/Data Preparation". It is used to convert dataset annotations (e.g., COCO to YOLO) ensuring data is ready for training.
- Data Analysis Module:
- Shown by "code/Data_analysis", this module performs Exploratory Data Analysis (EDA) and visualizes data directly on road images to inspect dataset quality.
- Prediction / Model Evaluation Module:
- Housed in "code/Prediction", includes notebooks for predicting traffic signs, computing model accuracies, and preparing performance stats.
- Model Storage:
- Represented by the "model" directory where trained model file details (model_file_path.txt) are stored.
- Application or Deployment Component:
- The "app.py" file likely serves as the entry point for running the detection model in a real-time or demo environment.
- External Resources & Dependencies:
- External libraries and frameworks (PyTorch, OpenCV, YOLOv9 specific code and possibly other deep learning utilities) as noted in the README and requirements.txt.

##### Relationships and Interactions
- Data Flow:
- Raw data is obtained via the Data Collection component.
- It is then cleansed and converted into the appropriate format in the Data Preparation stage.
- The prepared data is analyzed for quality and insights through the Data Analysis component.
- The Prediction module utilizes the prepared and evaluated dataset to run and assess the YOLOv9 model’s performance.
- The trained/evaluated model is stored in the Model Storage, and used by the Application (app.py) for actual detection tasks.
- Process Flow:
- Move to data preprocessing (converting annotations).
- Proceed through exploratory analysis.
- Then model prediction/training and performance evaluation.
- Finally, deployment (or demo) via app.py.

##### Architectural Patterns
- Modular Pipeline: The project is structured as a sequential data pipeline where each stage (collection, preparation, analysis, prediction) is separated.
- Notebook-Driven Development: Each major step is implemented as a Jupyter Notebook to allow iterative development and analysis.
- Separation of Concerns: Individual directories for distinct aspects (data, model, code) indicate a design with clear component boundaries.

## Diagram (Mermaid)

```mermaid
graph TD
  %% Input Nodes
  IMG("Image Dataset"):::input
  EXT("External Libraries (YOLOv9,PyTorch,OpenCV)"):::external

  %% Data Pipeline Subgraph
  subgraph "Data Pipeline"
    DC("Data Collection Module"):::dataproc
    DP("Data Preparation Module"):::dataproc
    DA("Data Analysis Module"):::dataproc
    DC --> DP
    DP --> DA
  end

  %% Model Pipeline Subgraph
  subgraph "Model Pipeline"
    PM("Prediction/Model Evaluation Module"):::model
    MS("Model Storage"):::model
    PM --> MS
  end

  %% Deployment Layer Subgraph
  subgraph "Deployment"
    AP("Application/Deployment Component"):::deploy
  end

  %% Flow Connections
  IMG --> DC
  DA --> PM
  MS --> AP
  EXT --> PM

  %% Click Events
  click DC "https://github.com/rushidarge/traffic-signs-detection/blob/main/code/data_collection/download_data.ipynb"
  click DP "https://github.com/rushidarge/traffic-signs-detection/blob/main/code/Data Preparation/coco_to_yolo.ipynb"
  click DA "https://github.com/rushidarge/traffic-signs-detection/tree/main/code/Data_analysis"
  click PM "https://github.com/rushidarge/traffic-signs-detection/tree/main/code/Prediction"
  click MS "https://github.com/rushidarge/traffic-signs-detection/blob/main/model/model_file_path.txt"
  click AP "https://github.com/rushidarge/traffic-signs-detection/blob/main/app.py"

  %% Styles
  classDef input fill:#FFF3CD,stroke:#FFC107,stroke-width:2px;
  classDef external fill:#E2F0CB,stroke:#8BC34A,stroke-width:2px;
  classDef dataproc fill:#AED6F1,stroke:#2980B9,stroke-width:2px;
  classDef model fill:#ABEBC6,stroke:#27AE60,stroke-width:2px;
  classDef deploy fill:#F9E79F,stroke:#F1C40F,stroke-width:2px;
```
