A Deep Learning-based Potato Disease Classification project that classifies potato leaf images into Early Blight, Late Blight, and Healthy categories.
The project covers the complete workflow from dataset preparation and CNN model development to model conversion, Android deployment, emulator testing, APK generation, and APK analysis.
The trained model was converted into TensorFlow Lite (.tflite) format and integrated into an Android application using Android Studio, Java, and Gradle. The resulting APK was also analyzed using JADX for educational purposes.
Potato plants can be affected by diseases such as Early Blight and Late Blight, which can negatively impact crop health and yield. This project explores the use of Computer Vision and Deep Learning to automatically identify the condition of potato leaves from images.
The project follows an end-to-end workflow:
Potato Leaf Dataset
β
Data Preparation
β
CNN Model Development
β
Model Training
β
Model Evaluation
β
Model Export / Conversion
β
TensorFlow Lite Model
β
Android Integration
β
Android Testing
β
APK Generation
β
JADX APK Analysis
The project therefore combines Deep Learning, Model Deployment, Android Development, and APK Analysis into a single workflow.
The primary objectives of this project are:
- Build an image classification model for potato leaf diseases.
- Classify potato leaves into three categories.
- Train and evaluate a CNN-based deep learning model.
- Save the trained model in deployable formats.
- Convert the model into TensorFlow Lite format.
- Integrate the
.tflitemodel into an Android application. - Implement image-based prediction functionality on Android.
- Handle required Android permissions.
- Display the prediction results to the user.
- Test the complete application using an Android emulator.
- Generate an Android APK.
- Analyze the generated APK using JADX.
The dataset used in the project contains three potato leaf categories:
| Class | Description |
|---|---|
Potato___Early_blight |
Potato leaves affected by Early Blight |
Potato___Late_blight |
Potato leaves affected by Late Blight |
Potato___healthy |
Healthy potato leaves |
The corresponding images are organized inside the Potato Plant Disease directory.
Potato_Disease_Classification/
β
βββ AModel/
β β
β βββ 1/
β β βββ variables/
β β βββ fingerprint.pb
β β βββ keras_metadata.pb
β β βββ model.tflite
β β βββ saved_model.pb
β β
β βββ 1.h5
β βββ 1.keras
β
βββ Potato Disease Jupyter/
β βββ .ipynb_checkpoints/
β βββ Potato Disease Classification.ipynb
β
βββ Potato Plant Disease/
β βββ Potato___Early_blight/
β βββ Potato___Late_blight/
β βββ Potato___healthy/
β
βββ app-debug.apk
β
βββ app-debug.apk.jadx
This directory contains the potato leaf image dataset organized according to the classification labels.
Potato Plant Disease/
β
βββ Potato___Early_blight/
βββ Potato___Late_blight/
βββ Potato___healthy/
Each directory contains images belonging to its respective class.
This organization allows the images to be associated with their corresponding labels during the model development process.
This directory contains the Jupyter Notebook used for the deep learning portion of the project:
Potato Disease Classification.ipynb
The notebook contains the model-development workflow, including the preparation of the image dataset, deep learning model development, training, evaluation, and model conversion/export activities.
The classification model was developed using a Convolutional Neural Network (CNN).
CNNs are well suited for image classification because they can learn spatial patterns and visual features directly from images.
The model-development workflow includes:
Images
β
Preprocessing
β
CNN
β
Feature Extraction
β
Classification
β
Predicted Class
The model learns visual characteristics from potato leaf images and uses them to distinguish between:
- Early Blight
- Late Blight
- Healthy
- Python
- TensorFlow
- Keras
- Jupyter Notebook
- CNN
The AModel directory contains the generated model files and TensorFlow artifacts.
AModel/
β
βββ 1.keras
βββ 1.h5
β
βββ 1/
βββ variables/
βββ fingerprint.pb
βββ keras_metadata.pb
βββ model.tflite
βββ saved_model.pb
AModel/1.keras
The .keras file represents the model saved in the Keras format.
AModel/1.h5
The .h5 file represents another serialized version of the trained model using the HDF5-based Keras format.
The 1/ directory contains TensorFlow SavedModel-related artifacts, including:
saved_model.pb
variables/
fingerprint.pb
keras_metadata.pb
The most important model artifact for the Android application is:
AModel/1/model.tflite
This model was used for performing inference inside the Android application.
The trained TensorFlow Lite model was integrated into an Android application using:
- Android Studio
- Java
- Gradle
- TensorFlow Lite
A ready-made Android template obtained from a YouTube tutorial was used as the initial project/UI foundation.
The template was then modified and adapted extensively to implement the requirements of this project and integrate the trained deep learning model.
The Android application is therefore not simply the original template with a model file added; the application was modified to implement the project's required functionality.
The Android application uses the TensorFlow Lite model:
model.tflite
to perform predictions on potato leaf images.
The implemented application functionality includes:
The application handles the Android permissions required for its image/input-related functionality.
This allows the application to interact with the required device resources appropriately.
The application allows an image of a potato leaf to be provided as input.
The input image is prepared in a format suitable for the TensorFlow Lite model.
The .tflite model is loaded by the Android application and used to perform inference.
The general prediction pipeline is:
Input Image
β
Image Processing
β
TensorFlow Lite Model
β
Model Inference
β
Output Probabilities / Prediction
β
Predicted Disease
The Android application processes the output generated by the TensorFlow Lite model to determine the predicted class.
The prediction is then presented to the user through the application's interface.
After inference, the application displays the resulting classification to the user.
This connects the deep learning model's output with the Android application's user-facing functionality.
The Android application was tested directly inside Android Studio using the:
Testing the application in the emulator helped verify the complete prediction workflow, including:
- Application launch
- UI interaction
- Permission handling
- Image input
- Image processing
- TensorFlow Lite model loading
- Model inference
- Prediction handling
- Result display
- Overall application behavior
The emulator provided a controlled Android environment for testing the deployed deep learning model without requiring a physical Android device.
After implementing and testing the Android application, the project was built using Android Studio and Gradle.
The generated APK is included in the repository:
app-debug.apk
The APK contains the Android application with the integrated TensorFlow Lite model and implemented prediction workflow.
After generating the APK, JADX was used to decompile and inspect the application.
The resulting JADX output is included in:
app-debug.apk.jadx
This provides an opportunity to inspect how the compiled Android application is represented after being packaged into an APK.
The analysis can be used to explore:
- Decompiled Java classes
- Android application components
- Application structure
- Permission-related implementation
- TensorFlow Lite integration
- Prediction-related logic
- Resources
- Manifest information
- Compiled application behavior
JADX reconstructs readable Java/source-like code from compiled Android applications.
Therefore, the decompiled output should not be considered an exact representation of the original source code.
Differences can occur because of:
- Compilation
- Optimization
- Resource processing
- Code transformation
- Obfuscation
- Other Android build processes
The JADX output in this repository is included for educational and application-analysis purposes.
The complete project can be summarized as follows:
Potato leaf images are organized into:
Early Blight
Late Blight
Healthy
The images are prepared for use in the deep learning model.
A CNN-based image classification model is developed using TensorFlow/Keras.
The model is trained using the potato leaf dataset.
The trained model is evaluated to understand its classification performance.
The trained model is saved into formats such as:
.keras
.h5
SavedModel
The model is converted into:
model.tflite
for mobile deployment.
The TensorFlow Lite model is integrated into an Android application using:
Android Studio
Java
Gradle
TensorFlow Lite
The initial Android template is modified to implement:
Permissions
β
Image Input
β
Image Processing
β
TFLite Inference
β
Prediction Processing
β
Result Display
The application is tested using the Google Pixel 5a emulator in Android Studio.
The Android application is packaged as:
app-debug.apk
The generated APK is analyzed using JADX, with the output included as:
app-debug.apk.jadx
| Category | Technologies |
|---|---|
| Programming | Python, Java |
| Deep Learning | TensorFlow, Keras, CNN |
| Dataset Processing | Python |
| Development | Jupyter Notebook |
| Model Formats | .keras, .h5, SavedModel, .tflite |
| Android Development | Android Studio |
| Android Programming | Java |
| Build System | Gradle |
| Mobile DL | TensorFlow Lite |
| Android Testing | Google Pixel 5a Emulator |
| APK Analysis | JADX |
| Version Control | Git, GitHub |
This project provided practical experience across multiple stages of an DL application lifecycle.
- Image classification
- CNN-based model development
- Dataset organization
- Image preprocessing
- Model training
- Model evaluation
- Model serialization
- Keras model handling
- H5 model handling
- TensorFlow SavedModel
- TensorFlow Lite conversion
- Mobile model deployment
- Android Studio
- Java
- Gradle
- Android permission handling
- Image input handling
- TensorFlow Lite inference
- Prediction processing
- Result presentation
- Emulator-based testing
- APK generation
- APK decompilation
- JADX
- Decompiled Java inspection
- Understanding compiled Android application structure
ββββββββββββββββββββββββ
β Potato Leaf Images β
ββββββββββββ¬ββββββββββββ
β
ββββββββββββββββββββββββ
β Data Preparation & β
β Preprocessing β
ββββββββββββ¬ββββββββββββ
β
ββββββββββββββββββββββββ
β CNN Model β
β TensorFlow / Keras β
ββββββββββββ¬ββββββββββββ
β
ββββββββββββββββββββββββ
β Training & Evaluationβ
ββββββββββββ¬ββββββββββββ
β
ββββββββββββββββββββββββ
β Trained Model β
β .keras / .h5 β
ββββββββββββ¬ββββββββββββ
β
ββββββββββββββββββββββββ
β TensorFlow Lite β
β Conversion β
ββββββββββββ¬ββββββββββββ
β
ββββββββββββββββββββββββ
β model.tflite β
ββββββββββββ¬ββββββββββββ
β
ββββββββββββββββββββββββββββββββββββ
β Android Application β
β β
β Java + Gradle + Android Studio β
β β
β Permissions β Image β Inference β
β β Prediction β
β β Result β
ββββββββββββββββββ¬ββββββββββββββββββ
β
ββββββββββββββββββββββββ
β Google Pixel 5a β
β Android Emulator β
ββββββββββββ¬ββββββββββββ
β
ββββββββββββββββββββββββ
β app-debug.apk β
ββββββββββββ¬ββββββββββββ
β
ββββββββββββββββββββββββ
β JADX β
β APK Analysis β
ββββββββββββββββββββββββ
Potato Disease Classification demonstrates an end-to-end deep learning deployment workflow:
Deep Learning
β
CNN Classification
β
TensorFlow / Keras
β
TensorFlow Lite
β
Android + Java + Gradle
β
Emulator Testing
β
APK Generation
β
JADX Analysis
The project demonstrates how a deep learning model can move beyond experimentation in a Jupyter Notebook and be integrated into a functional mobile application capable of performing on-device predictions.
Sahil Salunke
- π Live Website: https://potato-disease-classifier-eight.vercel.app
- πΌ LinkedIn: www.linkedin.com/in/sahil814
- π GitHub: https://www.github.com/INDIAN123456890
GitHub: Potato Disease Classification