# bhavyapriyan/tomato_leaf_classification architecture

> Architecture diagram of the GitHub repository bhavyapriyan/tomato_leaf_classification, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bhavyapriyan/tomato_leaf_classification
- Repository: https://github.com/bhavyapriyan/tomato_leaf_classification

## Overview

#### Purpose and Entry Point
This repository is a CNN-based image classification project for identifying tomato leaf categories across 10 classes. The primary—and only visible—implementation entry point is the Jupyter notebook at `Tomato_leaf_classification.ipynb`.

#### Execution Model
The project is notebook-driven rather than packaged as an application or service. A user runs cells interactively in a Jupyter environment to load image data, train/evaluate a CNN, and likely perform predictions. There is no separate CLI, API server, deployment artifact, or reusable Python package in the repository tree.

#### Dataset Boundary
Training data is external to the repository and must be obtained from Kaggle’s PlantVillage dataset link documented in `README.md`. Dataset acquisition, local extraction, directory layout, and class-to-label mapping are runtime prerequisites outside version control.

#### Model Pipeline
The central pipeline resides in `Tomato_leaf_classification.ipynb`:
1. Read tomato leaf images and labels from the downloaded PlantVillage dataset.
2. Transform images into CNN-ready tensors, including expected resizing/normalization and possible augmentation.
3. Train a convolutional neural network over the 10 target classes.
4. Evaluate classification performance and run inference on leaf images.

#### Primary Data Flow
Image files from the external Kaggle dataset flow into notebook preprocessing, then into the CNN training/evaluation loop. The resulting trained model, metrics, and predictions are expected to exist in the notebook session or notebook-generated local artifacts; no model artifact path is represented in the repository tree.

#### Runtime and Dependencies
The material runtime is Python in Jupyter Notebook, represented by `Tomato_leaf_classification.ipynb`. The implementation likely depends on a deep-learning framework and common image/data libraries, but no dependency manifest is present, so exact framework versions and reproducibility requirements must be inferred from notebook imports rather than repository metadata.

#### Architectural Constraints
`README.md` provides only the project goal and dataset source; it does not define operational setup, model serving, experiment tracking, validation standards, or artifact persistence. Any downstream automation should treat the notebook as the authoritative workflow and inspect it before assuming preprocessing, model architecture, or output conventions.

Main entry points: [`Tomato_leaf_classification.ipynb`](https://github.com/bhavyapriyan/tomato_leaf_classification/blob/master/Tomato_leaf_classification.ipynb) (Tensor Preprocessing), [`README.md`](https://github.com/bhavyapriyan/tomato_leaf_classification/blob/master/README.md) (Project README)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Notebook Runtime"]
  node_notebook["Tomato Leaf Notebook<br/>Jupyter notebook"]
  node_jupyter["Jupyter + Python<br/>interactive runtime"]
  node_session_outputs["Session Outputs<br/>runtime artifacts"]
end

subgraph group_pipeline["CNN Pipeline"]
  node_image_loading["Image Loading &amp; Labels<br/>data ingestion"]
  node_preprocessing["Tensor Preprocessing<br/>image transforms"]
  node_cnn{{"10-Class CNN<br/>deep learning model"}}
  node_training["Training Loop<br/>model training"]
  node_evaluation["Evaluation &amp; Inference<br/>model assessment"]
end

node_readme["Project README<br/>documentation<br/>[README.md]"]
node_kaggle_dataset[("PlantVillage Dataset<br/>external dataset")]

node_readme -.->|"documents source"| node_kaggle_dataset
node_jupyter -->|"executes"| node_notebook
node_notebook -->|"implements"| node_image_loading
node_kaggle_dataset -->|"local images after download"| node_image_loading
node_image_loading -->|"images and labels"| node_preprocessing
node_preprocessing -->|"CNN-ready tensors"| node_training
node_training -->|"fits"| node_cnn
node_cnn -->|"trained classifier"| node_evaluation
node_preprocessing -->|"inference tensors"| node_evaluation
node_evaluation -->|"metrics and predictions"| node_session_outputs
node_training -->|"model state"| node_session_outputs

click node_readme "https://github.com/bhavyapriyan/tomato_leaf_classification/blob/master/README.md"
click node_notebook "https://github.com/bhavyapriyan/tomato_leaf_classification/blob/master/Tomato_leaf_classification.ipynb"
click node_image_loading "https://github.com/bhavyapriyan/tomato_leaf_classification/blob/master/Tomato_leaf_classification.ipynb"
click node_preprocessing "https://github.com/bhavyapriyan/tomato_leaf_classification/blob/master/Tomato_leaf_classification.ipynb"
click node_cnn "https://github.com/bhavyapriyan/tomato_leaf_classification/blob/master/Tomato_leaf_classification.ipynb"
click node_training "https://github.com/bhavyapriyan/tomato_leaf_classification/blob/master/Tomato_leaf_classification.ipynb"
click node_evaluation "https://github.com/bhavyapriyan/tomato_leaf_classification/blob/master/Tomato_leaf_classification.ipynb"

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_notebook,node_jupyter,node_session_outputs toneBlue
class node_image_loading,node_preprocessing,node_cnn,node_training,node_evaluation toneAmber
class node_readme,node_kaggle_dataset toneNeutral
```

## Components

### Notebook Runtime

Interactive Python/Jupyter workflow.

- [Tomato Leaf Notebook](https://github.com/bhavyapriyan/tomato_leaf_classification/blob/master/Tomato_leaf_classification.ipynb): Jupyter notebook · Authoritative implementation entry point. · `Tomato_leaf_classification.ipynb`
- **Jupyter + Python**: interactive runtime
- **Session Outputs**: runtime artifacts · Trained model state, metrics, and predictions remain session-local unless saved.

### CNN Pipeline

Executed inside the notebook session.

- [Image Loading & Labels](https://github.com/bhavyapriyan/tomato_leaf_classification/blob/master/Tomato_leaf_classification.ipynb): data ingestion · Reads local extracted images and class labels. · `Tomato_leaf_classification.ipynb`
- [Tensor Preprocessing](https://github.com/bhavyapriyan/tomato_leaf_classification/blob/master/Tomato_leaf_classification.ipynb): image transforms · Resizes, normalizes, and may augment images. · `Tomato_leaf_classification.ipynb`
- [10-Class CNN](https://github.com/bhavyapriyan/tomato_leaf_classification/blob/master/Tomato_leaf_classification.ipynb): deep learning model · Convolutional classifier trained on tomato leaf categories. · `Tomato_leaf_classification.ipynb`
- [Training Loop](https://github.com/bhavyapriyan/tomato_leaf_classification/blob/master/Tomato_leaf_classification.ipynb): model training · Optimizes the CNN using preprocessed training data. · `Tomato_leaf_classification.ipynb`
- [Evaluation & Inference](https://github.com/bhavyapriyan/tomato_leaf_classification/blob/master/Tomato_leaf_classification.ipynb): model assessment · Measures classification performance and predicts leaf classes. · `Tomato_leaf_classification.ipynb`

### Other components

- [Project README](https://github.com/bhavyapriyan/tomato_leaf_classification/blob/master/README.md): documentation · States the project goal and Kaggle dataset source. · `README.md`
- **PlantVillage Dataset**: external dataset · External tomato leaf images organized across 10 classes.

## Connections

- Project README → PlantVillage Dataset: documents source
- Jupyter + Python → Tomato Leaf Notebook: executes
- Tomato Leaf Notebook → Image Loading & Labels: implements
- PlantVillage Dataset → Image Loading & Labels: local images after download
- Image Loading & Labels → Tensor Preprocessing: images and labels
- Tensor Preprocessing → Training Loop: CNN-ready tensors
- Training Loop → 10-Class CNN: fits
- 10-Class CNN → Evaluation & Inference: trained classifier
- Tensor Preprocessing → Evaluation & Inference: inference tensors
- Evaluation & Inference → Session Outputs: metrics and predictions
- Training Loop → Session Outputs: model state
