Image Classification using Deep Learning (CNN)
Date
Jul 2, 2024
Category
Content

Rice Leaf Disease Prediction Using CNN
Problem Statement
Rice is a staple crop for a large portion of the global population. However, its productivity is frequently threatened by various leaf diseases such as Leaf Smut, Brown Spot, and Bacterial Leaf Blight. These diseases can lead to significant yield loss if not identified and treated early. Traditional disease detection methods rely heavily on expert inspection and laboratory analysis, which can be time-consuming, costly, and inaccessible to many small-scale farmers.
Project Objective
The objective of this project was to develop an automated deep learning system that accurately classifies rice leaf diseases from image data. The goal was to reduce diagnosis time, support agricultural decision-making, and help farmers take timely preventive measures.
To achieve this, a Convolutional Neural Network (CNN) was trained using a custom rice leaf image dataset. The trained model was then deployed as a web application on AWS EC2, allowing users to upload rice leaf images and get disease predictions in real time.
Dataset Overview
Dataset Type: Custom image dataset
Classes:
Leaf Smut
Brown Spot
Bacterial Leaf Blight
Preprocessing:
Resizing all images to a uniform shape
Augmentation (flipping, rotation, zoom) to improve generalization
Normalization to scale pixel values
Technical Workflow
1. Data Preparation
Manually captured and labeled images
Structured the dataset into training, validation, and test sets
Applied data augmentation to increase dataset diversity
2. Model Building
Designed a custom CNN architecture with multiple convolutional and pooling layers
Included dropout layers to avoid overfitting
Used ReLU activation and Softmax in the output layer
Compiled the model using categorical cross-entropy loss and Adam optimizer
3. Model Training
Trained for multiple epochs with batch processing
Monitored accuracy and loss on both training and validation sets
Achieved high accuracy (>90%) in classifying disease types
4. Model Evaluation
Evaluated on a hold-out test set
Plotted confusion matrix and classification report
Verified robustness of predictions with unseen leaf images
Model Deployment
Framework: Flask for building the web application
Deployment Platform: AWS EC2 instance (Ubuntu)
Functionality:
Simple UI for image upload
Backend uses the trained CNN model to make predictions
Displays predicted disease class and confidence score
Results and Performance
Classification Accuracy: Over 90%
Low false positive rate, particularly between Leaf Smut and Brown Spot
Fast inference time: less than 2 seconds per image
Validated on real-world samples to ensure model generalization
Key Achievements
Developed an end-to-end image classification pipeline using deep learning
Created a working diagnostic tool for rice disease identification
Gained practical experience in:
Image preprocessing
CNN model design and tuning
Flask app development
Cloud deployment with AWS EC2
Impact and Applications
Assists farmers and agronomists in early disease detection
Reduces dependency on expert visits or lab tests
Enhances precision agriculture practices through digital diagnostics
Can be extended to other crops and diseases with retraining
Technologies Used
Python: NumPy, Pandas, OpenCV, Matplotlib
Deep Learning: TensorFlow/Keras for CNN modeling
Web App: Flask
Cloud: AWS EC2 (Ubuntu)
Data Handling: ImageDataGenerator, manual annotations
Others: Gunicorn, Nginx for production deployment


