
PlantDoc: Plant Disease Classification
Project Impact
Project Gallery





PlantDoc: Plant Disease Classification
State-of-the-art plant disease classification using a CBAM-augmented ResNet18 architecture.
Project Overview
PlantDoc is an advanced computer vision system that accurately identifies plant diseases from images, providing a powerful tool for sustainable agriculture and food security. The project leverages state-of-the-art deep learning techniques to classify 38 different plant disease categories across various crop species with exceptional accuracy.
The model achieves 97.46% accuracy on the test set, with 99.21% precision and 99.17% recall, making it highly reliable for real-world applications in agricultural technology.
Key Features
- Integration of CBAM attention modules into ResNet18 architecture
- Advanced data augmentation and preprocessing with Albumentations
- Class balancing techniques for improved performance on imbalanced data
- Mixed precision training (FP16) and cosine annealing learning rate scheduling
- Comprehensive model evaluation dashboards with ROC, PR curves, and Grad-CAM visualizations
Technical Approach
Model Architecture
The core of PlantDoc is a sophisticated CBAM-augmented ResNet18 architecture:
- Base Model: Modified ResNet18 backbone pretrained on ImageNet
- Attention Module: Integrated Convolutional Block Attention Module (CBAM) that combines:
- Channel Attention: Focuses on "what" features are important
- Spatial Attention: Focuses on "where" important features are located
- Custom Head: Feature pyramid with global average pooling and multiple classification heads
This innovative architecture enables the model to focus on the most discriminative features for plant disease identification, significantly improving classification performance over standard CNN architectures.
Data Processing Pipeline
The project implements a comprehensive data handling system:
- Dataset: Curated collection of 87,000+ plant disease images across 38 categories
- Augmentation: Advanced techniques including:
- Random affine transformations (rotation, scaling, shear)
- Color jittering with brightness/contrast/saturation adjustments
- Random perspective transformations
- Normalization with ImageNet statistics
- Cross-Validation: Implemented 5-fold stratified cross-validation to ensure robust evaluation
Training Methodology
The training process was carefully designed to maximize model performance:
- Optimizer: AdamW with cosine annealing learning rate schedule
- Loss Function: Focal loss to address class imbalance challenges
- Regularization: Dropout (0.3), weight decay, and early stopping
- Hardware: Trained on NVIDIA RTX 3090 GPU with mixed precision
- Epochs: 50 epochs with early stopping based on validation loss plateau
Model Evaluation and Explainability
Comprehensive evaluation framework with multiple metrics:
- Classification Performance: 97.46% accuracy, 99.21% precision, 99.17% recall
- Confusion Matrix Analysis: Detailed per-class performance evaluation
- ROC and Precision-Recall Curves: Area under curve metrics for all classes
- GradCAM Visualizations: Heatmap generation to highlight regions influencing model decisions
- Confidence Distribution: Analysis of prediction confidence across disease categories
Agricultural Impact
PlantDoc represents a significant advancement for precision agriculture:
- Early Detection: Identifies diseases before visible symptoms become severe
- Accessibility: Deployed as a web application accessible via mobile devices
- Resource Optimization: Enables targeted treatment, reducing pesticide usage
- Knowledge Transfer: Educational tool for farmers to learn disease patterns
Deployment
The project has been deployed as a user-friendly web application:
- Frontend: Interactive interface with responsive design for both desktop and mobile
- API Backend: FastAPI service for real-time inference
- Model Optimization: Quantized for mobile deployment (8-bit precision)
- CI/CD Pipeline: Automated testing and deployment using GitHub Actions
Future Directions
Ongoing development focuses on several enhancements:
- Integration with drone imagery for large-scale field scanning
- Expansion to include nutritional deficiency identification
- Development of treatment recommendation system
- Implementation of on-device mobile inference for offline usage
Technologies Used
- Python: Core programming language
- PyTorch: Deep learning framework
- Albumentations: Data augmentation
- NumPy & Pandas: Data handling
- OpenCV: Image processing
- Hydra: Configuration management
- Weights & Biases: Experiment tracking
Future Enhancements
- Deployment as a mobile application for farmers
- Extension to more crop species and disease classes
- Implementation of self-supervised learning to reduce annotation requirements
- Development of a model distillation approach for edge device deployment
- Integration with drone imagery for field-scale disease monitoring