How spytensor/plants_disease_detection works
This repository is a PyTorch baseline for classifying crop-disease images. The workflow is: organize annotated images into class folders, load and augment training samples, split them into training and validation sets, train and evaluate a ResNet50 classifier, save the best checkpoint, then predict test images and write a submission JSON. Optional offline augmentation is separate from the main training path. The README documents CPU/GPU execution, AMP, and selectable focal loss; the graph follows the sampled runtime code and documented capabilities.
Main entry points: main.py Train and test · move.py Class organizer · train Class folders · dataloader.py Dataset loader
Components 15
Data preparation
- Raw images
data/temp/images - Train annotations
data/temp/labels - Class organizer
move.py - Class folders
data/train - Test images
data/test - Offline augmentation
data_aug.py
Model training
- Dataset loader
dataset/dataloader.py - Runtime configuration
config.py - Train and test
main.py - ResNet50 classifier
models/model.py - Loss and metrics
utils.py
Evaluation and prediction
- Prediction JSON
Runtime state
- Model checkpoints
- Training logs
Other components
- Dataset operator
Connections 17
- Dataset operator → Class organizer: runs preparation
- Train annotations → Class organizer: provides labels
- Raw images → Class organizer: provides images
- Class organizer → Class folders: copies by class
- Dataset operator → Offline augmentation: runs optionally
- Class folders → Offline augmentation: reads images
- Offline augmentation → Class folders: writes variants
- Dataset operator → Train and test: starts training
- Train and test → Runtime configuration: reads settings
- Train and test → Dataset loader: loads samples
- Dataset loader → Class folders: reads images
- Dataset loader → Test images: reads images
- Train and test → ResNet50 classifier: creates and runs
- Train and test → Loss and metrics: uses loss and metrics
- Train and test → Model checkpoints: saves and reloads
- Train and test → Training logs: writes training log
- Train and test → Prediction JSON: writes predictions