01 // Overview
A unified computer-vision research pipeline designed for PlantVillage leaf disease analysis, integrating three connected tasks: leaf segmentation, leaf-level detection, and background-robust disease classification. Instead of treating the tasks as isolated experiments, segmentation-derived structural information is reused downstream to guide both detection and classification.
02 // Segmentation
PlantVillage color images were paired with dataset-provided segmented images and passed through a quality-controlled preprocessing pipeline. After leakage-free data splitting and mask validation, three segmentation models were trained and evaluated under the same protocol:
U-Net + ResNet34 (Best)
Test Dice: 0.9913 · Test IoU: 0.9828
DeepLabV3+ + ResNet34
Dilated residual baseline
FPN + ResNet34
Feature pyramid benchmark
Structural Supervision Reuse: The resulting leaf masks were not treated only as final outputs; they were reused as structural supervision for downstream detection and classification.
03 // Leaf-Level Detection
Because PlantVillage does not provide native leaf-level detection annotations, validated segmentation masks were converted into tight whole-leaf bounding boxes. A transfer-learning pipeline was then used to train object detectors:
COCO Pretrained
→
PlantDoc Pretraining
→
PlantVillage Fine-Tuning
Models evaluated: YOLOv8n, YOLOv8s, and YOLO11n.
YOLOv8s (Best)
0.9947
0.9957
0.9952
0.9942
0.9830
YOLO11n
0.9912
0.9928
0.9920
0.9915
0.9784
YOLOv8n
0.9895
0.9910
0.9902
0.9892
0.9741
Task Clarification: This detection setup performs whole-leaf disease-class localization rather than lesion-level localization.
04 // Robust Classification (MG-CCD)
A standard RGB classifier achieved extremely strong in-domain results but showed a substantial drop under counterfactual background changes. To reduce background dependence, a robustness-oriented approach named Mask-Guided Counterfactual Consistency Distillation (MG-CCD) was developed.
The method combines:
- RGB student learning: Learns directly on real-world raw foliage RGB distributions.
- Leaf-only teacher guidance: Provides ground-truth feature representations completely disentangled from background noise.
- U-Net-derived masks: Enforces pixel-accurate isolation of leaf tissue from synthetic or laboratory backgrounds.
- Counterfactual background generation: Intervenes systematically on backgrounds to penalize spurious shortcut features.
- Knowledge distillation: Distills canonical leaf representations from the teacher into the student.
- Consistency loss: Penalizes discrepancies between original and counterfactual view predictions.
STANDARD RGB CLASSIFIER
0.9976
Original Macro-F1
0.8684
Counterfactual Macro-F1 (-12.92%)
PROPOSED MG-CCD (OUR APPROACH)
0.9969
Original Macro-F1
0.9959
Counterfactual Macro-F1 (+12.75%)
Empirical Finding: Demonstrates that the proposed method preserves near-baseline original-view performance while substantially improving robustness under background intervention.
05 // Technical Contributions
- Unified Multi-Task Pipeline: Unified segmentation, detection, and classification into one connected PlantVillage workflow across 38 disease categories.
- Structural Supervision Reuse: Reused segmentation outputs as downstream structural supervision rather than discarding them after training.
- Derived Detection Ground Truth: Built leaf-level detection labels from mask-derived tight bounding boxes for standardized object detection benchmarking.
- Counterfactual Distillation Formulation: Proposed MG-CCD for robustness against background bias and spurious correlation vulnerability.
- Rigorous Multi-Metric Benchmarking: Evaluated performance across three task families using dedicated metrics (Dice, IoU, mAP50, mAP50-95, and CF Macro-F1).
06 // Tools & Research Stack
Python
PyTorch
Torchvision
OpenCV
NumPy
Pandas
Matplotlib
Scikit-learn
U-Net
DeepLabV3+
FPN
EfficientNet-B0
YOLOv8
YOLO11
Knowledge Distillation
Counterfactual Learning
Computer Vision
Google Colab
LaTeX