This repository implements a complete pipeline for plant disease classification and model interpretability.
We address the domain discrepancy between laboratory images (PlantVillage) and real-world field images (PlantDoc) by proposing a class-dependent leaf segmentation pipeline.
We train EfficientNet-B1 models on the processed datasets and utilize XAI (Explainable AI) methods—Grad-CAM, Score-CAM, and Layer-CAM—to visually verify whether the model focuses on the correct disease lesions.
- Domain Gap Reduction: Segmentation-based preprocessing to isolate leaves from complex backgrounds.
- Efficient Classification: Fine-tuned EfficientNet-B1 for robust performance on small datasets.
- Explainability (XAI): Attention visualization (Grad-CAM / Score-CAM / Layer-CAM) to improve reliability.
├── demo.ipynb # Demo notebook for running XAI (Grad-CAM, etc.)
├── preprocessing/
│ └── segmentation_final.ipynb # Preprocessing & segmentation pipeline
├── checkpoints/
│ ├── doc_model_best.pt # Trained model for PlantDoc
│ └── village_model_best.pt # Trained model for PlantVillage
├── samples/ # Test images for demo
│ ├── Potato_Early_blight.JPG
│ └── Tomato_leaf_late_blight.jpg
├── results/ # Saved XAI results
│ ├── PlantDoc-Result/
│ └── PlantVillage-Result/
├── requirements.txt # Python dependencies
└── README.mdgit clone https://github.com/Janice0381/Fall2025-Computer-Vision.git
cd Fall2025-Computer-Visionpip install -r requirements.txt-
Check model & data
Ensure the .pt model files are located in the checkpoints/ directory.
-
Run the notebook
jupyter notebook demo.ipynb
-
View results After running the notebook, the original image and its corresponding heatmaps (Grad-CAM, Score-CAM, Layer-CAM) will be saved in the results/ directory.
Minji Kim
Gayoung Kim
Seun Kim