Logo Lanfrica
  • Home
  • Atlas
  • Insights
  • Docs
  • Sign in

Β© 2026 Lanfrica. All rights reserved. All copyrights of the resources shown on the Lanfrica website belong to the original copyright holders, unless explicitly stated otherwise.

Samia-Nawaz/ViT-with-Token-Level-Supervision-for-Wheat-Disease-Classification

Domain:

agriculture

Record type:

modelsoftware
Creator:
Sam
Host:
# 🌾 Vision Transformer for Wheat Leaf Disease Classification This repository implements a Vision Transformer (ViT) model for fine-grained classification of wheat leaf diseases using token-level supervision, as described in the research paper: > **Vision Transformer-Based Fine-Grained Classification of Wheat Leaf Diseases with Token-Level Supervision** --- ## 🧠 Key Features - Implements Vision Transformer with patch-based embeddings. - Incorporates **token-level supervision** combining class and patch token loss. - Preprocessing with data augmentation to increase generalization. - Custom training loop using TensorFlow and Keras. - Visualization of attention via **Grad-CAM** for model interpretability. - Benchmarking against other CNN architectures. --- ## πŸ“ Directory Structure ``` . β”œβ”€β”€ data_loader.py # Load and split dataset into train/val/test β”œβ”€β”€ preprocessing.py # Resize and augment images β”œβ”€β”€ patch_embedding.py # Patch embedding layer for ViT β”œβ”€β”€ vit_model.py # Vision Transformer architecture β”œβ”€β”€ token_supervision.py # Custom loss: class token + patch token β”œβ”€β”€ train.py # Custom training loop using token-level loss β”œβ”€β”€ evaluate.py # Evaluate model and generate Grad-CAM β”œβ”€β”€ README.md # Project documentation └── vit_token_supervised_model.h5 # (Generated after training) ``` --- ## πŸ“¦ Requirements Install the dependencies: ```bash pip install tensorflow pandas scikit-learn matplotlib seaborn ``` --- ## πŸ—‚οΈ Dataset Use the **Wheat Disease Images Small Dataset** from: πŸ“Ž Zenodo Dataset - doi.org Organize it in the following structure: ``` dataset/ β”œβ”€β”€ Yellow Rust/ β”œβ”€β”€ Brown Rust/ β”œβ”€β”€ Septoria/ β”œβ”€β”€ Mildew/ └── Healthy/ ``` Update the dataset path in `train.py` and `evaluate.py`: ```python dataset_path = "path_to_your_dataset" ``` --- ## πŸš€ Training Run the training script: ```bash python train.py ``` The model will be …

Visit

github.com

Tasks

computer visionimage classification

Languages

Saamya-Gwe