# its-kumar-yash/tomato-plant-disease-detection-model architecture

> Architecture diagram of the GitHub repository its-kumar-yash/tomato-plant-disease-detection-model, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/its-kumar-yash/tomato-plant-disease-detection-model
- Repository: https://github.com/its-kumar-yash/tomato-plant-disease-detection-model

## Overview

##### Project type and purpose
- This is a TinyML-based machine-learning pipeline for real-time tomato plant disease detection on edge devices.
- Offline components: data preprocessing, augmentation, model training and conversion (TensorFlow → TensorFlow Lite).
- Online/inference components: Edge Impulse integration, edge device (mobile/embedded) running the TFLite model, user interface for on-site diagnosis.

##### File structure
- Top-level artifacts:
– README.md (project overview, tech stack, usage)
– Tomato Plant Disease Detection.pdf (design doc or paper)
- “disease-prediction” and “health-prediction” folders each contain a Jupyter notebook (model.ipynb) representing separate model-development workflows.
- “model/1” holds a versioned TensorFlow SavedModel (saved_model.pb, fingerprint.pb, metadata).
- Root TFLite artifacts: tf_lite_model.tflite and tf_lite_quantized_model.tflite – the edge deployable models.

##### Insights from the README
- Data source: Plant Village dataset (16,011 images, 10 disease classes).
- Pipeline stages: data preprocessing → model development → conversion (TFLite & quantized) → deployment (Edge Impulse) → evaluation on edge.
- Real-world deployment: Edge Impulse app on mobile devices.

a. Main components
1. Data Storage & Preprocessing
– Raw image dataset repository (local or cloud storage).
– Preprocessing & augmentation notebook (disease-prediction/model.ipynb and health-prediction/model.ipynb).
2. Training & Validation Environment
– Python/TensorFlow training cluster or local GPU.
3. Model Artifact Repository
– Versioned SavedModel in “model/1”.
4. Model Conversion
– TensorFlow → TensorFlow Lite conversion, quantization steps producing tf_lite_model.tflite and tf_lite_quantized_model.tflite.
5. Edge Impulse Cloud Service
– Model upload, build, test harness.
6. Inference Runtime (Edge Device)
– Mobile or embedded device running TFLite engine.
– Input: camera or sensor feed.
7. User Interface
– Edge Impulse mobile app or custom UI for real-time predictions.

b. Relationships and data flows

c. Architectural patterns & design principles
– Pipeline architecture segregating offline (training) from online (inference).
– Versioned artifact management (SavedModel versioning).
– Modular conversion step enabling multiple target formats (TFLite, quantized).
– Cloud-edge integration pattern (Edge Impulse as CI/CD for TinyML).

d. Key technologies & frameworks
– Python, Jupyter Notebooks
– TensorFlow (training)
– TensorFlow Lite (inference, quantization)
– Edge Impulse (model management, deployment)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Documentation
    subgraph "Documentation"
        DOC1["README.md"]:::doc
        DOC2["Tomato Plant Disease Detection.pdf"]:::doc
    end

    %% Offline Pipeline
    subgraph "Offline Pipeline"
        style OfflinePipeline fill:#E8F4FD,stroke:#A4C8E0
        DS["Raw Image Dataset"]:::storage
        PP1["Data Preprocessing & Augmentation\n(Disease Workflow)"]:::process
        PP2["Data Preprocessing & Augmentation\n(Health Workflow)"]:::process
        TRAIN["Training & Validation\n(Python/TensorFlow)"]:::process
        REPO["Model Artifact Repository\n(model/1)"]:::storage
        CONV["Model Conversion\n(TFLite & Quantization)"]:::process
    end

    %% Online Inference
    subgraph "Online Inference"
        style OnlineInference fill:#E8FCE8,stroke:#A8DCA8
        EI["Edge Impulse Cloud Service"]:::cloud
        EDGE["Edge Device\n(Mobile/Embedded)"]:::device
        UI["User Interface\n(Edge Impulse App)"]:::ui
    end

    %% Future Extension
    subgraph "Future Extensions" 
        direction TB
        EXT["Multi-Crop & Sensor Integration"]:::future
    end

    %% Connections
    DOC1 -->|overview| DS
    DOC2 -->|design doc| DS
    DS -->|"raw images"| PP1
    DS -->|"raw images"| PP2
    PP1 -->|"preprocessed data"| TRAIN
    PP2 -->|"preprocessed data"| TRAIN
    TRAIN -->|"trained model"| REPO
    REPO -->|"SavedModel v1"| CONV
    CONV -->|"TFLite binary"| EI
    EI -->|"deployed model"| EDGE
    EDGE -->|"prediction output"| UI
    UI -->|"feedback data"| EI
    EXT -.-> UI

    %% Click Events
    click DOC1 "https://github.com/its-kumar-yash/tomato-plant-disease-detection-model/blob/main/README.md"
    click DOC2 "https://github.com/its-kumar-yash/tomato-plant-disease-detection-model/blob/main/Tomato Plant Disease Detection.pdf"
    click PP1 "https://github.com/its-kumar-yash/tomato-plant-disease-detection-model/blob/main/disease-prediction/model.ipynb"
    click PP2 "https://github.com/its-kumar-yash/tomato-plant-disease-detection-model/blob/main/health-prediction/model.ipynb"
    click REPO "https://github.com/its-kumar-yash/tomato-plant-disease-detection-model/blob/main/model/1/saved_model.pb"
    click REPO "https://github.com/its-kumar-yash/tomato-plant-disease-detection-model/blob/main/model/1/fingerprint.pb"
    click REPO "https://github.com/its-kumar-yash/tomato-plant-disease-detection-model/blob/main/model/1/keras_metadata.pb"
    click CONV "https://github.com/its-kumar-yash/tomato-plant-disease-detection-model/blob/main/tf_lite_model.tflite"
    click CONV "https://github.com/its-kumar-yash/tomato-plant-disease-detection-model/blob/main/tf_lite_quantized_model.tflite"

    %% Styles
    classDef doc fill:#F2F2F2,stroke:#CCCCCC,font-style:italic
    classDef storage fill:#FFF8DC,stroke:#F0E68C
    classDef process fill:#E0EBFF,stroke:#A3BFFA
    classDef cloud fill:#E3F2FD,stroke:#90CAF9
    classDef device fill:#F1F8E9,stroke:#AED581
    classDef ui fill:#F9FBE7,stroke:#DCE775
    classDef future fill:#FFFFFF,stroke:#AAAAAA,stroke-dasharray: 5 5, color:#888888

    class OfflinePipeline process
    class OnlineInference process
```
