xuchen86 / CroPatho-Leaf-Disease-Detection

CroPatho is an Android Application which can detect diseases on crops by processing the leaf image.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🌾CroPatho-Leaf-Disease-Detection

CroPatho

🌾CroPatho Application for Crop Disease Detection and Fungicide Recommendation using Computer Vision.

This is one of my Internship projects at Sumago Infotech Pvt. Ltd. The project statement was to build a system that can predict the disease the crop is suffering from and suggest a fungicide.

The project is based on Image Classification which is a branch of Computer Vision. CroPatho App can correctly classify between images and it has separate model for each class. There are total six classes namely "Bell pepper", "Corn", "Grapes", "Potato", "Rice" and "Wheat".

All of these models are CNN models of which few are custom made and some are pre trained models which are then trained on custom data. The app takes an image as an input either from phone's gallery or the camera, converts it into required size of (224 x 224), feeds it to the model and returns the prediction.

The models are converted to TFlite Format to facilitate on-device deployment which also reduces latency. This video is recorded real-time so you can see that the prediction is instantaneous.

You can see the Video Demo for app here: LinkedIn Post

📁Dataset

The dataset for "Bell pepper", "Corn", "Grapes" and "Potato" was sourced from TensorFlow's datasets which can be found here: Plant_Village

I have altered the dataset by dropping some of the plant species.

For "Wheat" and "Rice" data, I used the dataset available here: Wheat Dataset & Rice Dataset

📱How does the Application work?

The Application can predict whether the plant has disease or not. If yes, it will show what is the name of disease and will recommend a fungicide to counter the diseases.

The App takes input image from user either from smartphone's camera or internal storage. The image is then fed to the model which is locally present in the device. The output from model is then shown on screen along with a predefined text about the fungicide.

There are six classes (six crops) that can be predicted. The app contains six models (one for each class) to do the prediction precisely.

🤖Predictor Models

The models are trained on the dataset using Google Colab. There are some models which are made using custom CNN Architecture and some have architecture from pre-trained models (Mobilenet) taken from Keras Applications

These models were saved in .h5 extension after training. Later they were converted to .tflite as it is the only model to integrate with android easily. These tflite models were Quantized to int8 format to reduce file size and latency.

The models take input image of size 224 x 224 px in 3 colour channels. If the input image is of different size, it will be resized before processing.

The models work on CNN architecture thus process the images accordingle. This problem of disease detection is an Image Classification problem so the model is trained of number of images from each disease class of a crop. The last layer in model is softmax layer which gives out probability of classes and the class with highest probability is shown.

📈Performance of models

All the models are pretty accurate.

Model Accuracy (h5) Accuracy (tflite)
Grape 98.04% 98.28%
Potato 89.35% 89.35%
Bell Pepper 100% 100%
Corn 87.05% 85.68%
Rice 91.67 91.66
Wheat 80.22% 83.51%

Following Image shows graph between Accuracy and Validation Accuracy vs number of epochs for Grape Model:

image

And this one shows graph for Loss and Validation loss vs number of epochs for Grape Model:

image

Finally we can see the Actual Classification vs the Predicted Classification for Grape Leaves along with Confidence in Following plot:

image

📸 Screenshots from the App:

image

Welcome Page --> Main Page --> Grape Model --> Selection of image source --> Prediction

Thank You!!

Do ⭐ the Repo if you find this helpful.

Connect with me

LinkedIn

Subscribe to my LinkedIn Newsletter

Data-Blog-Post

Subscribe to Data-Blog-Post for email updates

Data-Blog-Post website

About

CroPatho is an Android Application which can detect diseases on crops by processing the leaf image.


Languages

Language:Jupyter Notebook 100.0%