/Potato-Disease-Classification

Potato Disease Classification

Primary LanguageJupyter Notebook

Potato Disease Classification Using CNN

Problem Statement

Farmers who grow potatoes are facing lot of economical losses every year because of various disease that can happen to a potato plant.

There are two common disease:

  • Early Blight and Late Blight.

  • Early Blight: It is caused by a fungus and Late Blight is caused by a specific micro-organism and if a farmer can detect these disease early and apply appropriate treatment then it can save lot of waste and prevent the economic losses.

The treatment for Late Blight and Early Blight are little different, so it is important that you accurately identify what kind of disease is there in that potato plant.

Objective

To build a mobile application and web page , which we can give it to farmers and farmers, all they need to do is go their farm and just take a picture of the plant and the application will tell them whether the potato plant is healthy or it has one of these disease and behind the scene application will be using deep learning and Convolutional Neural Network.

WebApp

Demo

Potato_Disease_Classification_Demo.mp4

Technical Aspects

  • Python 3.7 and more
  • Important Libraries: tensorflow, sklearn, pandas, numpy, matplotlib & seaborn
  • Front-end: HTML, CSS
  • Back-end: Flask framework
  • IDE: Jupyter Notebook, Pycharm & VSCode
  • Deployment: Heroku, AWS

How to run this app

Code is written in Python 3.9.4. If you don't have python installed on your system, click here https://www.python.org/downloads/ to install.

  • Create virtual environment - conda create -n myenv python=3.9.4
  • Activate the environment - conda activate myenv
  • Install the packages - pip install -r requirements.txt
  • Run the app - python run app.py

Workflow

Data Collection

We need to collect images of a healthy potato plant leaf and the potato plant leaf which has Early Blight or Late Blight disease.

Here we have used Data of Poatato Disease available in Kaggle.

Dataset credits: https://www.kaggle.com/arjuntejaswi/plant-village

Data Cleansing and Pre-processing

Here we have used tf data set and Data Augmentation. Data Augmentation because we were not having enough diverse set of images. So we did rotation, fliping and adjusted contrast to create more training samples.

Model Creation and Evaluation

  • Image Classification Model using CNN.
  • Used Maxpooling2D and Flatten layers to create CNN.
  • Activation Function used are: RELU and SOFTMAX.
  • Model performance evaluated based on accuracy and loss.
  • On test data we get approximately 100% accuracy.
  • Model saved on local desk.

Model Deployment

The final model is deployed on Heroku using Flask framework.

Training, Validation Accuracy and Validation Loss Curve

training and loss curve_potato

UI

  • User Interface is a very simple one, with single page asking for image to be classified. Potato_UI_1

  • After selecting image for classification, we just need to click predict button. Potato_UI_2

  • Classification result will be displayed as following. Potato_UI_final

  • User can also download sample image for reference. Potato_UI_3

Author

Upendra Kumar: https://www.linkedin.com/in/imupendra/

Help Me Improve

Hello Reader if you find any bug please consider raising issue I will address them asap.