Plant Disease Detection using CNN Model and Image Processing

Download Full-Text PDF Cite this Publication

Text Only Version

Plant Disease Detection using CNN Model and Image Processing

Md. Tariqul Islam

Department of Electronics and Communication Engineering (ECE) Khulna University of Engineering and Technology (KUET)

Abstract The rate of plants and crops cultivation rates growing rapidly with the increment of human and animal demands all over the world. The agricultural science invented lots of authentic techniques to use in cultivation sector for improve the production rate. During cultivation, farmers faced lots of challenges to protect their plant form different diseases and insects which make their production lower and they faced much financial losses. Form decades, agricultural scientists tried hardly to invent a quick medication system for detect plant disease quickly and gives treatment immediately. But the identification techniques of fetal abnormalities of plant are manual and it takes huge time. For reducing detection time and increasing efficiency of plant disease detection lots of new technologies introduced with cultivation system. In this work we introduced a model with the help of computer science and engineering using machine learning specially deep learning for detecting the leaf disease by the image of Corn, Peach, Grape, Potato and Strawberry. In Bangladesh, Mize and Potato is very popular food item and Strawberry is also very appealing for all aged people. Peach and Grape is not so popular cultivation in our country but their attraction in fruit market skyrocketed. The farmer who is interested and involved to cultivate corn, peach, grape, potato and strawberry faces lots of disorder and attract of insects and huge loss faced by the farmer. For prevent these losses and provide immediate cure, in this paper uses image processing, CNN (Convolutional Neural Network) model for training the dataset. Our system provides accuracy rate 94.29% successfully. The universal cultivator can get assistance from our research work for growing the production rate of crops and fruits and alleviate the plant disease and insect attract.

Keywords Machine learning, CNN, Image Processing, Computer Vision.


Bangladesh is an agricultural country. Around 80 percent people directly or indirectly related with the agronomical services. Bangladeshi economy extremely depends on agricultural department and large portion of economy in Bangladesh comes from this sector. Our financial status is moved forward by cultivating crops and fruits yearlong. In Bangladesh numerous crops are cultivated over the country and among all the crops and fruits rice, wheat and potato touched the height position of their popularity. The plantation of Maize, Peach, Grape and Strawberry shows increasing pattern and the invitation of this cultivation enhance rapidly. So the interest of farmer for cultivating these sorts of crops and fruits shows higher than any preceding decay.

Zea mays is known as the scientific name of Maize and its another name is corn or mielie. Around the world the corn is the most cultivated crops and for numerous uses corn cultivated commercially almost every country. People of different culture and nature are enjoyed corn as food and the

maize act as a good source of minerals, dietary fiber and vitamins. There exist different types of corn for instance pop corn, dent corn, flour corn, sweat corn and flint corn. Spring season consider as the best time period for maize plantation and the corn is unable to tolerate coolness. The plant grows rapidly with the moisture soil. The cultivator faced different types of critical challenges for protecting maize from different types of disease which reduces the production rate. There are lots of maize diseases for example Anthracnose, Black bundle and Late wilt, Charcoal-Rot, Common Rust, Downy mildews, Cercospora leaf spot, Common sumt (Boil sumt, Blister sumt), Giberrella stalk and ear rot, Northern leaf blight , Southern corn leaf blight, Bacterial leaf blight, Bacterial leaf streak, Bacterial stalk rot, Gosss bacterial blight, Holcus spot, Stewarts walt, Maize dwarf mosaic, pythium root rot, slugs, Aphids, Corn earworm, Cutworms, Fall armyworm, Flea beetles, Thrips, Root knot nematode, Spider mites and so on. During Black bundle and Late wilt disease, the infected plant shows symptom after reaching tassel state. When this disease started its attack the top leaves whose color is dull green and losing its color gradually and finally dry. This disease can be controlled by altering the crops, treatment the seed and reducing water stress. The top and bottom part of leaves become golden brown powdery color in common rust diseases and this disease can be controlled by hybrid the plant. At the time of growing, the leaves shows yellow rings brown spot in cercospora leaf spot and the disease can be reduced by rotate and hybrids the plant.

The peach is very popular fruits and very testy for eating containing vitamin A. The peach grows in warmer temperature in the hemispheres of Northern and Southern region. Peach is first invented in China after that it spreads Asia, Europe, Spain, Mexico and United States. Peach (Prunus persica) fruit tree size is very short. The peachs cultivator paced different types of disease which reduced the peach production rate and causes huge losses. There are numerous diseases such as Bacterial canker (Pseudomonas syringae), Bacterial spot (Xanthomonas campestris), Crown gall (Agrobacteium spp), Scab (Cladosporium carpophlum), Brown rot (Monilinia fructicola), Rust (Tranzschelia discolor), Short hole disease (Wilsonomyces carpophilus), Silver leaf disease (Chondrosterum pupureum), Leaf curl (Taphrina deformans), Plum pox virus (PPV), Fruittree leafroller (Archips argyrospila), Oriental fruit moth (Grapholitha molesta) and so on. During Bacterial spot disease leaves under side become purple color with shot hole at the center and drop out the leaf from the tree. When peach faced Scab disease the fruits surface introduce small circular spot with green color and gradually its size rising become dark produced yellow

halo. In Brown rot disease the skin and tissue of fruits losses its color. The peach upper and lower side shows angular shape yellow green spots. The young leaf turn into red color from yellow color and the leaf raised irregularly is known as leaf curl disease.

Grapes is very testy fruits with green, red, purple color, seedless grapes, jelly grapes, jam grapes, grapes juice and so on. Grapes holds lots of vitamin A and B. Grapes can be eaten as cure of different jeopardy diseases such as Diabetes, eye problems, cardiovascular disease, cancer, heart disease, high blood pressure and so on. During cultivation grapes lots of disease are faced by the plant and fruits such as Powdery mildew (Uncinula necator), Downy mildew (Plasmopara viticola), Anthracnose (Elsinoe ampelina), Black rot (Guignardia bidwellii), Bacterial canker ( Xanthomonas campestris pv. Viticola), Brown leaf spot, Rust, Coniothyrium blight, Alternaria blight, Drechslera leaf spot and so on. Powdery mildew is very dangerous disease. This disease attacks the vines and aerial part of the plant and firstly cluster and berry infection arrives. The leaf experienced circular spot which is brown color known as Black rot disease and the disease can be controlled by separating attacked fruits. The gray mold or bunch rot disease attacked the flowers and ripen fruits. Potato is very popular food item around the world and it act as vegetable. It has large leaf of small plant and the potato produces under the soil. Potato can be grown in high and cool region. Potato is helpful for different disease like blood pressure, brain functioning and ervous system, immunity, inflammation, digestion, heart health, skin care, cancer risk and so on. Potato production are reduced by different types of diseases such as Common scab, Powdery scab, Rhizoctonia, Silver scurf, Bacterial spot rot, Blackleg, Early blight, Freezing and chilling injury, Fusarium dry rot, Late blight, leak, Mechanical injury and cracking, Pink rot, Ring rot, Root knot nematode, Blackheart, Black spot, Fusarium wilt, Net necrosis, Verticillium wilt and so on.

Strawberry is very popular and testy fruit all over the world and its family is Rosaceae, genus Fragaria. Strawberry is cultivated all over the world and mostly grew in the Northern Hemisphere temperate regions. Strawberry is first invented in Europe then it is spreads all over the world and its commercial production have two format for consumption immediate and processing. Strawberry is available during summer and it is popular nutritious fruits with antioxidant content. Strawberry can prevent lots of disease such as Heart disease, stroke, cancer, Blood pressure, Constipation, Diabetes. Strawberry is full of vitamin C, potassium, fiber and foli acid. Strawberry plant and fruits are attacked by numerous diseases for instance Angular leaf spot (Xanthomonas fragariae), Leaf scorch (Diplocarpon earlianum), Anthracnose (Colletotrichum fragariae), Gray mold (Botrytis cinerea), Leaf spot (Mycosphaerella fragariae, Phomopsis leaf blight (Phomopsis obscurans), Powdery mildew (Spaerotheca macularis), Red stele or Red core (Phytophthora fragariae), Slugs, Aphids, Armyworm, Japanese beetle, Loopers and so on. During Angular leaf spot disease the lower side of leaves show little water soaked which become large gradually and turn onto dark green color or angular spots. For protecting this

disease need to crop rotation, avoiding over irrigation, controlling over chemical use. The upper leaf side introduced dark or brown spot due to leaf scorch disease. This diseases can be controlled by renewing regular plants, well air circulating area choose for plantation, well drainage system ect.

In Bangladesh major portion of cultivator are illiterate and they are unable to detect disease using recent technologies. In our country, the new invented algorithm CNN (Convolutional Neural Network) is not used by our farmer. Our cultivator is used hand-made, non-scientific techniques for harvesting crops and detection of diseases. For protecting these diseases they preferred to use pesticides without appropriate scale which damages natural ecosystem. Most of them are largely depend on eye view or blind guesses for disease detection whereas USA, China developed country used various modern technologies like CNN, AI and mostly image processing techniques to detect or harvest their crops. In our research work we developed a model using machine learning so that our farmer can easily use this technique to identify and give appropriate cure. For training and testing our dataset through developing model here used CNN algorithm.


Before doing this work, we read and try to understand some source paper work so that we can do our work accurately. The paper which we read before starting this work is introduced here as literature review. During reviewing these papers it is clear that for disease detecting, classifying and surveying different types of authentic model is introduced by researcher. For plant disease detection, classification and surveying properly lots of innovative techniques are established by researcher and their work summery is included in this section.

Esker published a conference paper for detecting Stewarts disease on corn whose scientific name is Pantoea stewartii subsp in 2006 [1]. They used three predictor model for identify the stewartia corn disease and these three model name are Stevens, Stevens-boewe and Iowa state. Among these three models Stevens-boewe finds the Stewarts disorder leaf blight phase. Umair Ayub published a international conference paper in Pakistan for finding crop disorder dealing with Data Mining, 2018[2]. In this research work they mainly introduced losses which are faced by Pakistani farmer and theses losses appear due to crops diseases which is occurred by the attack of insects. For analyzing the disorder properly they used several data mining model for instance Neural Network, Supporting Vector Machine, Decision Tree and K Nearest Neighbors ect. James rethinks feature of Transgenic crops in 2002 and the requirement of maize over the world [3] and here introduced that the corn approximate requirement id 852 million at 2020. The financial losses is caused by the heavy uses of pesticides in corn is given by the Craig Osteen in the Economic Threshold Concepts [4]. Ravi introduced a clear concept of the origination of peach, its biological action and Morphology using Medical Phytochemicals [5]. Here they mainly focused on the use of peach fruits according to medicine and the use of different betterment of human being. Naeem identify and

manages fungal post-harvest pathogens of peach using morphological model [6]. They mainly characterize the fungal by morphological model and verified motive of postharvest rot of peach. In this work mainly focused on the detection of plant diseases and provides appropriate cure instantly. For doing this work here used image processing and authentic technologies like CNN so that the illiterate farmer can get immediate result with high accuracy.


In our proposed model image processing method is used for the construction of system through which leaf disorder is detected if any distorted picture is supplied with in very short time. As a result a farmer without sufficient sense disease detection knowledge, modern techniques and software can be effortlessly applied this system. The dataset which is used as input is mixed of healthy and distorted images and after completing the action of input dataset the system output provides the affected and healthy leaves. A chart is introduced below as the proposed methodology. Figure 1 is that flowchart.

Image Acquirement

Image Acquirement

Fundamental image processing

Fundamental image processing

Action dataset

Action dataset

Image Expansion

Image Expansion

Analytical analysis

Analytical analysis

Fig.1 Methodology Flow Chart

A. Image Acquirement

When one wants to start a research work his primary responsibility is to gather and process as many data as he capable because in research work dataset contribute vital action. For obtaining perfect result and excellent exactness and getting powerful research work need to collect adequate data. During our research work we are able to collect around 13000 corn, peach, grape, potato and strawberry leaf images. Major part of our dataset is collected from corn, peach, grape, potato and strawberry harvesting field and the remainder data set has obtained from Google and public source of GitHub [7]. For making the spontaneous process system we can take lots of image format such as .gif, bmp, .jpg and so on. .

B. Fundamental Image Processing

Form total collected data we have elected around 10000 valid data and the dataset separated into several folders. The dataset which is selected as training and testing and its ratio is 80 percent and 20 percent respectively. The testing section have been selected 103 images for the disease of Foliar fungal,

239 images for Gray_leaf_spot, Rust disease select 239 images, 233 images for Common_rust_corn, maize healthy

images 233, sort hole disease select 459 images, peach healthy image number is 72, Alternaria_blight disease select 80 images, Anthracnose select 80 images, for downy mildew 94 images 80 healthy images, powdery mildew select 80 images, Black_rot uses 233 images. During training portion of the research work Foliar_Fungal uses 410 images, select 953 images as Gray leaf spot disease, Rust disease collect 929 images, 929 maize healthy images, Short_hole disease elected 1838 imges, peach fruits use 288 healthy images. The dataset which is collected before starting the research work is reshaped duo to match the picture size with each other and set the pixel size as 265×256. In order to increase the image proficiency the operation of image quality enhancement is received. The example of our selected dataset which occur before our research work starting is given below as Fig.2.

Fig.2. Accumulated Dataset

C. System Architecture

The scheme is created using CNN Convolutional Neural Network) multi-level model. The first convolutional layer include the ReLu activation function 1, image input shape is (256, 256, 3), 64 used as filter_size, Kernel_size (8×8), SAME Padding and the Strides is (1×1). The second convolutional layer display the equivalent shape of the first layer and the additional feature is Max_Pool_size (2×2) and strides is (2×2).


In the third and forth convolutional layer ReLu activation function 1, image input_shape is (128, 128, 3), 32 used as

the filter_size, Kernel_size is (5×5), SAME Padding and the

strides is (1×1). The forth layer used Max_Pool_size (2×2) and strides is (2×2). In the fifth and sixth convolutional layer ReLu activation function 1, image input_shape is (64, 64, 3), 16 used as the filter_size, Kernel_size is (5×5), SAME Padding and the strides is (1×1). The sixth layer used Max_Pool_size (2×2) and stride is (2×2). In the seventh and eighth convolutional layer ReLu activation function 1, image input_shape is (32, 32, 3), 8 used as the filter_size, Kernel_size is (3×3), SAME Padding and the strides is (1×1). The sixth layer used Max_Pool_size (2×2) and stride is (2×2). The flatten layer usage 512 units of the dense layer and among them 50 percent is dropped by the ReLu activation function [10]. The utmost output tier used 5 units with softmax activation function 2.


0.001 used as the learning rate used in our proposed model as the optimization of ADAM [9].

Fig.3. Proposed Convolutional Neural Network

D. Optimization and Learning Rate

The optimization algorithm is selected for confirming the sufficient variation of the result of deep learning and computer vision. The evaluation of various subsamples data is done in the Esoteric Adam paper. Various motive functions are stabilizing in this paper. In the gradient steps the efficiency is shown enhancement pattern by the optimization algorithm [11]. Different types of application like NLP (Natural Language Processing) and computer vision shows perfect adaption with the optimization algorithm in the modern world. The optimization technique is efficient for individual learning rate estimation dealing with numerous parameters from the 1st and 2nd moment of gradient. The model which is introduced here using 0.001 as the learning rate in the ADAM 3 optimization amidst.


The neural network and cross entropy function provides acceptable output in the modern work of classification and prediction and this result is more grantable than MSE (mean square error). Usually, the training is not stalled out due to disable of getting sufficient minor using Cross-entropy error

and weighting change. In our research work the categorical cross entropy is used as the loss function 4.


E. Image Expansion

The image partitioning work is taken place in the procedure of image expansion. The image expansion provides some motive and the main motive of the image expansion is:

To represent the image through simplifying and alternating pattern.

Changing the image shapes and angle for producing superfluous data.

Using maximum image rotation range is 40, the width and height shifting range is 0.2, rescaling value is 1/155, shearing and zooming range is

0.2. During the expansion the horizontal flip act as True. For obtaining the greatest accuracy the nearest model is given in fig.4.

Width_shift Rotation

Normal Height_shift Zooming

Original Rotated

Width_shift Height Shift Zoom

Fig.4. Example of Image Expansion

The angle of the image is rotated counter clockwise which is controlled by the sheer range and allow our images to be sheared.

The image is Rescale by multiplying the image data with numeric value at the initial state of the image processing. The coefficient range of the image is 0-255 and it is known as RGB image. But the range of the image is very high in our proposed model. As a result the range of our target value is one and zero and that value acquired by scaling the images with 1/255.

F. Training the Model

Numerous validation and training dataset is used for training the model with the batch_size 30. At the time of operation, the validation and reduction accuracy rate is supervised using learning rate reduction method. When 30 epochs is completed the supervision is worked manually among the validation accuracy and reduced learning rate. Then our model process 15-20 epochs and in a certain time set causal learning rate.

G. Layer Visualization

The gradual change of image is symbolized by layer visualization. The visual change of image in multiple layers is given below.

Fig.5. Layer visuallization using 3×3 matrix

Fig.6. Final layer visuallization using 2×2 matrix format

Fig.7. Layer visuallization using kernel size (3,3)

Fig.8. Layer visuallization using kernel size (2,2)


In our research work, the proposed model is provided expected output after completing the training, testing and validation using various dataset. The detail description about this model output is given below.

A. Analytical Analysis

The training and validation accuracy is obtained through this model 77.99% and 34.17% respectively. With time, after each run the model experienced trained and the exactness of the result improved as well. After completing 10 runs the training and validation accuracy become 89.56% and 61.91% respectively and the learning rate decreased at .0005. When the successful run is counted 30 the training and validation accuracy reached to 93.8% and 95.8% respectively and the learning rate decreased at 3.124e-05. After completing final run the height accuracy is obtained and the value for training and validation accuracy is 94.29% and 96.28% respectively.

B. Accuracy Graph

The term over fitting is used for describing and referring a model and this appear during capturing noise of the data. So the indication is that the perfect fitting of model or algorithmic data occur over fitting. The term under fitting is introduced during showing the lacking of capturing insufficient underlying data. The model which we introduced here shows absence of over or under fitting. The graph for training and validation accuracy and loss of our model is shown in Fig 9.








Alternaria blight










Downy mildew





Healthy leaf





Healthy flower





Unhealthy flower





























Micro avg.





Macro avg.





Weighted avg.





Fig:-9 Training and validation accuracy and loss graph.

C. Confusion Matrix

The performance of the model is shown by the specific error table known as confusion or error matrix. Among total 67 images true image is 67 and false image is 0 only for Alternaria blight, for Anthracnose true images is 41 and false image is 45 among total approximate image 86, The Dwny milddew shows 91 true and 3 false image among 94, For Powdery milddew consider total 80 images where 44 images are true and the remain 36 is false. In Healthy, among 70 image 59 detected as true and 11 is false. Finally for Black rot, among total 80 images 58 shows true and 22 is false. The values introduced in diagonal position of the confusion matrix are bigger than others. The values in diagonal position used (4×4) shape is showing their best performance comparing to the other position and this part maximizing the data and thats why its color is deep blue. Fig.10. Shows confusion matrix and Table 1 shows classification report of our model.

Fig.10. Confusion Matrix

D. Result Analysis of Different Model

Some research papers are analyzed by our self which are related to our research work. We compared out model with other researchers model and found that the model which we proposed provide best result shown in Table 2



Accuracy (%)


Accuracy (%)

Sharada et al. [12]


s.phadikar et al. [15]


Prem et al. [14]


Jyoti and tanuja [16]


Proposed model


Naik Durgesh et al. [17]


E. Result Analysis and Variatioon Accuracy

This proposed model worked well for the separate dataset of corn and peach, shown in (Table 3).



Validation accuracy

Training accuracy

Validation loss

Training loss


























Mixed Dataset






This work provides an authentic notion for detecting the attacked leaf (Grape, Potato and Strawberry) and the farmer who works for produce these fruits gets remedy so that they can enhance the production in agricultural industry. Specialist who works in agriculture department accepts quick disease detection process by image processing technique as a result Image Processing technology touch its milestone within very short time. The transited portion of leaf easily segments and analyzes using CNN model and this model provides best possible result instantly. As a result the farmer who detects plant disease manually can save their time and diminish suspicion on possibilities of wrong detection. Our future goal is to develop an open multimedia system and make a software which automatically detect plant disease and provide their solution.


[1] Esker, P. D., Harri, J., Dixon, P. M., And Nutter, F. W., Jr. 2006. Comparison Of Models For Forecasting Of Stewarts Disease Of Corn In Iowa. Plant Dis. 90:1353-1357.

[2] Umair Ayub, Syed Atif Moqurrab: Predicting Crop Diseases Using Data Mining Approaches: Classification. 2018 1st International Conference On Power, Energy And Smart Grid (Icpesg). Doi: 10.1109/Icpesg.2018.8384523.

[3] James, C. 2003. Global Review Of Commercialized Transgenic Crops: 2002 Feature: Bt Maize. Isaaa Briefs No. 29. Isaaa: Ithaca, Ny.

[4] Craig Osteen, A.W. Johnson, And Clyde C. Dowler : Applying The Economic Threshold Concept To Control Lesion Nematodes On Corn, Natural Resource Economics Division, Economic Research Service,

U.S. Department Of Agriculture.Technical Bulletin No. 1670.

[5] Ravi Kant, Rishi Kumar Shukla, Abha Shukla: A Review On Peach (Prunus Persica): An Asset Of Medicinal Phytochemicals. International Journal For Research In Applied Science & Engineering Technology (Ijraset) Issn: 23219653; Ic Value: 45.98; Sj Impact Factor :6.887 Volume 6 Issue I, January 2018

[6] Naeem, M., Irshad, G., Naz, F., Noorin, S., Aslam, F., & Rafay, A. (2018). Morphological Identification And Management Of Fungal Post-Harvest Pathogens Of Peach (Prunus Persica L). World Journal Of Biology And Biotechnology, 3(1), 183-185

[7] Agriculture Sector In India. [Online]. Available: Https://Github.Com/Charul97/Plant- DiseaseDetection/Tree/Master/Dataset. [Accessed: 23-April 2019].

[8] Srivastava,N.,Hinton,G.,Krizhevsky,A.,Sutskever,I.,Salakhutdin ov,R.:Dropout:Asimple Way To Prevent Neural Networks From Overtting. J. Mach. Learn. Res. 15 19291958 (2014)

[9] Janocha,K.,Czarnecki,W.M.:Onlossfunctionsfordeepneuralnetw orks Inclassication (2017). Arxiv:1702.05659

[10] Goutum Kambale1, Dr.Nitin Bilgi : A Survey Paper On Crop Disease Identification And Classification Using Pattern Recognition And Digital Image Processing Techniques. May (2017).

[11] M. Akila And P. Deepan : Detection And Classificationof Plant Leaf Diseases By Using Deep Learning Algorithm.(2018). International Journal Of Engineering Research & Technology (Ijert) Issn: 2278-0181 Published By, Www.Ijert.Org Iconnect – 2k18 Conference Proceedings

[12] G. Prem Rishi Kranth, M. Hema Lalitha, Laharika Basava, Anjali Mathur : Plant Disease Prediction Using Machine Learning Algorithms. November (2018). International Journal Of Computer Applications (0975 8887) Volume 182 No. 25.

[13] S. Phadikar And Et Al: Bayes And Svm Classifier , Mean Fiitering Technique And Otsus Algorithm.

[14] Jyoti And Tanuja : Cotton Plant Leaf Diseases Identification Using Support Vector Machine. International Journal Of Recent Scientific Research Vol. 8, Issue, 12, Pp. 22395-22398, December, 2017

[15] W.-K. Chen, Linear Networks and Systems (Book style). Belmont, CA: Wadsworth, 1993, pp. 123135


Md. Tariqul Islam received the B.Sc. Engineering (ECE) degree form Khulna University of Engineering and Technology (KUET), Bangladesh, June 2017. He is currently working as a Lecturer in Department of Computer Science and Engineering (CSE) in Bangladesh University, Dhaka, Bangladesh where he joined in January, 2018. His main research interest includes Machine Learning, Deep Learning, Biomedical Signal and Image processing, Image processing. He has published two international conference papers.

Leave a Reply

Your email address will not be published. Required fields are marked *