welcomehola!Haii 🖐️AI engineeringdigital solutions
Profile
Rezkydesyafa
Back to projects

DokterPadi AI: Rice Disease Detection Using CNN

An AI-powered smart farming web application that detects rice leaf diseases from images using a Convolutional Neural Network and provides prediction confidence, disease information, and early treatment recommendations directly in the browser.

Overview

DokterPadi AI is an AI-powered smart farming web application designed to support the early detection of rice plant diseases through leaf images.

The system uses a Convolutional Neural Network (CNN) developed with TensorFlow and Keras to classify rice leaf images into 10 different disease and plant condition categories.

The trained model achieved a testing accuracy of 90.27% and was integrated into a web application using TensorFlow.js, allowing machine learning inference to run directly inside the user's browser.

Problem

Rice diseases can significantly affect crop productivity when symptoms are detected too late.

Identifying diseases manually can also be difficult because several rice diseases may present similar visual symptoms.

DokterPadi AI explores the use of Computer Vision and Deep Learning as an accessible early-detection tool that allows users to analyze rice leaf conditions from photographs.

Dataset

The project uses the Paddy Disease Classification dataset containing 10,407 rice leaf images across 10 different classes.

The dataset is divided using stratified splitting into:

  • 70% training data
  • 15% validation data
  • 15% testing data

All images are resized to 150 × 150 pixels before being processed by the model.

The classification classes include:

  • Bacterial Leaf Blight
  • Bacterial Leaf Streak
  • Bacterial Panicle Blight
  • Blast
  • Brown Spot
  • Dead Heart
  • Downy Mildew
  • Hispa
  • Normal
  • Tungro

CNN Architecture

The classification model uses a Sequential Convolutional Neural Network architecture.

The architecture consists of five convolutional blocks with filters increasing from:

  • 32
  • 64
  • 128
  • 256
  • 512

Each block combines:

  • Conv2D
  • Batch Normalization
  • Max Pooling
  • Dropout

The extracted features are processed using Global Average Pooling followed by a Dense layer before the final Softmax classification layer.

Model Training

The model was trained using:

  • Optimizer: Adam
  • Learning Rate: 1e-3
  • Loss Function: Categorical Crossentropy
  • Batch Size: 32
  • Maximum Epochs: 50

Several training callbacks were also implemented:

  • EarlyStopping to prevent unnecessary training when validation performance stops improving.
  • ReduceLROnPlateau to automatically reduce the learning rate when validation loss stagnates.
  • ModelCheckpoint to preserve the best-performing model.

Model Performance

The trained CNN achieved:

  • Training Accuracy: 94.62%
  • Testing Accuracy: 90.27%
  • Number of Classes: 10
  • Image Input Size: 150 × 150 pixels

The model was also validated through inference tests to verify that exported model formats could correctly generate predictions.

Web Application

The trained machine learning model was integrated into an interactive web application called DokterPadi AI.

Users can upload an image of a rice leaf and receive:

  • Predicted disease classification
  • Prediction confidence score
  • Top three prediction probabilities
  • Image quality validation before inference
  • Disease symptoms and information
  • Initial treatment recommendations
  • Prevention information
  • Rice disease encyclopedia

The interface was developed to make machine learning predictions easier to understand for non-technical users.

Browser-Based AI Inference

TensorFlow.js is used to run the trained model directly inside the browser.

Before inference, images are resized to 150 × 150 pixels, converted to RGB format, and normalized to a 0-1 value range.

The application also performs basic image quality checks such as:

  • Brightness
  • Contrast
  • Sharpness
  • Leaf visibility

This helps prevent unsuitable images from being immediately processed by the model.

Multi-Platform Model Export

The trained CNN model was exported into multiple formats:

  • TensorFlow SavedModel for server-side deployment
  • TensorFlow Lite for mobile and embedded applications
  • TensorFlow.js for browser-based inference

This approach makes the trained model reusable across different application environments.

Tech Stack

Python, TensorFlow, Keras, TensorFlow.js, TensorFlow Lite, React, Vite, NumPy, Pandas, Matplotlib, Scikit-learn, Pillow, and KaggleHub.