Skip to main content

Automated Apple Disease Classification and Sorting

Page 1


International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056

Volume: 13 Issue: 04 | Apr 2026 www.irjet.net p-ISSN: 2395-0072

Automated Apple Disease Classification and Sorting

Prof. Neeru Pathak1 , Rhushikesh Salvi2 , Chetan Choudhary3, Nasir Syed4

1Assistant Professor, Department of Electronics and Telecommunication Engineering 2,3,4B.E . Students, Department of Electronics and Telecommunication Engineering Thadomal Shahani Engineering College Bandra(w), Mumbai, Maharashtra, India.

Abstract - Manual sorting and disease detection in postharvest and yielded agricultural products can be a tedious task for laborers, human prone to fatigue and error. There is thus a need for a low cost, autonomous application to automate the sorting process. This paper presents an Automated fruit classification and sorting system for sorting healthy apples from scab, black rot and apple blotch infected ones. The hardware architecture involves a custom designed 3D-printed conveyor mechanics cluster, driven by L298 N motor controllers and automated servo motors overseen by a RaspberryPi3 B. Toenablethe extractionofreliablefeatures, multi-sensor fusionis usedtocapture spatialdatainreal-time from the involved sensors, namely the combined CSI and USB camera feeds. A visual class predictor is also developed on the computer vision platform, i.e. deep neural network with Python's Torch library, that compares the best Convolutional Neural Network (CNN) and Vision transformer (ViT) architecture design choices for accurate classification. To combat the limited processing power of the edge device, a networked Flask & Ngrok client-server environment is developed for remote inference serving. Validations across all supported categories of the system show a 94.8% peak classification accuracy of the best model.

Key Words: Automated Sorting, Multi-Sensor Fusion, Vision Transformers, Convolutional Neural Networks, Raspberry Pi.

1. INTRODUCTION

Agricultural production has been heavily reliant on postharvestprocessingtechnologiesthatdeliverconsistentand high-qualityproduceintothemarketplace.Forfruitcropsin the orchard, a premium apples is determined by overall visual quality and surface fracture characteristics. Apple surface diseases are responsible for a significant net economic loss and result in the deterioration in visual quality, when they are victim to various surface diseases. Citrusfruitstoo,aresusceptibletopestsanddiseasesover thecourseoftheirdevelopmentcycle.Traditionally,manual inspection and sorting algorithms were used, but laborintensive manual sorting processes whose inherent limitationislaborfatigue,causelongdelays,increasedcost, and can lead to quality control issues. With the advent of increasingly sophisticated deep learning network architecturessuchasConvolutionalNeuralNetworks(CNN) andVisionTransformer(ViT),computervisiontechniques

have gained traction in the agricultural domain for paper, Imageclassification,andobjectdetectiontasks. While there have been software solutions using deep learning CNNs and ViTs to solve the indirect sorting, classification of diseased produce is computational heavy. Runningthemoncost-effectiveedgecomputinghardware forreal-timesortingapplicationscanbeachallenge.Inthis paper, we provide a solution to both these hardware and softwarechallengesthatstandinthewayofautomationfor thesortingand gradingoffruitinthedownstreamsupply chain.

The hardware solutions we suggest for sorting involves a customized conveyor belt mechanism driven by L298N motordriverstofacilitatesortingbyaraspberrypi3bwith two servo motors for mechanical segregation of fruit. The multi-sensor fusion of the system onto the cables by synchronizingtheirrespectivecamerasisachievedusingCSI andUSB.

Forthesoftwareapplication,thehighlycomputationalCNN and ViT deep learning models are hosted on a networked serverenabledviatheFlaskapplicationandNgroksoftware, tosendreal-timeimagedatafromtheconveyortoarun-time framework in which the ViTS and CNNs are classify the diseasedwithinfruittoahigh94.8%accuracyrate,andsend controlcommandsbacktotheedgeraspberrypicontroller toperformsorting.

2. LITERATURE REVIEW

1.) Deep Neural Networks Based Recognition of Plant Diseases by Leaf Image Classification, S. Sladojevic, M. Arsenovic, A. Anderla, D. Culibrk, and D. Stefanovic, Year 2016. In order to remedy for how manual inspections are time-consuming and have low efficiency and accuracy, computer vision inagriculture have been adopted more. Previous automated inspection methodshad difficultiesto recognizeonesuchsurfaceabnormalityasapplescab,black rot, apple blotch. As pointed out by Sladojevic et al., CNN broughtrevolutionaryimprovementtodiseaseclassification inapplicationsofdiagnosticmethodinagriculture,because CNNtakesCNNasfeaturesextractedautomatically,andthen performs classification with high accuracy, based on registration and organization of spacial information, replacingtheoldtrainedmodelsbasedonmachinelearning thatcouldnotrecognizedbasedonthesinglesensoroff-theshelfdigitalvisiondata

International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056

Volume: 13 Issue: 04 | Apr 2026 www.irjet.net p-ISSN: 2395-0072

2.)AnImageisWorth16x16Words:TransformersforImage RecognitionatScale,A.Dosovitskiy,L.Beyer,A.Kolesnikov, D.Weissenborn,X.Zhai,etal.,Year2021.Buildinguponthe architectureestablished byconvolutional neural networks (CNNs),VisionTransformers(ViT)haveshownpromiseby leveragingself-attentioninordertogettheentirecontextof an entireimage. Dosovitskiyetal.showedthattreatingan image as a sequence of patches leads to models with recognitionperformancethatreachesorsurpassesthatofthe bestmodelstodate.Thisisespeciallyusefulforautomated fruit sorting to pick up on subtle disease symptoms when they appear across the apple as a whole. When used in conjunction with multi-sensor fusion-in which redundant, accurate, high-fidelity spatial data is collected-these new architectures would greatly enhance the robustness of an automateddiseaseclassificationarchitecture.

3.)MobileNetV2:InvertedResidualsandLinearBottlenecks, M.Sandler,A.Howard,M.Zhu,A.Zhmoginov,andL.Chen, Year2018.Whilestate-of-the-artdeeplearningarchitectures canreachover0.99accuracy,deployingthesemodelsonlowcost edge hardware has become a severe computational bottleneck. Sandler et al. highlight the importance of lightweightmobilearchitecturesdesignedfordeploymenton edge hardware. Nevertheless, in this complex agriculture setting with mechanical actuation reaching down into the physicalworld firingofftheL298full-bridgemotordriver in order to actuate the physical conveyor belt and sorting mechanism running the heavy model directly on a Raspberry Pi is not yet feasible. The system requires the distributionofaninferencearchitecture,whichacceptsedge sensor-captureddataandstreamsittoaPyTorchbackend, allowing the system to actively engage bothhigh-accuracy classificationandquickphysicalactuation.

3.

PROPOSED METHOD

RaspberryPi3ModelB

The Raspberry Pi 3 Model B serves as the primary edge controller for the physical sorting station. Operating on a Linux-based environment, this single-board computer is responsiblefororchestratingalllocalhardwareinteractions. It acts as the central bridge between the physical sensors (cameras), the mechanical actuators (motors), and the remote processing server. Because running heavy deep learningmodelslocallyonthePicausessignificantlatency, its primary role in this proposed system is optimized for dataacquisition,securenetworktransmission,andexecuting rapidactuationcommands.

Multi-SensorVisionSystem(CSI&USBCameras)

To ensure comprehensive feature extraction and mitigate therisk of misclassification dueto poorlightingorpartial occlusions, the system employs a multi-sensor fusion approach.AsynchronizedarrayofbothCSI(CameraSerial Interface)andstandardUSBwebcamerasismountedabove theconveyorbelt.Asanapplepassesthroughtheinspection

zone, these cameras capture high-resolution spatial data from multiple angles, ensuring that localized surface anomalies such as scab, black rot, or blotch are fully visibletotheclassificationalgorithm.

ConveyorMechanism&L298NMotorDriver

The transportation of the fruit is handled by a customdesigned,3D-printedconveyorbeltsystem.Thelocomotion ispoweredbyDCmotorsregulatedbytheL298NDualFullBridge Motor Driver. The L298N acts as an essential interface between the low-voltage logic signals of the Raspberry Pi and the higher current demands of the conveyormotors.Thisallowsthesystemtosmoothlycontrol thespeedandpacingoftheapplesastheyenterthecamera inspectionzone.

ServoMotorActuationforSorting

Once a classification decision is made, the physical segregationofthefruitisexecutedusingautomatedservo motors. Based on the mechanical design modeled in CAD software,custom3D-printedsweeperarmsareattachedto theservos.WhentheRaspberryPireceivesan"infected"or "healthy" signal from the server, it sends a precise PWM (Pulse Width Modulation) signal to the designated servo, actuating the arm to sweep the apple into its respective collectionbin.

NetworkedCommunicationServer(Flask&Ngrok)

ToresolvethecomputationalbottleneckoftheRaspberryPi, a distributed inference architecture was developed. A lightweight Flask web server is deployed to handle the routingofdata.Ngrok isutilizedtocreatea secure,stable tunnel from the local edge network to the public internet. Themomentthecamerascaptureanimage,thePisendsthis data payload through the Ngrok tunnel to the dedicated processingbackend,enablingnearreal-timecommunication withoutrequiringastaticIPaddressattheagriculturalsite.

DeepLearningClassificationBackend(PyTorch)

Thecoreintelligenceofthesystemresidesonaremote,highperformance computing backend utilizing the PyTorch framework. When the server receives the multi-sensor image data from the Pi, it is fed into the optimized deep learningpipeline.Thesystemcomparestheperformanceof advancedConvolutionalNeuralNetworks(CNNs)andVision Transformers(ViT)toextractfeaturesandclassifythefruit into distinct categories: healthy, scab, black rot, or blotch. Uponsuccessfulclassification,theserverinstantlytransmits alightweightactuationcommandbackthroughthenetwork totheRaspberryPitotriggertheservomotors.

International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056

Volume: 13 Issue: 04 | Apr 2026 www.irjet.net p-ISSN: 2395-0072

4. WORKING

Thisautomatedfruitclassificationandsortingsystemworks ontheprincipleofcontinuousvisualmonitoringandrealtimemechanicalsegregation.Whenthissystemisinstalled onanagriculturalgradingline,theapplesarecontinuously fedontoacustom3D-printedconveyorbeltwhosespeedis permanentlyregulatedbyanL298Nmotordriver.Thevisual sensors, specifically a synchronized array of CSI and USB cameras, are permanently mounted directly above the inspectionzone.Thesecamerasactasoptical transducers, capturingthecomplexspatialandcolordataoftheapple's surface and converting the visual anomalies into highresolution digital image arrays. When the surface characteristicschangeduetodiseaseslikeapplescab,black rot,orblotch,thespatialpixelvaluesinthesedigitalarrays change accordingly. Both camera measurement feeds are instantlyreceivedbytheRaspberryPi3B,whichservesas the mainintelligent edgecontrollerofthis wholephysical station.

Afterreceivingthesevisualarrays,themicrocontrollerdoes notprocesstheheavycomputationslocallytoavoidlatency; instead,thesevaluesaresenttowardaremotedeeplearning system using programmed networking algorithms. The system transmits this data to a dedicated PyTorch processingbackendusingFlaskandanNgroksecuretunnel. Usingthisbackendmodelarchitecture,thesystemevaluates thefruitusingConvolutionalNeuralNetworks(CNNs)and Vision Transformers (ViT) to determine its health status. Once classified, the remote server immediately sends an actuationsignalbacktotheRaspberryPi,whichtranslatesit intoanelectricalPulseWidthModulation(PWM)signal.This

signal triggers the servo motors, physically sweeping the appleintoitsrespectivecollectionbin.

:OperationalWorkflowoftheSortingSystem

With the development in the computer vision and edge computing industry, single-board computers like the RaspberryPianddeeplearningframeworkshavebecome affordable,haveincreasedprocessingspeeds,andarehighly power-efficient.Thishasledtotheincreaseddevelopmentof automatedembeddedsystemsthattheagriculturalsectoris

Fig -1:SystemArchitectureBlockDiagram
Fig -2

International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056

Volume: 13 Issue: 04 | Apr 2026 www.irjet.net p-ISSN: 2395-0072

adopting.Theproposedqualitycontrolsystemutilizesthese conceptstocomeupwithasystemforbettereconomicyield andreducedmanuallaborforfarmersinsociety.From an engineering perspective, the project has seen concepts acquiredthroughcomputerscience,mechanicaldesign,and embeddedsystemsstudyperiodsbeingpracticallyapplied. Mechanical kinematics knowledge was used during the designand3Dfabricationoftheconveyorandsweeperarms. Network data flow analysis was used in the secure transmission between the edge controller and the remote server, and advanced machine learning software programming was used during the training of the neural networkstocomeupwithafinalfinishedautomatedsystem. Thewholeclassificationsystem,whichwehaveproposed, canbeseamlesslyintegratedintolargerindustrialgrading facilities. This will help agricultural distributors to easily deploy this automated mechanism on existing massive conveyor lines. Advanced edge AI accelerators and programmablelogiccontrollers(PLCs)willgreatlycomein handyinthisregard.

5. CONCLUSIONS

Alltheprojectworkhasbeenstudied,andimplementedas fullyfunctionalprototypeusingRaspberryPi3ModelB.The programmingandremotenetworkroutingweredoneusing PyTorchdeeplearningframework,Flask,andasecureNgrok tunnel.Thisdemopaperdetailsthedesignandfabricationof an automated agricultural fruit classification and sorting system.

Thisprojectcouldbeanenormousfinancialleverageforthe agriculturalsectorbyimprovingtheefficiencyinthefiltering and sorting procedure of the harvested fruit for the distributors in farming sector to inspect and examine the quality of the post harvesting produce. The multi-sensor classificationsystemforapplediseasedetection,achievinga peakaccuracyof94.8%,hasbeenfabricatedsuccessfully.In this paper, we demonstrate the crucial and valuable advantages of deploying the distributed edge to server inferenceforautomatedagriculturalsystemwhiledrawing itsimplicationsforfutureresearchdirectioninthefieldof agricultureandfoodindustry.

Thecombiningofminiaturizededgecontrollerswithmore sophisticatedMLmodelssuchasVisionTransformerswould havethevisualimpactonfarmindustryallowingeventhe mostdistantpackingfacilitytoperformthequalitychecksto stringent standards minimizing the threat to the market yields. The 3D visual data of the environment can be sampledatahighframerateinthereal-worldconveyoror warehouseenvironment.Moreover,thechallengessuchas latency, operational time limits on the edge devices and synchronized mechanical actuation were discussed in the paper.

REFERENCES

[1] Sladojevic, S., Arsenovic, M., Anderla, A., Culibrk, D., Stefanovic,D.:DeepNeuralNetworksBasedRecognition of Plant Diseases by Leaf Image Classification. Computational Intelligence and Neuroscience. 2016, 3289801(2016).

[2] Dosovitskiy,A.,Beyer,L.,Kolesnikov,A.,Weissenborn, D., Zhai, X., et al.: An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale. InternationalConferenceonLearningRepresentations (ICLR).(2021)

[3] Sandler,M.,Howard,A.,Zhu,M.,Zhmoginov,A.,Chen,L.: MobileNetV2: Inverted Residuals and Linear Bottlenecks.ProceedingsoftheIEEE/CVFConferenceon ComputerVisionandPatternRecognition(CVPR).45104520(2018)

[4] Hughes,D.P.,Salathé,M.:Anopenaccessrepositoryof images on plant health to enable the development of mobile disease diagnostics. arXiv preprint arXiv:1511.08060.(2015).

Turn static files into dynamic content formats.

Create a flipbook