spytensor/plants_disease_detection
Ai Challenger 2018 Competitions 农作物病害检测
What it solves
This project provides a baseline implementation for detecting crop diseases from images, specifically designed for the AI Challenger 2018 competition. It automates the process of classifying plant images into various disease categories to help identify agricultural pests and pathologies.
How it works
The system uses a ResNet50 model pre-trained on ImageNet, with the global pooling layer replaced by an adaptive average pooling layer and a classification head tailored for 59 disease categories. The pipeline includes:
- Data Processing: A script (
move.py) organizes images into category folders and handles the removal of anomalous samples. - Training Pipeline: It employs the Adam optimizer with a StepLR scheduler and supports both CrossEntropyLoss and a corrected FocalLoss for handling class imbalance.
- Augmentation: It uses both online augmentation (rotations, flips, and affine transforms) and optional offline augmentation (Gaussian noise, brightness/contrast adjustments).
- Modernization: The code has been updated to PyTorch 2.x, adding support for Automatic Mixed Precision (AMP) to reduce memory usage and speed up training on GPUs.
Who it’s for
Agricultural AI researchers, students, and developers interested in image classification for plant pathology, or those looking for a baseline to build upon for crop disease detection competitions.
Highlights
- PyTorch 2.x Ready: Fully migrated to modern PyTorch with CPU/GPU auto-switching.
- AMP Support: Integrated Automatic Mixed Precision for faster training ands memory efficiency.
- Robust Augmentation: Combines online and offline image transformation techniques to improve model generalization.
- Stratified Sampling: Uses
StratifiedKFoldlogic for consistent and balanced data splitting between training and validation sets.
Related
- Project
- Project
- Project
- Project
- Project