Early Blight
Potato leaves affected by Early Blight.
Potato___Early_blight
An end-to-end computer vision project that uses a Convolutional Neural Network to classify potato leaf images into Early Blight, Late Blight and Healthy categories, followed by TensorFlow Lite conversion and Android deployment.
PROJECT OVERVIEW
This project explores the use of Computer Vision and Deep Learning for classifying potato leaf images according to their health condition.
A CNN-based model was developed using TensorFlow and Keras. The dataset contained 2,152 images distributed across three categories: Early Blight, Late Blight and Healthy.
After training and evaluation, the model was exported into deployable formats and the TensorFlow Lite model was integrated into an Android application.
The Android implementation was developed in Android Studio using Java and Gradle. A ready-made template from a YouTube tutorial was used only as the initial project/UI foundation and was then substantially modified for the requirements of this project.
The project combines deep learning, model conversion, mobile inference, application development and APK analysis.
CLASSIFICATION TARGET
Potato leaves affected by Early Blight.
Potato___Early_blight
Potato leaves affected by Late Blight.
Potato___Late_blight
Potato leaves without the targeted diseases.
Potato___healthy
TECHNICAL PIPELINE
The dataset was loaded using
image_dataset_from_directory()
.
Images were read from class-specific
directories and automatically associated
with their corresponding labels.
The dataset was shuffled and partitioned using an 80/10/10 split for training, validation and testing.
Images were resized to 256 ร 256 pixels and pixel values were rescaled using 1/255 so that the input values were normalized before entering the network.
Resizing(256, 256)
Rescaling(1.0 / 255)
Data augmentation was introduced inside the model pipeline using random horizontal and vertical flips along with random rotation. This helps expose the model to variations in image orientation during training.
The model uses a sequential CNN architecture consisting of multiple convolution and max-pooling blocks followed by fully connected layers.
The model was compiled using the Adam optimizer and Sparse Categorical Crossentropy loss. Training was performed for 40 epochs with a batch size of 32.
After training, the model was evaluated on the held-out test dataset. The final evaluation produced a test loss of approximately 0.0792 and an accuracy of approximately 96.48%.
The trained model was saved in multiple formats for experimentation, storage and deployment.
AModel/1.keras
Keras model
AModel/1.h5
HDF5 model
AModel/1/
TensorFlow SavedModel artifacts
AModel/1/model.tflite
Android deployment model
The generated TensorFlow Lite model was integrated into an Android Studio project. Java and Gradle were used to implement and manage the application functionality.
The application was tested using the Google Pixel 5a emulator inside Android Studio. After generating the APK, the application package was also analyzed using JADX for educational and inspection purposes.
MODEL DETAILS
PREDICTION OUTPUTS
The trained model was used to classify potato leaf images into Early Blight, Late Blight and Healthy categories.
Model prediction result for the first test image and it's predicted as Early Blight.
Model prediction result for the second test image and it's predicted as Late Blight.
Model prediction result for the third test image and it's predicted as Healthy.
MOBILE DEPLOYMENT
The trained TensorFlow Lite model located at
AModel/1/model.tflite
was used as the inference model inside the
Android application.
A ready-made Android template obtained from a YouTube tutorial was used as the starting project and UI foundation. The template itself was not treated as the finished application.
The project was modified and adapted to implement the requirements of the potato disease classification application, including model integration, permissions, image handling, prediction logic and displaying the result.
Java was used for the application-side logic, while Gradle was used for dependency and build management.
The complete application flow was tested inside Android Studio using the Google Pixel 5a emulator.
Required Android permissions were handled for the application's image/input-related functionality.
Images are accepted as input for the classification process.
The TensorFlow Lite model is loaded and used to perform local model inference.
Model output is processed to determine and display the corresponding prediction.
The application presents the resulting classification to the user.
The application was tested using the Google Pixel 5a Android emulator.
PROJECT ARTIFACTS
Debug APK generated from the Android application after integrating the TensorFlow Lite model.
Download APK โJADX-generated APK analysis/decompiled project artifact provided for educational inspection of the generated application.
Download JADX โAPPLICATION TESTING
The Android application was tested directly inside Android Studio using the Google Pixel 5a emulator. Testing covered the application flow, permissions, image input, TensorFlow Lite inference, prediction processing and result presentation.
TECHNOLOGY STACK
LEARNING OUTCOMES
Image preprocessing and CNN-based classification.
Training, validation, evaluation and model serialization.
Converting a trained model into TensorFlow Lite for mobile inference.
Integrating deep learning inference into an Android application.
EXPLORE THE IMPLEMENTATION
Explore the notebook, dataset, model artifacts, TensorFlow Lite model, Android application, APK and JADX analysis.