# x-men01/yolov10-fire-and-smoke-detection architecture

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

- Interactive diagram: https://gitdiagram.com/x-men01/yolov10-fire-and-smoke-detection
- Repository: https://github.com/x-men01/yolov10-fire-and-smoke-detection

## Overview

##### Project type and purpose
- This is a domain-specific machine-learning system for real-time fire and smoke detection. It comprises:
- A data-processing pipeline (data cleaning notebook)
- A model-training workflow producing YOLOv10 weights
- An inference/demo application (demo/app.py) served via a web interface (Hugging Face Spaces)

##### File structure
- Top‐level:
- README.md – overall project description, metrics, usage
- clean_dataset_with_cleanvision_libary.ipynb – data‐cleaning notebook
- demo/
– app.py (inference & UI glue code)
– examples/ (sample inputs)
– requirements.txt (runtime dependencies for demo)
- models/ (pretrained YOLOv10 .pt weight files)
- No separate “src” or “backend” folders; the demo folder doubles as the inference service codebase.
- External build/deployment: via Hugging Face Spaces (not tracked in repo).

##### README for additional insights
- Data source: Roboflow image dataset
- Data cleaning: cleanvision library
- Model: YOLOv10 trained, evaluated with precision/recall/mAP50
- Demo: live Hugging Face app (likely Gradio)

##### Main components & their relationships
a. Data Ingestion & Cleaning
- Raw images (Roboflow) → cleanvision → cleaned dataset (123k images)
b. Model Training
- Cleaned dataset → YOLOv10 training script (outside this repo) → model weights (.pt) → stored in models/
c. Model Storage
- models/ directory or cloud storage (Hugging Face Model Hub)
d. Inference Service / Demo App
e. Front-end UI
- Gradio/Streamlit interface (embedded in demo/app.py) → user uploads video/image or streams camera feed → displays annotated output
f. Deployment on Hugging Face Spaces
- The entire demo folder (code + requirements) deployed as a Space for public access

##### Architectural patterns & design principles
- Pipeline structure: clear separation of data cleaning, training, inference
- Reuse of pretrained weights: modular model storage
- Single‐process inference service with lightweight web front-end (no heavy microservices)
- Minimal dependencies (cleanvision, ultralytics or PyTorch, Gradio)

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Offline Pipeline"
        DataSource["Roboflow Image Dataset"]:::external
        cleaning["Data Cleaning Notebook"]:::compute
        cleaned["Cleaned Dataset\n123k images"]:::data
        training["Model Training Workflow\n(YOLOv10)"]:::compute
        subgraph "Model Storage"
            weight1["YOLOv10-FireSmoke-M.pt"]:::storage
            weight2["YOLOv10-FireSmoke-X.pt"]:::storage
        end
    end

    subgraph "Online Demo"
        inference["Inference Service\ndemo/app.py"]:::compute
        dependencies["Demo Dependencies\nrequirements.txt"]:::storage
        examples["Sample Inputs"]:::storage
        ui["Web UI (Gradio)"]:::compute
        hf["Hugging Face Spaces"]:::external
    end

    readme["README.md\nProject Description & Metrics"]:::data

    DataSource -->|"raw images"| cleaning
    cleaning -->|"cleaned images"| cleaned
    cleaned --> training
    training -->|"model weights"| weight1
    training --> weight2
    weight1 --> inference
    weight2 --> inference
    inference --> dependencies
    inference --> examples
    inference -->|"detections"| ui
    ui -->|"deployed to"| hf

    click cleaning "https://github.com/x-men01/yolov10-fire-and-smoke-detection/blob/main/clean_dataset_with_cleanvision_libary.ipynb"
    click readme "https://github.com/x-men01/yolov10-fire-and-smoke-detection/blob/main/README.md"
    click weight1 "https://github.com/x-men01/yolov10-fire-and-smoke-detection/blob/main/models/YOLOv10-FireSmoke-M.pt"
    click weight2 "https://github.com/x-men01/yolov10-fire-and-smoke-detection/blob/main/models/YOLOv10-FireSmoke-X.pt"
    click inference "https://github.com/x-men01/yolov10-fire-and-smoke-detection/blob/main/demo/app.py"
    click dependencies "https://github.com/x-men01/yolov10-fire-and-smoke-detection/blob/main/demo/requirements.txt"
    click examples "https://github.com/x-men01/yolov10-fire-and-smoke-detection/tree/main/demo/examples"

    classDef data fill:#E0F7FA,stroke:#006064,color:#004D40
    classDef compute fill:#E8F5E9,stroke:#1B5E20,color:#2E7D32
    classDef storage fill:#FFF3E0,stroke:#E65100,color:#BF360C
    classDef external fill:#F3E5F5,stroke:#4A148C,color:#6A1B9A
```
