🌾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
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
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.
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.
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:
And this one shows graph for Loss and Validation loss vs number of epochs for Grape Model:
Finally we can see the Actual Classification vs the Predicted Classification for Grape Leaves along with Confidence in Following plot:
Welcome Page --> Main Page --> Grape Model --> Selection of image source --> Prediction
Do ⭐ the Repo if you find this helpful.