Abstract In India, one of the main sources of income for a large chunk of the population is agriculture. According to a survey, one of the main problems that farmers face is crops getting infected by pests, ruining months of hard work. To prevent this, we planned to implement an image processing algorithm that would detect and classify the infected part of the plant leaf, with the help of Python and Convolutional Neural Networks (CNN), in order to identify the disease and suggest a treatment. According to our results, the accuracy of the method we chose comes out to be 95.3%, which is better than the conventional approach. The CNN algorithm proposed can play a vital role in the field of smart agriculture. According to studies, human society needs to increase food production by an estimated 70% by 2050 to feed an expected population size that is predicted to be over 9 billion people. Currently, infectious diseases reduce the potential yield by an average of 40% with many farmers in the developing world experiencing yield losses as high as 100%.
2. RELATED WORK ConvolutionalNeuralNetwork(CNN)performanceforobject recognitionandimagedetectionhasimproveddramatically inrecentyears(Szegedy,2015;He,2015;ZeilerandFergus, 2014;SimonyanandZisserman,2014;Krizhevsky,2012)[3].
tediousandcomplicatedsinceithadtobe revisitedeverysingletimethedatasetchangedconsiderably. Almostalltraditionalplantdiseasedetectionattemptshad this problem and thus relied heavily on very labour intensivemethods.Traditionally,thefocuswasonasmall number of classes, typically within the same crop. E.g. “a featureextractionandclassificationpipelineusingthermal and stereo images in order to classify tomato powdery mildewagainsthealthytomatoleaves[5];thedetectionof powderymildewinuncontrolledenvironmentsusingRGBD images[6];comparisonoftwoaerialimagingplatformsfor identificationofHuanglongbinginfectedcitrustrees[7];the detectionoftomatoyellowleafcurlvirusbyusingasetof classic feature extraction steps, followed by classification usingasupportvectormachinespipelineetc.Recently,the useofmachinelearningonplantphenotyping[8](“forthe classification and detection of Phalaenopsis seedling diseases like bacterial soft rot, bacterial brown spot, and Phytophthorablackrot”)substantiallytalkedaboutthework in this area of study. Even though neural networks were usedintheidentificationofdiseases,itrequiredimagestobe carefullyselectedbeforetheclassificationcouldbegin.Not longago,anewstudybyIlyaSutskeverandhiscolleagues [9] showed for the very first time that it was practically possibletodoendtoendsupervisedtrainingusingadeep CNNarchitecturedespitetheimageclassificationproblems usingalargenumberofclasses.Thislefttraditionalmethods thatusedhand engineered methodsin the dust bya huge margin.Asthelabor intensiveaspectoffeatureengineering
Key Words: image processing, plant disease detection, densenet, tensorflow, keras, convolutional neural networks 1. INTRODUCTION
International Research Journal of Engineering and Technology (IRJET) e ISSN: 2395 0056 Volume: 09 Issue: 02 | Feb 2022 www.irjet.net p ISSN: 2395 0072 © 2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page446
Inthepast,itwasbasedonhandengineeredfeaturesnamely SURF(Bay,2008),HoG(DalalandTriggs,2005),SIFT(Lowe, 2004) [4] etc. This was later followed by a learning Italgorithm.wasextremely
,
1234U G Student, Dept. of Computer Science Engineering and Technology Bennett University, Greater Noida, Uttar Pradesh, India ***
Eric Mervin Anandraj1 Ahnaf Rehan Shah2 Singh3 Tanishq Kohli4
,
TheIndianeconomyisalsohighlydependentonagricultural productivitywhichcontributesaround20%ofIndia’sGDP [1].Oneofthemainproblemsthatfarmersfaceisthecrops gettinginfectedbypests,fungiruiningmonthsofhardwork causing huge economic losses every year and threatening foodsecurity.Accordingtoasurvey,annualcroplossesdue toplantdiseasesarearound220billiondollarsworldwide [2].Theconventionaltoolsarenotveryusefulasitisvery difficultforfarmerstoidentifythediseasesbyjustnakedeye observation,andittakesalotoftimeandmanualworkasit requirescontinuousmonitoringoftheplantwhichwillcost youa lotwhenyoudoitona largescale.In countrieslike India,farmersdonothaveproperfacilities,duetowhichthis process may cost you even more. Visually detecting plant diseasesisariskytaskasitislessaccurateandcanonlybe done by some consulting experts. About 85% of plant diseasesarecausedbyfungiandifafarmercandetectthese diseasesintheearlystagesandapplyappropriatetreatment thenitcanpreventalotofwasteandeconomicloss.Wehave come up with the idea of developing an application implementedwithanimageprocessingalgorithmthatwill detectandclassifytheinfectedpartoftheplantleaf,withthe helpofPythonandConvolutionalNeuralNetworks(CNN)in ordertoidentifythediseaseandsuggestatreatment.Wecan give our application to the farmers, and they just have to takeapictureoftheplantandourapplicationwilltellthem whethertheplantishealthyorhasanydiseases.Withthe helpofourapplication,wecananalysehowagriculturein Indiacanbemademoreefficientandsustainable.
Plant disease detection system using image processing
, Shobhit
© 2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page447 was not present, it made this solution very appealing and promisingbecauseofitshugescalability.
3.1 Dataset Description
In our project, we are using the Convolutional Neural Network(CNN)inwhichasingleneuronispresentinalayer that will only be connected to a small region of the layer, rather than all the neurons being fully connected. We are using CNN because of its widely demonstrated efficacy in performingimageclassification,automaticfeaturelearning capability,andeaseoftraining.Generally,CNNiscomposed of4typesoflayers convolutionallayer,poolinglayer,ReLu layer,andfullyconnectedlayers.Theconvolutionallayeris the core building block. Its parameters consist of a set of learnable filters that get activated when it detects some specific type of feature at some occupied position in the input.Apoolinglayerisusedtoreducethespaceoccupied by an image in the network. ReLu is an abbreviation for RectifiedLinearUnits,itenhancesthenonlinearproperties oftheoverallnetworkwithoutaffectingthereceptivefields oftheconvolutionallayer.Finally,afterseveralconvolutional layers, the highest level of reasoning is done through the fullyconnectedlayers[12].
The data fed into neural networks will be normalised to makethenetwork’sprocessingeasier.Inourcase,wewill normalise the pixel values so that they’re all in the [0, 1] range,whichiswheretheywerepreviously.
AllthephotosinthedatasetareintheJPEGformatinRGB colour mode, with a resolution ranging from 0.05 to 0.1 Megapixels.Thetotalnumberofclasslabelsassignedtothe plantleavesis38,whereeachlabelisacrop diseasepair.We aim to predict this same pair, with only the photos of the plantleafbeinggiventothemodel. Wepassedthedatasetthroughanaugmentationalgorithm wherethephotoswererotatedandcolourshifted,totrain themodelbetterandgeneratebetterresults.Wesavedthe augmented photos along with the originals. This offline augmentation ledtoanincreaseinthedataset’ssize from 54k to around 87k images. Apart from this, we added a separate directory comprising around 30 images for the predictionthatistobecarriedoutlater.
Before performing any tests, the Convolutional Neural Networkwillgivethevalidationphase,duringwhichitwill boost efficiency. The following phase will be to test the model,andthenthebestmodelwillbedeployed.
METHODOLOGY
Fig. 1.PreprocessedImages
Forthisexperiment,weusedthePlantVillageDataset,which comprisesover55thousandphotosofdifferentplantsand crops. The plants considered for this dataset include oranges,tomatoes,apples,amongothers.
TotrainourCNNmodel,weneedanactivationfunctionand apoolinglayerbetweeneachconvolutionlayer.Activation functionsareresponsiblefordeterminingtheoutputofeach convolutioncomputationandreducingthecomplexityofour project. In our case, the activation function is the ReLu functionwhichkeepsanynegativeresultsat0andkeepsthe positivevaluesforthesameandhavingallthesezeroeswill makethenetworkmoreefficienttotrainincomputational time.
DavidP.HughesandMarcelSalate[10]compiledtheoriginal data set under Cornell University in the year 2015, which was later revised in 2016. Their primary motive behind gatheringthisdatasetwastostartacrowdsourcingeffortto curbtheincreaseinyieldlosses.Onaverage,40%ofcrops are of no use (worldwide, as of 2015) because of being unabletodetectandtreatthediseasesaffectingthecrops. HughesandMarcelbelievewecansolvethisproblemusing computervision. Thisdatasetconsistsnotonlyofplantsaffectedbybacterial and/orviraldiseases,butthereisasubsetofhealthyplant leaves for each plant taken into consideration. It includes photosof17basicdiseases,4bacterialdiseases,2moulds (oomycete)diseases,2viralinfections,and1mitedisease. Thereareadditional12cropspecies.
3.2 Data Preprocessing We split our dataset into an 85/15 ratio of training and validation,forthepreprocessingofthedataset. Besidestheofflineaugmentationcarriedoutonthedataset, werunthedatasetthroughapreprocessingphaseusingthe KerasImageDataGenerator.Kerasallowsustoaugmentour imagesinreal timebeforeusingthemforthetrainingand testingofthemodel.Thedifferentaugmentationsweused includescaling,sheering,shiftingtheimageeitheralongits widthoritsheight.[11]
3.3 Convolutional Neural Network
3. PROPOSED
International Research Journal of Engineering and Technology (IRJET) e ISSN: 2395 0056 Volume: 09 Issue: 02 | Feb 2022 www.irjet.net p ISSN: 2395 0072
© 2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page448
Here’sadiagramtoexplainhowDenseNetwillbeused todetectadiseasedleaf: Fig. 4. DetectingadiseasedleafusingDenseNet
Inourproject,wearefocusingonarguablyoneofthebest andmostpromisingCNNarchitecture DenseNet(Densely ConnectedCNN).Ithasmultipleversionsdependingonthe depth,varyingfrom121layerswith800,000parametersto 264layerswith15,300,000parameters.Inatypicalnetwork, n layers will have n connections, whereas here, it’ll have n(n+1)/2connections.
Fig. 3. DiagramshowingImageMappinginaDenseNetfor anRGBImage
However,thisbecomesunsustainableaswegodeeper andhavemorelayers.Thismayleadtoafeaturemap explosion.Toovercomethisissue,thenumberofoutput mapsarefixedforeachlayerandalso,adenseblockis createdwhichhasapredeterminednumberoflayers inside it. The feature maps are shared among those layers. The output from a particular dense block is passed on to a transition layer which uses a 1×1 convolutionfollowedbymax poolingtoreducethesize ofthefeaturemaps.[13]
3.4 Flow Diagram
Withoutadenseblock,max poolingwouldn’thavebeen possiblebecausethesizeoffeaturemapsacrossmax poolingwouldbelessandwouldbeextremelydifficult toconcatenatethefeaturemaps.Toreducethemodel complexityandsize,BN ReLU 1×1Convisdonebefore BN ReLU 3×3Conv[14].
TFLite will be used to deploy the model to an Androidapplication.
International Research Journal of Engineering and Technology (IRJET) e ISSN: 2395 0056
Volume: 09 Issue: 02 | Feb 2022 www.irjet.net p ISSN: 2395 0072
Forourproject,we’vechosenDenseNet201insteadofVGG becausethedeepertheCNNgets,theharderitbecomesto trainasthegradientsstarttodisappear.DenseNetimproves gradient propagation by connecting all layers directly to each other. This vanishing gradient problem occurs in networks with large layers. When we backpropagate the unit, this unit is reduced at every step and eventually becomeszerobecausewe’repartiallyderivingeachunit.It hassomeadvantagesoverVGGbecauseitusesparameter efficiencywhichmeansthateachlayeronlyaddsalimited number of parameters thereby improving the flow of gradientsthroughthenetwork.AscomparedtoVGG,ithas reduced the number of parameters by five times with the samenumberoflayers.
Theprojectisdividedintothreestages: TensorFlow and Keras will be used to build and createamachinelearningmodel.
Let’sassumewehavexnumberofinputlayers,andanRGB imagewillhave3channels.Inthefirstlayer(R),it’llmake4 featuremaps(a=4).Butaswegodeeperintothenetworkto layer2(G),it’llnotonlytake4layersfromthepreviouslayer (denotedbytheblackarrow)butalsolayersfromtheinput layer(denotedbytheyellowarrow).Further,the3rdlayer (B)takesalltheprecedinglayersasinput.
3.5 Densenet Algorithm
Thedevelopmentmethodwillbedocumentedand madeopensource. Fig. 2. FlowDiagram
Let’scomparetheaccuracyofthetwoprojectsnow.Asitcan beseenfromFig.7and8,ourmodelhasabettervalidation accuracyandlossthanthatofDhiman’s.
Moreover, we have used the DenseNet201 of the Keras ApplicationcomparedtoVGG16thathasbeenusedintheir project.TheadvantagesofusingDenseNet201overVGG16 areasfollows:
DenseNet201 yields better results in both Top 1 AccuracyandTop 5AccuracycomparedtoVGG16.
The plant leaf disease recognition model that we have proposedinthispaper,issupervised,hashighaccuracy,and hashightrainingefficiency.Themodel,primarilybasedon deep learning still has some problems. To solve the
Forthemetric,wechose‘Accuracy’asitisabuilt infunction, commonlyusedinKeras.
International Research Journal of Engineering and Technology (IRJET) e ISSN: 2395 0056 Volume: 09 Issue: 02 | Feb 2022 www.irjet.net p ISSN: 2395 0072
4. RESULT AND ANALYSIS
Table 1: KerasModelsDenseNet201vsVGG16
One such project is that of Dhiman Thakuria of Kaziranga University,titledLeafDisease,whichusesthePlantVillage Dataset to detect and predict diseases. We have used the same dataset but to increase the accuracy, added more images by augmenting and saving a portion of the images againinthedataset.[16]
4.1 Optimizers, Losses, and Metrics
When run on the CPU, VGG16 takes less time per eachinferencestep.
Since the release of the initial version of the Plant Village Dataset by Hughes and Salate, a lot of experiments on diseasedetectionusingplantleaveshavebeenconductedby variousscholarsandresearchers.HughesandSalate,intheir initialexperiments,couldachieveanaccuracyof31.8%but withtimeanddevelopmentsinCNN,theaccuracyhasnow increaseddrastically. DenseNet201 VGG16 Size (MB) 80 528 Layers 201 16 Top 1 Accuracy 0.773 0.713 Top 5 Accuracy 0.936 0.901 Time (ms) per inference step (CPU) 127.24 69.5
3. CONCLUSIONS
The loss function we chose to minimize was ‘Categorical Cross Entropy’. It is suitable for multiple classes and our projecthas38.Astheresultcanonlybelongtoonecategory outofmany,weneededthemodeltodecidewhichoneand thus,makingitthepickforourproject.
Inourproject,wechose‘Adam’astheoptimizerbecauseof its computational efficiency. We found it to be the most suitable for our dataset, which is large and contains over 55,000images.ItisacombinationofbothAdagradalgorithm andRMSPropalgorithmandthus,yieldsthemostoptimized results.[15]
Fig. 5. PlottingValidationAccuracyandTrainingAccuracy ofourmodelagainstepochs Fig. 6. PlottingValidationLossandTrainingLossofour modelagainstepochs 4.2 Comparison with similar algorithms
© 2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page449
DenseNet201hasadepthof201layerswhichis185 layers more compared to the number of layers in VGG16(16layers) VGG16,whichwasreleasedintheyear2014isalso veryheavyintermsofbootdiskrequired,530MBin total.DenseNet201ontheotherhandisonly80MB insize.
[15] Jimmy Ba Diederik P. Kingma. Adam: A Method for StochasticOptimization. [16]DhimanThakuria.LeafDiseaseDetection
[2]KarenSimonyanandAndrewZisserman.Globalspreadof plantpestsanddiseases.
© 2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page450
[3] The Food and Agriculture Organization of the United Nations.Newstandardstocurbtheglobal spread ofplant pestsanddiseases. [4] Navneet Dalal and Bill Triggs. Histograms of Oriented GradientsforHumanDetection. [5] John Clarkson Shan e Ahmed Raza, Gillian Prince and Nasir Rajpoot. Automatic Detection of Diseased Tomato PlantsUsingThermalandStereoVisibleLightImages. [6]DavidP.HughesSharadaP.MohantyandMarcelSalathe. Using Deep ´ Learning for Image Based Plant Disease [7]Detection.JoeMariMajaW.S.LeeFranciscoGarcia Ruiz,Sindhuja Sankaran.Comparisonoftwoaerialimagingplatformsfor identificationofHuanglongbing infectedcitrustrees.
International Research Journal of Engineering and Technology (IRJET) e ISSN: 2395 0056 Volume: 09 Issue: 02 | Feb 2022 www.irjet.net p ISSN: 2395 0072
REFERENCES [1]MangleshR.YadavandShashankGore.Strengtheningthe IndianAgricultureEcosystem.
remainingproblemsinaccuracyandpracticabilityofplant disease detection and enhance the detection process, this paperproposesaCNNmodelwhichcouldefficientlysaveus thetroubleofplantdiseaserecognitioninatediousway.The proposedmodelincreasestheaccuracyofdiseasedetection and adapts to complex environments. In contrast to the conventionalapproach,theoneproposedinthisensuresthe robustness of the CNN and additionally reduces manual effortdrastically.Therefore,theversionmaywanttoassist agricultural manufacturing employees to save you and therapytheplantailmentquickly. Fig. 7. ValidationLossComparison Fig. 8. AccuracyLossComparison
The proposed algorithm enhances the conventional approachandhelpstoincreasetheaccuracy.Inthefieldof smart agriculture this approach will be of substantial importanceandfacilitatesscientistsandresearchersalike,to takenoteofthecriticalpositionofproblemsfacedinplant diseaserecognition. Hence,themodelusesconvolutionalnetworksandstatistics to solve a predominant problem in agricultural manufacturing and is complementary to the sustainable advancementofsmartagriculture.
[8]DNgJJJohnston,KLLewisandLNSingh.Individualized iterativephenotypingforgenome wideanalysisofloss of functionmutations.
[9] Ilya Sutskever Alex Krizhevsky and Geoffrey E Hinton. Imagenet classification with deep convolutional neural [10]networks.David Hughes, Marcel Salathe, et al. An open access repository of ´ images on plant health to enable the developmentofmobilediseasediagnostics.arXivpreprint arXiv:1511.08060,2015. [11] Manpreet Singh Minhas. Image Data Generators in [1Keras.2]Saad Al Zawi Saad Albawi, Tareq Abed Mohammed. Understandingofaconvolutionalneuralnetwork. [13] Jason Brownlee. Model complexity. arXiv preprint arXiv:1312.4400,2017. [14] Sik Ho Tsang. Review: DenseNet Dense ConvolutionalNetwork(ImageClassification).