This project was developed as part of the Kaggle competition "Cassava Leaf Disease Classification" (competition link).
The goal is to automatically classify cassava leaf images into 5 categories:
- Cassava Bacterial Blight (CBB)
- Cassava Brown Streak Disease (CBSD)
- Cassava Green Mottle (CGM)
- Cassava Mosaic Disease (CMD)
- Healthy
This is a multiclass image classification problem, typical in deep learning.
- Framework: PyTorch (training, models, dataloaders)
- Preprocessing:
- Resizing to 512Γ512
- Data Augmentation:
ColorJitter,RandomHorizontalFlip,RandomRotation,RandomPerspective,GaussianBlur
- Optimization:
Adam+weight decay- Scheduler:
ReduceLROnPlateau
- Loss Function:
CrossEntropyLoss - Dataset Split:
- 70% training
- 10% validation
- 20% test
- Hardware: Training was performed on NVIDIA DGX servers provided by Automatants.
The ResNet (Residual Network) model is based on the principle of skip connections (residual connections), which helps to prevent vanishing gradients in deep networks.
Each block is structured as follows:
- 3Γ3 convolutions
- Batch normalization (
BatchNorm) - A projected branch (
projX) for residual connections with dimension changes - ReLU activation
MaxPoolfor spatial reduction- Fully connected layer with Dropout at the end
Several versions were tested, reaching up to 80% accuracy on the test set.
A MobileNet-like architecture was also implemented, designed for resource-constrained devices.
This model is based on:
- Depthwise separable convolutions: separating spatial convolution (depthwise) and pointwise convolution (1Γ1).
- Significant reduction in the number of parameters.
- Lightweight residual connections.
- Dropout in the linear part to limit overfitting.
The performance obtained with MobileNet is comparable to that of custom ResNets, with better memory efficiency and training speed.
- Accuracy with the final MobileNet: ~77.4%
- Accuracy with the best ResNet: ~80%
- Significant reduction of overfitting after:
- Adding BatchNorm
- Adding Dropout
- Data augmentation
- Training for 20 epochs.
- Automatic saving of the best model based on validation loss.
- Final evaluation on a separate test set, with global accuracy reported.
Images are stored in the folder train_images/, and labels are provided in train.csv, mapping image_id to label.
This project demonstrates how to design and compare different CNN architectures (ResNet, MobileNet) on a real-world agricultural problem, using PyTorch and best practices in deep learning to improve model robustness and generalization.