Skip to content

Chakib-L/CassavaLeafClassification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Cassava Leaf Disease Classification

🧾 Context

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:

  1. Cassava Bacterial Blight (CBB)
  2. Cassava Brown Streak Disease (CBSD)
  3. Cassava Green Mottle (CGM)
  4. Cassava Mosaic Disease (CMD)
  5. Healthy

This is a multiclass image classification problem, typical in deep learning.


🧠 Technologies and Tools Used

  • 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.

πŸ—οΈ Network Architectures

πŸ”· 1. Custom ResNet

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
  • MaxPool for spatial reduction
  • Fully connected layer with Dropout at the end

Several versions were tested, reaching up to 80% accuracy on the test set.


πŸ”· 2. Custom MobileNet

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.


πŸ“ˆ Results

  • 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 and Evaluation

  • 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.

πŸ“‚ Data Structure

Images are stored in the folder train_images/, and labels are provided in train.csv, mapping image_id to label.


πŸ”š Conclusion

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.

About

πŸ₯₯ Cassava Leaf Disease Classification – Deep learning project for classifying cassava plant leaf diseases using custom ResNet and MobileNet architectures built with PyTorch. Includes data augmentation, dropout, and learning rate scheduling. Achieved up to 80% accuracy on the validation set. Based on the Kaggle competition.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages