# sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection architecture

> Architecture diagram of the GitHub repository sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection
- Repository: https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection

## Overview

PaddyScan AI is a web-based rice-leaf disease diagnostic system: users submit front-only, paired front/back, or folder-based images and receive class predictions, confidence, and batch summaries. The frontend provides upload and result views; the Flask backend validates images, prepares inputs, and runs a checkpoint-backed Siamese EfficientNet model. The README documents CSV exports, disease advice, and batch charting. Backend implementation is only partially excerpted, so internal links not directly shown are omitted.

Main entry points: [`backend/app.py`](https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/backend/app.py) (Flask API), [`frontend/index.html`](https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/frontend/index.html) (Dashboard UI), [`frontend/js/script.js`](https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/frontend/js/script.js) (Batch analysis), [`backend/models/best_dual_efficientnet_b0.pth`](https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/backend/models/best_dual_efficientnet_b0.pth) (Model checkpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Diagnostic dashboard"]
  node_dashboard["Dashboard UI<br/>[index.html]"]
  node_front_upload["Front-view analysis<br/>[script.js]"]
  node_dual_upload["Dual-view analysis<br/>[script.js]"]
  node_batch_upload["Batch analysis<br/>[script.js]"]
end

subgraph group_backend["Inference service"]
  node_api["Flask API<br/>[app.py]"]
  node_batch_pairing["Pairing and modes<br/>[app.py]"]
  node_image_validation["Leaf validation<br/>[app.py]"]
  node_image_preparation["Image preparation<br/>[app.py]"]
  node_inference["Prediction inference<br/>[app.py]"]
end

subgraph group_model["Model runtime"]
  node_siamese["Siamese classifier<br/>[app.py]"]
  node_checkpoint["Model checkpoint"]
end

subgraph group_results["Diagnostic results"]
  node_predictions["Predictions and metrics<br/>[app.py]"]
  node_advice["Disease guidance<br/>[app.py]"]
  node_batch_results["Batch chart and table<br/>[script.js]"]
  node_csv["CSV export<br/>[script.js]"]
end

node_farmer(("User"))

node_farmer -->|"uses"| node_dashboard
node_dashboard -->|"opens"| node_front_upload
node_dashboard -->|"opens"| node_dual_upload
node_dashboard -->|"opens"| node_batch_upload
node_front_upload -->|"submits images"| node_api
node_dual_upload -->|"submits pair"| node_api
node_batch_upload -->|"submits files"| node_api
node_api -->|"dispatches batch"| node_batch_pairing
node_api -->|"validates views"| node_image_validation
node_api -->|"prepares images"| node_image_preparation
node_api -->|"runs prediction"| node_inference
node_inference -->|"calls model"| node_siamese
node_siamese -->|"loads weights"| node_checkpoint
node_inference -->|"returns classes"| node_predictions
node_predictions -->|"includes guidance"| node_advice
node_api -->|"returns batch summary"| node_batch_results
node_batch_upload -->|"renders results"| node_batch_results
node_predictions -->|"exports result"| node_csv
node_batch_results -->|"exports batch"| node_csv

click node_dashboard "https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/frontend/index.html"
click node_front_upload "https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/frontend/js/script.js"
click node_dual_upload "https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/frontend/js/script.js"
click node_batch_upload "https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/frontend/js/script.js"
click node_api "https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/backend/app.py"
click node_batch_pairing "https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/backend/app.py"
click node_image_validation "https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/backend/app.py"
click node_image_preparation "https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/backend/app.py"
click node_inference "https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/backend/app.py"
click node_siamese "https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/backend/app.py"
click node_checkpoint "https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/backend/models/best_dual_efficientnet_b0.pth"
click node_predictions "https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/backend/app.py"
click node_advice "https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/backend/app.py"
click node_batch_results "https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/frontend/js/script.js"
click node_csv "https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/frontend/js/script.js"

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_dashboard,node_front_upload,node_dual_upload,node_batch_upload,node_farmer toneBlue
class node_api,node_batch_pairing,node_image_validation,node_image_preparation,node_inference toneAmber
class node_siamese,node_checkpoint toneMint
class node_predictions,node_advice,node_batch_results,node_csv toneRose
```

## Components

### Diagnostic dashboard

- [Dashboard UI](https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/frontend/index.html): `frontend/index.html`
- [Front-view analysis](https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/frontend/js/script.js): `frontend/js/script.js`
- [Dual-view analysis](https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/frontend/js/script.js): `frontend/js/script.js`
- [Batch analysis](https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/frontend/js/script.js): `frontend/js/script.js`

### Inference service

- [Flask API](https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/backend/app.py): `backend/app.py`
- [Pairing and modes](https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/backend/app.py): `backend/app.py`
- [Leaf validation](https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/backend/app.py): `backend/app.py`
- [Image preparation](https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/backend/app.py): `backend/app.py`
- [Prediction inference](https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/backend/app.py): `backend/app.py`

### Model runtime

- [Siamese classifier](https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/backend/app.py): `backend/app.py`
- [Model checkpoint](https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/backend/models/best_dual_efficientnet_b0.pth): `backend/models/best_dual_efficientnet_b0.pth`

### Diagnostic results

- [Predictions and metrics](https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/backend/app.py): `backend/app.py`
- [Disease guidance](https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/backend/app.py): `backend/app.py`
- [Batch chart and table](https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/frontend/js/script.js): `frontend/js/script.js`
- [CSV export](https://github.com/sankalpapesitm/gan-enhanced-paddy-leaf-disease-detection/blob/main/frontend/js/script.js): `frontend/js/script.js`

### Other components

- **User**

## Connections

- User → Dashboard UI: uses (evidence: `README.md`)
- Dashboard UI → Front-view analysis: opens (evidence: `README.md`)
- Dashboard UI → Dual-view analysis: opens (evidence: `README.md`)
- Dashboard UI → Batch analysis: opens (evidence: `README.md`)
- Front-view analysis → Flask API: submits images (evidence: `README.md`)
- Dual-view analysis → Flask API: submits pair (evidence: `README.md`)
- Batch analysis → Flask API: submits files (evidence: `README.md`)
- Flask API → Pairing and modes: dispatches batch (evidence: `backend/app.py`)
- Flask API → Leaf validation: validates views (evidence: `backend/app.py`)
- Flask API → Image preparation: prepares images (evidence: `README.md`)
- Flask API → Prediction inference: runs prediction (evidence: `backend/app.py`)
- Prediction inference → Siamese classifier: calls model (evidence: `backend/app.py`)
- Siamese classifier → Model checkpoint: loads weights (evidence: `README.md`)
- Prediction inference → Predictions and metrics: returns classes (evidence: `backend/app.py`)
- Predictions and metrics → Disease guidance: includes guidance (evidence: `README.md`)
- Flask API → Batch chart and table: returns batch summary (evidence: `README.md`)
- Batch analysis → Batch chart and table: renders results (evidence: `frontend/js/script.js`)
- Predictions and metrics → CSV export: exports result (evidence: `README.md`)
- Batch chart and table → CSV export: exports batch (evidence: `README.md`)
