Detection and Identification of Plant Leaf Diseases based on Python

Download Full-Text PDF Cite this Publication

Text Only Version

Detection and Identification of Plant Leaf Diseases based on Python

Mr. Ashish Nage

Prof. Ram Meghe Institute of Technology & Research, Badnera

Abstract The major cause for the decrease in the quality and amount of agricultural productivity is plant diseases. Farmers encounter great difficulties in detecting and controlling plant diseases. Thus, it is of great importance to diagnose the plant diseases at early stages so that appropriate and timely action can be taken by the farmers to avoid further losses. The project focuses on the approach based on image processing for detection of diseases of plants. In this paper, we propose an Android application that helps farmers for identifying plant disease by uploading a leaf image to the system. The system has a set of algorithms which can identify the type of disease. Input image given by the user undergoes several processing steps to detect the disease and results are returned back to the user via android application.

Keywords Image processing, Detection, Identification of plant leaf diseases, Convolutional neural network


The most widely used method for plant disease detection is simply naked eye observation by experts through which identification and detection of plant diseases are done. For doing so, a large team of experts as well as continuous monitoring of experts is required, which costs very high when farms are large. At the same time, in some countries, farmers don't have proper facilities or even idea that they can contact to experts. Due to which consulting experts even cost high as well as time- consuming too. In such a condition, the suggested technique proves to be beneficial in monitoring large fields of crops. And automatic detection of the diseases by just seeing the symptoms on the plant leaves makes it easier as well as cheaper. Plant disease identification by the visual way is a more laborious task and at the same time less accurate and can be done only in limited areas. Whereas if automatic detection technique is used it will take fewer efforts, less time and more accurately. In plants, some general diseases are bacterial, black spotted, and others are Rust, viral and Red cotton Leaf. Image processing is the technique which is used for measuring the affected area of disease, and to determine the difference in the color of the affected area [1]. Image segmentation is the process of separating or grouping an image into different parts. There are currently many different ways of performing image segmentation, ranging from the simple thresholding method to advanced color image segmentation methods. The segmentation process is based on various features found in the image. This might be color information, boundaries or segment of an image.

Prof. V.R. Raut

Prof. Ram Meghe Institute of Technology & Research, Badnera


    Paper [1] Extensive research has been conducted to explore various methods for automated identification of plant diseases. The disease can manifest in various parts of the plant such as roots, stem, fruit or leaves. As stated before, this work concentrates, particularly on leaves.

    Paper [2] discussed a methodology for recognition of plant diseases present on leaves and stem. The proposed work is composed of K-Means segmentation technique and the segmented images are classified using a neural network. They developed a method for detecting the visual signs of plant diseases by using the image processing algorithm. The accuracy of the algorithm was tested by comparing the images, which were segmented manually with those automatically segmented.

    Paper [3] discussed various techniques to segment the diseased part of the plant. This paper also discussed some Feature extraction and classification techniques to extract the features of infected leaf and the classification of plant diseases. The use of ANN methods for classification of disease in plants such as self-organizing feature map, back propagation algorithm, SVMs, etc. can be efficiently used. From these methods, we can accurately identify and classify various plant diseases using image processing techniques.

    In paper [4] an approach based on image processing is used for automated plant diseases classification based on leaf image processing the research work is concerned with the discrimination between diseased and healthy soybean leaves using SVM classifier. They have tested our algorithm over the database of 120 images taken directly from different farms using different mobile cameras. The SIFT algorithm enables to correctly recognize the plant species based on the leaf shape. The SVM classifier can help in recognizing normal and diseased soybean leaves with an average accuracy as high as 93.79%. The main aim of the proposed work is to provide inputs to an autonomous DSS which will provide necessary help to the farmers as and when required over the mobile. This system will provide help to the farmer with minimal efforts. The farmer only needs to capture the image of the plant leaf using a mobile camera and send it to the DSS, without any additional inputs.

    In paper [5] the work represents groundnut leaf disease extraction and classification using color imagery. The color imaginary transform, color co-occurrence matrix, feature extraction will be done and get an efficiency

    output with a neural network, Back propagation gives efficient groundnut leaf detection with a complex background, in this work we classified only four different diseases with 97 Al % of efficiency. But in the future, the work carried out more diseases by using this method.

    Paper [6] contain the study of detection of plant diseases and the detection of the infected part of plants. Initially, input images are taken and then image processing is started. Background and Black pixels are both segmented in the first step. Then Hue and Saturation part of the image is also separated. And finally infected part and infected area % and a name of the disease is acquired which is main work using our proposed methodology. The main aim of this work is to provide the advancement and enhancement in computing classifiers of a neural network approach and provide better results. This study contains a unique work that is it will calculate the % of an infected area of plants.


    The system consists of the following blocks:

    Web Socket: Web Socket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. Send the Acquired Image by using a mobile camera to the web socket Server. In Our Project, we used a Local Server.

    Python: Python is an interpreted high-level programming language for general-purpose programming. In python, OpenCV is to be installed.

    Open source computer vision library' initiated by some enthusiast coders in 1999' to incorporate Image Processing into a wide variety of coding languages. It has C++, C and Python interfaces running on Windows, Linux, Android, and Mac. It is one of the Libraries used for the image processing in python. On python web framework by using: leaf Identification algorithm it detects and identifies the Leaf and diseases. By using Database it sends the result back to the sender farmer.


    Figure 2: Flow Chart

    CLAHE is Contrast Limited Adaptive histogram equalization. It used for light intensity Equalization.

    C.N.N.-convolutional neural network (CNN, or ConvNet) is a class of deep, feed-forward artificial neural networks, most commonly applied to analyzing visual imagery.


    1. Image Acquisition- The images of the plant leaf are captured through the camera. This image is in RGB (Red, Green, and Blue) for color transformation structure for the RGB leaf image is created, and then, a device-independent color space transformation for the color transformation structure is applied

    2. Image Pre-processing To remove noise in the image or other object removals, different pre-processing techniques is considered.

      RGB to Gray Converter-Weighted method or luminosity method-You has seen the problem that occurs in the average method. The weighted method has a solution to that problem. Since red color has more wavelength of all the three colors, and green is the color that has not only less wavelength than red color but also green is the color that gives a more soothing effect to the eyes.

      It means that we have to decrease the contribution of red color, and increase the contribution of the green color, and put blue color contribution in between these two. So the new equation that form is:

      New grayscale image = ( (0.3 * R) + (0.59 * G) + (0.11 * B) ). According to this equation, Red has contributed 30%, Green has contributed 59% which is greater in all three colors and Blue has contributed 11%.

      Image Resize- The resolution of document images is typically higher than 2000 _ 2000, which is too large to be fed to a CNN with the current availability of computing resources. Large input dimension not only costs more computation resources but also leads to a greater chance of overfitting. After Converting RGB image into Gray it

      resizes into a standard format that is either 400 × 400 for better resolution.

      CLAHE -Ordinary AHE tends to over amplify the contrast in near-constant regions of the image since the histogram in such regions is highly concentrated. As a result, AHE may cause noise to be amplified in near- constant regions. Contrast Limited AHE (CLAHE) is a variant of adaptive histogram equalization in which the contrast amplification is limited, so as to reduce this problem of noise amplification.

      Gaussian blur -In image processing, a Gaussian blur (also known as Gaussian smoothing) is the result of blurring an image by a Gaussian function (named after mathematician and scientist Carl Friedrich Gauss). It is a widely used effect in graphics software, typically to reduce image noise and reduce detail.

      Convolutional Neural NetworksAfter removing noise from the image it required to extracts the feature. We propose to use a CNN for document image classification.

      The main idea is to learn a hierarchy of feature detectors and train a nonlinear classifier to identify complex document layouts. Given a document image, we first perform downsampling and pixel value normalization, then feed the normalized image to the CNN to predict the class label.


      • Image is captured through the mobile camera.

      • The captured image is uploaded to the local server using android application.

      • Image undergoes various image processing algorithms at the server to determine the disease.

      • The determined disease is sent back as a result on the mobile application.

    Fig. 3 Python server tries to connect mobile app

    Fig. 4 Image Capture for Database

    Fig. 5 Result on Mobile Screen

    Disease Name
























    Table: Accuracy of the five diseases

    Bar Graph: Results accuracy


    The use of automated monitoring and management systems are gaining increasing demand with technological advancement. In agricultural field loss of yield mainly occurs due to widespread disease. Mostly the detection and

    identification of the disease are noticed when the disease advances to the severe stage. Therefore, causing the loss in terms of yield, time and money. The proposed system is capable of detecting the disease at the earlier stage as soon as it occurs on the leaf. Hence saving the loss and reducing the dependency on the expert to a certain extent is possible. It can provide help for a person having less knowledge about the disease. Depending on these goals, we have to extract the features corresponding to the disease.


  1. Al-Bashish D, M. Braik and S. Bani-Ahmad, 2011. Detection and classification of leaf diseases using K-means-based segmentation and neural networks based classification. Inform. Technol. J., 10: 267-275. DOI:10.3923/itj.2011.267.275, January 2011.

  2. Armand M.Makowski "Feature Extraction of diseased leaf images", Fellow, IEEE Transactions on information theory Vol.59, no.3 March-2013

  3. H.Al-Hiary, S. Bani-Ahmad, M.Reyalat, M.Braik and Z.AlRahamneh, Fast and Accurate Detection and Classification of Plant Diseases, International Journal of Computer Applications (0975-8887), Volume 17-No.1.March 2011.

  4. DaeGwan Kim, Thomas F. Burks, Jianwei Qin, Duke M.Bulanon, Classification of grapefruit peel diseases using color texture feature analysis, International Journal on Agriculture and Biological Engineering, Vol:2, No:3,September 2009. Open access at

  5. Jasmeet Kaur, Dr.Raman Chadha, Shvani Thakur, Er.Ramanpreet Kaur. A Review Paper on Plant Disease Detection using Image Processing and Neural Network Approach. International Journal of Engineering Sciences & Research Technology. April 2016. ISSN: 2277-9655.

  6. Diptesh Majumdar, Dipak Kumar Kole, Aruna Chakraborty, Dwijesh Dutta Majumder. REVIEW: DETECTION & DIAGNOSIS OF PLANT LEAF DISEASE USING INTEGRATED IMAGE PROCESSING APPROACH. International Journal of Computer Engineering and Applications. June 2014. Volume VI; Issue- III.

  7. S. S. Sannakki, V. S. Rajpurohit. An Approach for Detection and Classification of Leaf Spot Diseases Affecting Pomegranate Crop. International Journal of Advance Foundation and Research in Computer. January 2015, Volume 2, Special Issue (NCRTIT 2015), ISSN 23484853.

  8. Davoud Ashourloo, Hossein Aghighi, Ali Akbar Matkan, Mohammad Reza Mobasheri, and Amir Moeini Rad," An Investigation Into Machine Learning Regression Techniques for the Leaf Rust Disease Detection Using Hyperspectral Measurement" 2016 IEEE.

  9. Mr. Melike Sardogan Plant Leaf Disease Detection and Classification based on CNN with LVQ Algorithm 2018 3rd International Conference on Computer Science and Engineering (UBMK) 2018 IEEE.

  10. K. P. Ferentinos, Deep learning models for plant disease detection and diagnosis, Computers and Electronics in Agriculture, vol. 145, pp. 311-318, 2018.

Leave a Reply

Your email address will not be published.