# syedmuhammadubaidurrehman22/crop_disease_identification architecture

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

- Interactive diagram: https://gitdiagram.com/syedmuhammadubaidurrehman22/crop_disease_identification
- Repository: https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification

## Overview

This repository is a research workflow for multi-dataset crop-disease classification with transfer-learning CNNs. The principal path is to prepare image datasets, train a selected model, evaluate its checkpoint, and inspect performance reports or sample predictions. Dataset cleaning, merging, and splitting are separate scripts; the excerpts do not show them orchestrated together. Evaluation and analysis edges reflect shown calls or file reads, while README-level capabilities are retained without assuming unsampled implementation details.

Main entry points: [`models/evaluate.py`](https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/models/evaluate.py) (Checkpoint evaluation), [`models/train.py`](https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/models/train.py) (Model training), [`models/generate_sample_predictions.py`](https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/models/generate_sample_predictions.py) (Sample predictions), [`data_scripts/preprocessing.py`](https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/data_scripts/preprocessing.py) (Image preprocessing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Dataset preparation"]
  node_clean["Image cleaning<br/>[cleaning.py]"]
  node_merge["Dataset merging<br/>[merge_datasets.py]"]
  node_split["Dataset splitting<br/>[split_datasets.py]"]
  node_prep["Image preprocessing<br/>[preprocessing.py]"]
  node_datasets["Plant disease datasets"]
end

subgraph group_learning["Model learning"]
  node_train["Model training<br/>[train.py]"]
  node_factory["CNN model factory<br/>[model_factory.py]"]
  node_checkpoint["Model checkpoint"]
end

subgraph group_assessment["Evaluation"]
  node_evaluate["Checkpoint evaluation<br/>[evaluate.py]"]
  node_metrics["Metrics and plots<br/>[metrics.py]"]
  node_predictions["Sample predictions"]
  node_reports["Evaluation outputs"]
end

subgraph group_insights["Result analysis"]
  node_classanalysis["Class report analysis"]
  node_results["Result collection<br/>[collect_results.py]"]
  node_comparison["Model comparison plot"]
  node_summary["Comparison outputs"]
end

node_researcher(("Researcher"))

node_researcher -->|"runs cleaning"| node_clean
node_researcher -->|"runs merge"| node_merge
node_researcher -->|"runs split"| node_split
node_researcher -->|"starts training"| node_train
node_researcher -->|"starts evaluation"| node_evaluate
node_researcher -->|"generates samples"| node_predictions
node_datasets -->|"supplies images"| node_clean
node_datasets -->|"supplies sources"| node_merge
node_datasets -->|"supplies classes"| node_split
node_datasets -->|"provides splits"| node_prep
node_train -->|"loads datasets"| node_prep
node_train -->|"creates model"| node_factory
node_train -->|"plots history"| node_metrics
node_train -->|"saves checkpoint"| node_checkpoint
node_evaluate -->|"loads datasets"| node_prep
node_evaluate -->|"creates model"| node_factory
node_evaluate -->|"loads checkpoint"| node_checkpoint
node_evaluate -->|"requests metrics"| node_metrics
node_evaluate -->|"writes evaluation"| node_reports
node_predictions -->|"creates model"| node_factory
node_predictions -->|"loads checkpoint"| node_checkpoint
node_reports -->|"reads reports"| node_classanalysis
node_reports -.->|"collects results"| node_results
node_summary -->|"provides comparison CSV"| node_comparison

click node_clean "https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/data_scripts/cleaning.py"
click node_merge "https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/data_scripts/merge_datasets.py"
click node_split "https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/data_scripts/split_datasets.py"
click node_prep "https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/data_scripts/preprocessing.py"
click node_train "https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/models/train.py"
click node_factory "https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/models/model_factory.py"
click node_evaluate "https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/models/evaluate.py"
click node_metrics "https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/models/metrics.py"
click node_predictions "https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/models/generate_sample_predictions.py"
click node_classanalysis "https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/models/analyze_class_reports.py"
click node_results "https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/models/collect_results.py"
click node_comparison "https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/models/generate_model_comparison_plot.py"
click node_summary "https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/tree/main/outputs"

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_clean,node_merge,node_split,node_prep,node_datasets toneBlue
class node_train,node_factory,node_checkpoint toneAmber
class node_evaluate,node_metrics,node_predictions,node_reports toneMint
class node_classanalysis,node_results,node_comparison,node_summary toneRose
class node_researcher toneIndigo
```

## Components

### Dataset preparation

- [Image cleaning](https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/data_scripts/cleaning.py): `data_scripts/cleaning.py`
- [Dataset merging](https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/data_scripts/merge_datasets.py): `data_scripts/merge_datasets.py`
- [Dataset splitting](https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/data_scripts/split_datasets.py): `data_scripts/split_datasets.py`
- [Image preprocessing](https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/data_scripts/preprocessing.py): `data_scripts/preprocessing.py`
- **Plant disease datasets**

### Model learning

- [Model training](https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/models/train.py): `models/train.py`
- [CNN model factory](https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/models/model_factory.py): `models/model_factory.py`
- **Model checkpoint**

### Evaluation

- [Checkpoint evaluation](https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/models/evaluate.py): `models/evaluate.py`
- [Metrics and plots](https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/models/metrics.py): `models/metrics.py`
- [Sample predictions](https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/models/generate_sample_predictions.py): `models/generate_sample_predictions.py`
- **Evaluation outputs**

### Result analysis

- [Class report analysis](https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/models/analyze_class_reports.py): `models/analyze_class_reports.py`
- [Result collection](https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/models/collect_results.py): `models/collect_results.py`
- [Model comparison plot](https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/blob/main/models/generate_model_comparison_plot.py): `models/generate_model_comparison_plot.py`
- [Comparison outputs](https://github.com/syedmuhammadubaidurrehman22/crop_disease_identification/tree/main/outputs): `outputs`

### Other components

- **Researcher**

## Connections

- Researcher → Image cleaning: runs cleaning (evidence: `data_scripts/cleaning.py`)
- Researcher → Dataset merging: runs merge (evidence: `data_scripts/merge_datasets.py`)
- Researcher → Dataset splitting: runs split (evidence: `data_scripts/split_datasets.py`)
- Researcher → Model training: starts training (evidence: `models/train.py`)
- Researcher → Checkpoint evaluation: starts evaluation (evidence: `models/evaluate.py`)
- Researcher → Sample predictions: generates samples (evidence: `models/generate_sample_predictions.py`)
- Plant disease datasets → Image cleaning: supplies images (evidence: `data_scripts/cleaning.py`)
- Plant disease datasets → Dataset merging: supplies sources (evidence: `data_scripts/merge_datasets.py`)
- Plant disease datasets → Dataset splitting: supplies classes (evidence: `data_scripts/split_datasets.py`)
- Plant disease datasets → Image preprocessing: provides splits (evidence: `data_scripts/preprocessing.py`)
- Model training → Image preprocessing: loads datasets (evidence: `models/train.py`)
- Model training → CNN model factory: creates model (evidence: `models/train.py`)
- Model training → Metrics and plots: plots history (evidence: `models/train.py`)
- Model training → Model checkpoint: saves checkpoint (evidence: `models/train.py`)
- Checkpoint evaluation → Image preprocessing: loads datasets (evidence: `models/evaluate.py`)
- Checkpoint evaluation → CNN model factory: creates model (evidence: `models/evaluate.py`)
- Checkpoint evaluation → Model checkpoint: loads checkpoint (evidence: `models/evaluate.py`)
- Checkpoint evaluation → Metrics and plots: requests metrics (evidence: `models/evaluate.py`)
- Checkpoint evaluation → Evaluation outputs: writes evaluation (evidence: `models/evaluate.py`)
- Sample predictions → CNN model factory: creates model (evidence: `models/generate_sample_predictions.py`)
- Sample predictions → Model checkpoint: loads checkpoint (evidence: `models/generate_sample_predictions.py`)
- Evaluation outputs → Class report analysis: reads reports (evidence: `models/analyze_class_reports.py`)
- Evaluation outputs → Result collection: collects results
- Comparison outputs → Model comparison plot: provides comparison CSV (evidence: `models/generate_model_comparison_plot.py`)
