학술

FPGA implementation and hardware–software co-optimization of a handcrafted-feature ANN pipeline for real-time potato leaf disease classification

PLOS ONE
CC BY
이 매체는 공공·자유 라이선스로 본문을 직접 표시합니다.

Figures
Abstract
Plant diseases pose a significant threat to global food security, reducing agricultural productivity and economic stability. Early and accurate diagnosis is crucial to mitigating these impacts, but conventional methods often rely on resource-intensive computations, making them impractical for deployment on edge devices with limited power and processing capabilities. This paper presents a Field Programmable Gate Array (FPGA) based real-time potato leaf disease identification system. The proposed approach integrates algorithmic simplifications with hardware-level optimizations to meet the stringent latency and power requirements of edge environments. Segmentation is performed along a single spatial dimension rather than two, reducing computational complexity while maintaining classification accuracy. Feature extraction leverages Local Binary Patterns (LBP) combined with color descriptors, and multiple feature combinations are empirically evaluated to determine the most effective set. A low-complexity artificial neural network (ANN) classifier is developed, achieving an average accuracy of 97.50%, outperforming prior approaches in both precision and efficiency. The inference engine is implemented on an FPGA-based System-on-Chip (SoC), where design strategies such as pixel-wise serial processing, approximation of computationally intensive functions, and pre-thresholding are employed to minimize area and energy consumption. A pipelined hardware architecture further enhances throughput, yielding a 7.2× improvement over non-pipelined design and sustaining a frame rate of 33.23 frames per second. Moreover, comparison with prior FPGA-based implementation shows an improvement in latency and throughput. This combined hardware-software co-optimization enables an accurate and real-time diagnosis of plant disease, making it a practical solution for agricultural application.
Citation: Ahmed J, Zaidi SAA (2026) FPGA implementation and hardware–software co-optimization of a handcrafted-feature ANN pipeline for real-time potato leaf disease classification. PLoS One 21(12): e0364096. https://doi.org/10.1371/journal.pone.0364096
Editor: Muhammad E. S. Elrabaa, King Fahd University of Petroleum & Minerals, SAUDI ARABIA
Received: May 22, 2026; Accepted: November 18, 2026; Published: December 3, 2026
Copyright: © 2026 Ahmed, Zaidi. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.
Data Availability: The data generated in this study have been attached. The following existing data sources were used: Mendeley Data, V1 available via doi: https://doi.org/10.6084/m9.figshare.34948846.
Funding: The author(s) received no specific funding for this work.
Competing interests: The authors have declared that no competing interests exist.
Introduction
Vegetables are an important part of human diet, providing essential nutrients such as vitamins and minerals. Plant diseases are a serious concern worldwide for crop damage and low production yields. According to the Food and Agriculture Organization, plant diseases cause a global agricultural production loss of up to 40% [1]. Moreover, due to the rapid increase in population and climate issues, there is a great need to take measures for the rapid growth, safety, and protection of plants. Modern technologies are emerging to ensure the health and safety of plants, resulting in high productivity and good-quality food.
In the last decade, computer vision-based Artificial Intelligence (AI) techniques have emerged strongly, significantly impacting various domains. These techniques are now widely deployed in applications such as autonomous vehicles, mobile devices, satellites, autonomous robots, and weather prediction stations. In agriculture, vision-based AI systems offer opportunities for automated crop inspection, disease identification, and crop-health monitoring [2–4]. Agricultural robots with vision-based sensing are increasingly being used for automatic field monitoring and disease detection, reducing reliance on manual labor [5,6]. Employing local inference on an edge device in these robots is preferred as compared to server-based processing to avoid dependence on network availability and reduce communication overhead. However, onboard computing shares the robot’s limited battery energy with other subsystems, including locomotion, sensing, and control, making power consumption an important consideration for sustained field operation. Consequently, deploying AI-based models on these platforms requires a careful balance between inference accuracy, processing speed, and power consumption to ensure real-time and reliable disease identification within the available computational and energy budgets. Field programmable gate arrays (FPGAs) are an excellent choice for energy-efficient and high throughput implementation of AI-based models.
Numerous researchers have explored plant disease identification and classification, with existing approaches broadly categorized into machine learning-based and deep learning-based methods. Machine learning techniques [7–10] often suffer from low accuracy or require extensive pre-processing and segmentation to achieve acceptable performance. In contrast, deep learning methods [11–16] generally deliver higher accuracy but come with significantly increased computational complexity. While much of the prior work has focused on improving accuracy, little attention has been paid to the computational demands of these algorithms.
Existing hardware implementations for plant disease identification have largely focused on deep neural networks, particularly CNNs [17,18], leaving limited exploration of computationally efficient conventional machine learning approaches for resource-constrained FPGA platforms. To address this gap, we propose a computationally efficient algorithm and high-throughput FPGA-based SoC implementation for real-time potato leaf disease identification. The proposed approach combines image preprocessing, clustering-based segmentation, and feature extraction using local binary patterns (LBP) and color bins. KNN, ANN, and SVM classifiers are evaluated with different feature combinations to determine the best-performing configuration. The complete algorithm is implemented on FPGA with algorithmic and hardware-level optimizations to reduce area and energy consumption while maintaining high throughput.
The main contributions of this work are listed as follows:
- A real-time potato leaf disease identification system has been developed for deployment on resource-constrained edge platforms, ensuring a balance between efficiency and accuracy. To optimize computational performance, segmentation is performed along a single spatial dimension instead of two, and feature extraction incorporates Local Binary Patterns (LBP) alongside color descriptors. This approach reduces computational complexity while preserving classification accuracy.
- A low-complexity artificial neural network (ANN) is designed, achieving an average accuracy of 97.50%, demonstrating superior precision and efficiency compared to existing models.
- The inference engine is implemented on an FPGA-based System-on-Chip (SoC) using several optimization strategies, including pixel-wise serial processing, approximation of complex mathematical functions, and pre-thresholding techniques, all of which contribute to reducing area and energy consumption.
- Further performance improvements are achieved through a pipelined hardware architecture, which increases throughput by a factor of 7.2 compared to non-pipelined design. The system maintains a real-time frame rate of 33.23 frames per second, making it suitable for efficient and accurate plant disease detection in edge computing environments.
- This work presents an improved and substantially enhanced version of the methodology reported in [19]. Although both studies involve potato leaf disease identification using a conventional machine learning method with RGB to CIE-LAB conversion, K-means based segmentation, handcrafted feature extraction, a conventional classifier and FPGA-based implementation, the present work extends the previous approach, at both algorithmic and hardware level, in several important aspects. In the proposed work, the segmentation is optimized by performing it on a single spatial domain instead of two dimensions, LBP and color features are used instead of GLCM, the number of extracted features are increased for providing a detailed representation of segmented region, and three classifiers are analyzed and compared for selecting the classifier which provides good trade-off between classification accuracy and hardware complexity. These optimizations resulted in improved accuracy as compared to [19] while maintaining reasonable computational complexity. The hardware architecture is redesigned and optimized for real-time implementation with a particular emphasis on computational efficiency, resource utilization and processing latency. A detailed comparison between the two works is presented in Table 1.
- The overall algorithm is also implemented on the ARM Cortex-A9 processor and evaluated it under the same experimental conditions as the FPGA implementation. The execution latency and FPS of both implementations have been measured and reported for direct performance comparison.
The rest of the paper is organized as follows. The Methodology section presents the proposed algorithm and methodology. The Hardware Implementation section describes the hardware design and implementation. The Results and Discussion section presents the experimental results and comparisons with previous works. Finally, the Conclusion section summarizes the main findings of this work.
Methodology
Overview
Fig 1 shows the proposed methodology for the detection and classification of potato leaf disease and its hardware acceleration for real-time implementation. A machine learning algorithm is proposed to accurately identify three classes of potato leaves: healthy, early blight, and late blight. Different optimizations are applied to reduce the computational complexity of the algorithm. The proposed algorithm consists of five main stages: image acquisition, preprocessing, segmentation, feature extraction, and classification. In the image acquisition stage, the potato leaf dataset is loaded. The dataset contains 1,800 RGB images belonging to three classes: healthy, early blight, and late blight. In the preprocessing stage, the RGB images are converted into the CIE-Lab color space through an intermediate RGB-to-XYZ transformation, followed by XYZ-to-CIE-Lab conversion using the D65 white point as the reference. The CIE-Lab color space separates lightness information from color information, facilitating the distinction between diseased and healthy leaf regions. The third stage is segmentation, where K-means clustering is applied initially to divide the image into two clusters, and the cluster corresponding to the diseased region is identified based on the distribution of CIE-Lab values. The background is subsequently removed, and shadow suppression is applied to minimize the effects of illumination variations. Finally, Otsu thresholding is used to binarize the CIE-Lab channels and obtain a cleaner representation of the region of interest. In the feature extraction stage, texture and color features are obtained from the segmented image. Texture features are extracted using Local Binary Pattern (LBP) histograms, while color features are extracted from histograms of the L, a, and b channels of the CIE-Lab image. After feature extraction, a total of 17 significant features are retained for classification. In the final classification stage, the selected features are supplied to a machine-learning classifier. The performance of three different classifiers is evaluated, and a classifier is selected for hardware realization based on its performance and computational complexity.
Proposed algorithm for potato leaf disease detection and classification and its hardware acceleration on FPGA for real-time computation.
Hardware implementation
The hardware implementation of the overall algorithm is shown in Fig 2. The Xilinx ZYNQ FPGA device and the VIVADO software tool have been used for the design and implementation. Xilinx ZYNQ series has a processing system (PS) that contains a dual-core ARM Cortex-A9 CPU and a programmable logic (PL) that contains FPGA fabric. The design is implemented using both PS and PL. The proposed architecture exploits the complementary capabilities of these two components. The PS is used for software-oriented tasks, such as communication with the external environment, image acquisition, result reporting, and high-level control, whereas the computationally intensive image-processing operations are implemented in the PL. This partition avoids using the programmable logic for relatively irregular communication and control tasks while allowing the pixel-level operations to exploit the parallelism and deterministic timing of dedicated hardware in PL. In addition, keeping external communication within the PS reduces unnecessary PL–PS data transfers during intermediate processing and allows the PL to operate largely independently once processing has been initiated. PS sends the received images and different control signals to PL through memory-mapped registers on the PL side to control hardware execution flow. Furthermore, it reads various status signals of PL through memory-mapped registers to know the status of execution of different hardware components.
Block diagram of the proposed algorithm’s hardware implementation on a Xilinx ZYNQ FPGA, featuring an ARM processing system (PS) and a programmable logic (PL) FPGA fabric.
The hardware implementation of the algorithm is done on the PL side. The hardware contains several BRAMs and ROMs, a PS to PL controller, a CIE-Lab Converter, a K-means clustering unit, a Feature extraction unit, and an Artificial Neural Network (ANN) engine. A Pipelined-based hardware implementation is done for CIE-Lab Converter and K-means clustering units because of their complexity and long datapath delay. This enables multiple pixels to be processed in different pipeline stages at the same time, hence improving the throughput of the hardware. As the image size is 224 x 224, i.e., 50176 pixels, the depth of all BRAMs is set to 50176 to accommodate pre-processing results on images. The PS to PL Controller contains the memory-mapped registers and is responsible for coordinating data transfer between the PS and the PL of the FPGA.
The memory width is tailored to the information stored in each BRAM, avoiding unnecessary storage overhead. The CIE-Lab Converter performs RGB-to-XYZ and XYZ-to-CIE-Lab transformations in a pipelined manner [21]. The three CIE-Lab components are compared against zero, and their binary comparison results are stored in the 3-bit-wide CIE-Lab BRAM. Since subsequent computations require only the CIE-a component, this component is stored separately in the CIE-a BRAM, avoiding unnecessary storage of unused data. In addition, pre-thresholding is applied to the RGB pixels and CIE-b component, as described in Steps 3 and 4 of Table 2. The resulting binary values are stored in the 1-bit-wide threshold BRAM. This application-specific memory organization reduces storage requirements and data movement while retaining the intermediate results needed by downstream processing stages.
For color feature computations, the bin numbers are extracted immediately when CIE-a and CIE-b are calculated. Each CIE-a and CIE-b component has 16 color bins. So, each bin can be represented using 4 bits. The CIE-Lab Converter block identifies the bins associated with CIE-a and CIE-b and stores them in CIE-ab color bins BRAM.
The K-means clustering process begins once the CIE-Lab Converter sets the done flag. It operates on the CIE-a channel by reading data from the CIE-a BRAM and performs five iterations to converge the cluster means. The resulting cluster IDs for each pixel are stored in the Cluster IDs BRAM. During clustering, it also accesses the Cluster IDs BRAM and Threshold BRAM. Upon completion, it updates the CIE-Lab BRAM and CIE-ab Color Bins BRAM. Next, the Feature Extraction block is triggered, which reads from both updated BRAMs to compute the required features. Finally, the ANN engine receives these features and performs the classification.
CIE-Lab converter.
CIE-Lab converter block transforms images from RGB to CIE-Lab color space using equations (1) to (5). Where the function f(t), used in Equations (3) to (5), is given in Equation (6). These equations are adopted from [21]. First, tri-stimulus XYZ is calculated from RGB using Equation (1) and (2). The constant term a = 0.055. After that, XYZ variables are converted into CIE-Lab by using Equations (3) to (6). The values of Xn = 95.047, Yn = 100.000, and Zn = 108.883 are given in the D65 white point, which is used as a reference for conversion. The RGB values are converted to XYZ on the normalized scale, where the D65 reference white is Xn = 0.95047, Yn = 1.00000, Zn = 1.08883.
(1)(2)(3)(4)(5)(6)The hardware implementation of the CIE-Lab converter is shown in Fig 3 and Fig 4, respectively. The non-linear computation in Equation (1) is implemented using ROM-based Lookup table, where the R, G and B component for pixel values 0–255 are stored in three lookup tables at corresponding addresses. The normalization and scaling are performed before applying the transfer function. The results of the lookup tables are passed to the pipelined data path for further processing. Three parallel datapath instances perform the computation of Equations (2) to (6) for R, G and B components, respectively. Each instance computes the matrix multiplications and summations of Equation (2) by using three floating point multipliers and two floating point adders. The X, Y and Z results from these matrix computations are passed to floating point dividers to obtain , , and . The datapath then computes the function f(x) given in Equation (6). The final conversion results of datapath are stored in the BRAMs.
Lookup table-based circuit for linearization of RGB values.
A pipelined hardware implementation of the CIE-LAB converter with an optimized implementation of the cubic root function using the Taylor series. The floating-point units are internally pipelined.
To reduce the complexity of the datapath, the cubic root function used in Equation (6) is approximated by expanding the Taylor series up to the fourth derivative term. The Taylor series expansion and its simplified version are given in Equations (7) and (8), respectively.
(7)(8)An analysis has been performed on the Taylor series approximation. It is observed that expanding the series up to the fourth derivative term matches closely with the original cubic function as shown in Fig 5. The difference between the original cubic-root function and its Taylor series approximation is evaluated and given in Table 3. The approximation is performed at four different points, and their ranges are defined by analyzing the experimental data. Four approximation points and their ranges are given in Table 4.
Original cubic root function (blue) and its Taylor series approximation (red).
Table 4 also shows the pre-calculated values of the five constants, termed as C0 to C4 in Equation (8), for four approximation points. These values are stored in an on-chip memory.
Hardware implementation of Equation (8) is given in Fig 4. Three comparators are used in each instance of the datapath to compare the results of X/Xn, Y/Yn, or Z/Zn with the starting ranges of Taylor series approximation points, i.e., 0.35, 0.08 and 0.01. Based on the results of comparisons, appropriate constants are selected. After the selection of appropriate constants, the hardware then computes the cubic root of x, given in Equation (8), at the selected approximation point x0.
Image segmentation using K-means clustering algorithm.
After preprocessing, image segmentation is performed, in which the RGB image and its corresponding CIE-Lab converted image are given as input. The steps performed in segmentation are given in Table 2. Initially, the K-means clustering algorithm is applied on CIE-a component to cluster the CIE-Lab image into two segments. The diseased segment is automatically selected by counting the number of pixels that are less than the threshold tha, for each segment. Background elimination is then applied on the diseased segment by setting each pixel to 0 whose CIE-b component is less than the threshold thbb. Subsequently, shadow suppression is performed by setting each pixel to 0 whose R, G and B components are less than the threshold value thrgb. In the end, binary masks for CIE-L, a and b are generated using the OTSU thresholding method [22], which are used for feature extraction.
The hardware implementation of K-means is illustrated in Fig 6, consisting of a pipelined datapath and a controller. K-means execution starts by first initializing cluster means C1 and C2 with random values. The controller then sequentially supplies CIE-a pixel values to the datapath, where their Euclidean distances from C1 and C2 are calculated using Equations (9) and (10), respectively. Each pixel is assigned to the cluster with the smaller distance, and its value is accumulated in the corresponding sum register, S1 and S2. After all pixels are processed, updated cluster means are calculated from the accumulated sums, and the iteration counter is incremented. This process is repeated for five iterations to provide convergence in a fixed and predictable manner. The required integer-to-floating-point conversions are implemented using the Int2f units shown in Fig 6.
Controller and datapath of K-means algorithm. The floating point units are internally pipelined.
Features extraction.
In this work, texture- and color-based features are targeted. First, normalized histograms of LBP have been calculated from the binarized version of the CIE-Lab image [23]. The dataset used in this work exhibits rotational variance; therefore, LBP-based texture features are extracted due to their robustness in detecting edges, lines, angles, and their inherent rotational invariance. A combination of both uniform and non-uniform patterns has been extracted using Equations (12) and (13).
(12)(13)Where P shows the total pixels in the neighborhood , and it is set to 8. R is the distance between the neighborhood pixels and the central pixel . The value of R is set to 5. Secondly, color-based features are used for extracting the color information of the ROI. As the diseased part has a specific color, these features are well-suited for classifying healthy leaves with a very high accuracy. For extracting color information, the histograms of CIE-L, a and b dimensions are calculated such that the size of each bin is set to (max – min) / M [8], Where M is set to 13, max is the maximum, and min is the minimum value taken by iterating over all the images of the dataset.
The Feature Extraction block extracts three color features and 14 LBP-based texture features using the data stored in the CIE-ab color bins BRAM and the binary data stored in CIE-Lab BRAM, respectively. The feature extraction block comprises of three FSMs, as shown in Fig 7.
Hardware implementation of feature extraction. Bottom two finite state machines (FSMs) are used for the calculation of features and the top FSM is used for the normalization of the features.
The LBP feature extraction FSM is triggered by the feature_start flag generated by the K-means Clustering unit. It sequentially generates the addresses of the central and neighboring elements, reads the corresponding BRAM values, and compares the neighboring elements with the central element to generate the LBP pattern (Fig 8). The generated patterns are then matched and counted to obtain the selected LBP features and their corresponding sums.
The second FSM extracts the color features from the histogram stored in the CIE-ab color bins BRAM. It sequentially reads the histogram bins, counts the required bins, and computes the corresponding squared sums of the CIE-a and CIE-b components.
The outputs of the LBP and color-feature extraction FSMs are subsequently processed by the third FSM for normalization. The normalization FSM converts the required sums to floating-point values, computes their square roots, and divides the extracted features by the corresponding normalization values.
Hardware implementation of classifier.
After statistical analysis, a total of 17 features were selected for classification. It includes a combination of color and texture features. These features are given as input to the classifier. Three classification algorithms were analyzed with different hyperparameters, which are discussed below:
- KNN is a supervised learning algorithm. KNN works on the distance between the trained and test sample features. It classifies the data by choosing K-neighbors that have a minimum distance from the test sample. In this implementation, we have used Manhattan distance for nearest neighbor calculation. The value of parameter K is set to 1, 3, 5, 7, and 9 and the performance is measured on each value of K.
- ANN is widely used in AI applications. It has various hyper parameters and layers, which vary from application to application. We devised and proposed the ANN in this work with two hidden layers. There are 60 neurons in the first and 20 in the second hidden layer. Also, it has 17 input nodes and 3 output nodes. Table 5 summarizes the ANN architecture and its training parameters.
- SVM is also widely used in machine learning. It creates hyperplanes by transferring the data to higher dimensions and then classifying them. We have used the Radial Basis Function (RBF) as the kernel.
ANN has been selected for hardware implementation due to its higher classification accuracy and lower computational complexity compared to KNN and SVM classifiers. Unlike KNN, which requires storing the entire training dataset and demands large on-chip memory, or SVM, which involves non-linear functions and a large value of gamma creates a more complex decision boundary resulting in high computational complexity, ANN offers a more efficient and hardware-friendly solution. An overall comparison between complexity and accuracy of all three classifiers is given in Table 6. Where is the number of support vectors, N is the number of training samples, and D is the number of input features.
The hardware implementation of the ANN classifier consists of a datapath and a controller, which are shown in Fig 9 and Fig 10, respectively. We have implemented a fixed-point neural network to improve area, latency, and power. Two N.M fixed point formats are considered, 11.19 and 21.38, where N is the number of integer bits and M is the number of fractional bits. 11.19 format is used for multiplication, while the 21.38 format is used for addition. The datapath comprises a 59-bit signed integer adder and a 30-bit signed integer multiplier. All weights and biases are converted into a 30-bit and 59-bit fixed-point format, respectively, and stored on the chip to be used directly for multiplication and addition. The features are converted from floating-point format to 30-bit fixed-point format, using the converter module shown in Fig 11, before being passed to the input layer of ANN engine. Two counters manage the selection of inputs, weights and biases: the input counter iterates over inputs, while the NN counter cycles through neurons in each layer. Each neuron is computed sequentially using shared hardware resources. A multiplexer implements the ReLU function by checking the most significant bit of the multiplier output: if set, the output is zero. Additional multiplexers handle the selection of weights, biases, and input values.
ANN structure with float to integer units at input for fixed point implementation.
The control unit has 16 states, five for each layer. The five states corresponding to a particular layer perform the following operations: 1) the selection inputs for the multiplexers to select inputs, bias, and weights for that layer, 2) wait for the completion of the operation of a single neuron, and 3) repeat this process for all neurons.
Results and discussion
The proposed algorithm is developed in MATLAB and Python and the hardware implementation is done in Xilinx VIVADO software. For training and inference, we have used the Python scikit-learn library. MATLAB is used for pre-processing, segmentation and feature extraction. Intel(R) Core(TM) i5-1035G1 CPU with an 8 GB RAM is used for development.
We focused on disease identification and classification of potato leaves using the dataset published by Arun Pandian et al [20], which includes three classes: healthy, early blight, and late blight. The RGB images are uniformly resized to 224224 pixels. Captured under varying lighting conditions, the dataset exhibits natural variations such as brightness differences, background shadows, and off-center alignment, making it well-suited for developing a realistic classification model. Representative samples of each class are shown in Fig 12. An 80/20 split is used for training and testing. The total number of images per class, along with their distribution across training and testing sets, is provided in Table 7.
Sample images of each class in the potato leaves dataset [20]. (a) Healthy, (b) early blight and (c) late blight.
Segmentation and performance evaluation
An example of segmented image for each class of potato leaves is shown in Fig 13. Fig 13 (c) and (e) show two segments that are generated after the application of the k-means clustering algorithm. The segment shown in Fig 13 (g) represents the final result after the segmentation algorithm has completed.
(a) Original RBG Image of healthy, Early blight and Late blight. (b) Corresponding CIE-Lab conversion. (c-f) K-means clustering output: (c) first segment in RGB format, (d) first segment in CIE-Lab format, (e) second segment in RGB format, (f) second segment in CIE-Lab format. (g) Segmentation output after background elimination and shadow suppression.
The segmentation performance is evaluated by calculating the area of intersection over area of union (IoU) given in Equation (14), where the numerator denotes the intersection of the diseased part areas in the ground truth image and the segmented image and the denominator shows the union of diseased part areas in both images. Fig 14 shows an example of the original image, the ground truth image and the segmented image of each class. The average segmentation accuracy is 80% and 83% for Early blight and Late blight diseases, respectively.
(a) Original image, (b) Ground truth and (c) Segmented image.
Classifiers performance evaluation
Classifier’s performance results are given in Table 8. For the KNN classifier, the value of parameter K is varied from 1 to 9 and the accuracies of all odd values of K have been calculated. 10-fold cross-validation was used to evaluate different values of K, and the final model with K = 1 achieved 92.77% accuracy on the 80/20 split. Fig 15 shows that the lowest error is achieved for K equal to 1.
Table 8 shows the accuracies for all three classifiers. Accuracy is calculated by dividing the total true predicted samples by the total input samples. We repeated the experiments using 10-fold stratified cross-validation with 10 different random seeds, resulting in 100 independent ANN validation runs. A new ANN was trained independently for each fold. ANN achieved a mean accuracy of 97.47% ± 1.11% across the 100 validation runs, with a corresponding mean error of 2.53% ± 1.14%. The 1.14% is the error standard deviation. All three classifiers predicted Early blight and Healthy classes very accurately, but some false predictions have been made in the case of the Late blight class by the KNN and SVM classifiers. The reason is that the Late blight disease spectrum is sometimes too prominent and spreads over the leaf, so it may be predicted as the Early blight class. Confusion matrices of all classifiers are given in Fig 16. It is noted that ANN performed very well when predicting Late blight class, whereas KNN and SVM performance is low in this case.
ANN performance is further evaluated on three different metrics: precision, recall and F1-score given in Table 9. It can be seen that Late blight precision is 96.10% and Healthy precision is 96.95% while the precision of Early blight is 99.16%. It means that, ANN predicted some false positive samples as Healthy and Late blight. It is also noted that the recall measure of the Late blight class is low while the Healthy and Late blight classes are high. It means ANN is miss-classifying some Late blight samples.
Table 10 shows the performance comparison of the proposed algorithm with state-of-the-art methods. The proposed algorithm outperforms existing methods in terms of accuracy. The methodology used by Chaojun Hou et al [8] is similar to our work, however, they proposed a complex segmentation algorithm, which also results in a high complexity of the overall algorithm. In this work, a simple and efficient segmentation algorithm is proposed along with the use of reduced complexity classifiers to reduce the overall computational complexity and achieve the best overall accuracy.
Hardware implementation results
The entire hardware implementation is done on the Xilinx ZYNQ XZ7020 FPGA. The PS runs at a clock frequency of 666.67 MHz. The hardware implemented on the PL side operates at a clock frequency of 125 MHz. The clock frequency is selected after performing the timing analysis on the hardware. The latency of both non-pipelined and pipelined implementations of different components is shown in Table 11. Due to the proposed optimizations at the algorithmic and hardware level and a pipelined hardware implementation, we are able to achieve a total latency of 30.093 ms, giving a frame rate of 33.23 FPS. The pipelined implementation achieves 7x less latency as compared to non-pipelined implementation. Also, experimental analysis confirmed that the hardware accuracy is exactly the same as software accuracy.
The results of the execution of the hardware implementation are compared with the implementation based on C in the ARM-Cortex A9 processor and are given in Table 12. It shows execution latency across all processing stages. The software-based C implementation yields a total processing time of 1135.123 ms (translating to a low throughput of 0.88 FPS), the pipelined FPGA architecture drastically reduces the total latency to just 30.093 ms. This performance boost enables a throughput of 33.23 FPS, making the hardware accelerator well-suited for high-speed image processing and embedded machine learning applications.
The results of the area utilization of the proposed hardware are given in Table 13. It is worth mentioning here that despite the implementation of the whole algorithm on the PL side of the FPGA and the use of a low-end FPGA device, the total usage of Lookup tables (LUTs) and flip-flops (FFs) is around 71% and 52%, respectively. The BRAM usage is also low due to the application of pre-thresholding on each pixel. In addition to this, DSP blocks are still available that can be used to further accelerate the computations.
The power analysis has been done by setting the environmental temperature conditions to C with no heat sink. The obtained results are shown in Fig 17. It shows the static and dynamic power consumption of both PL and PS. The total on-chip power consumption is 2.564 W. The static power consumption is 0.181W (7%), while the dynamic power consumption is 2.383W (93%). The majority of the dynamic power is consumed by the PS, which is 1.530 W (64%). The PL dynamic power consumption is still very low compared to PS.
Power analysis of the implemented algorithm on PS and PL in Xilinx ZYNQ XZ7020 FPGA.
Table 14 shows the performance comparison of proposed pipelined hardware implementation with existing FPGA-based plant disease identification systems. The proposed implementation outperforms prior FPGA-based lighweight CNN and conventional machine learning algorithm implementations in terms of latency and throughput, achieving higher throughput, making it well-suited for real-time plant disease identification on edge platforms.
Conclusion
This study presents the design and implementation of a complete FPGA-based system for real-time identification of plant diseases, with a specific focus on potato crops. A machine learning algorithm was developed and evaluated using three classifiers—K-Nearest Neighbors (KNN), Support Vector Machine (SVM), and Artificial Neural Network (ANN)—in combination with various sets of image-derived features. Among the tested models, the ANN classifier demonstrated the highest performance, achieving an accuracy of 97.50%, and surpassing both KNN and SVM in terms of both accuracy and computational efficiency. The algorithmic deployment was performed on a Xilinx Zynq XC7Z020 SoC, where a pixel-wise, serial pipelined hardware architecture was implemented to meet real-time constraints while optimizing resource usage. Additional architectural refinements were applied to minimize area and power consumption. The final implementation utilized 71% of the available LUTs, 67% of DSP slices, 52% of flip-flops, and 46% of BRAM resources, achieving a processing throughput of 33.23 frames per second. These results validate the feasibility of implementing the evaluated pipeline on a Zynq FPGA for images drawn from the studied dataset.
Supporting information
S1 Fig. Healthy leaf.
Original healthy potato leaf image used for IoU analysis.
https://doi.org/10.1371/journal.pone.0364096.s001
(TIF)
S2 Fig. Healthy ground-truth image.
Augmented ground-truth image used as the reference for IoU analysis of the healthy leaf.
https://doi.org/10.1371/journal.pone.0364096.s002
(TIF)
S3 Fig. Healthy segmented image.
Segmentation result generated by the proposed algorithm for IoU analysis of the healthy leaf.
https://doi.org/10.1371/journal.pone.0364096.s003
(TIF)
S4 Fig. Early blight leaf.
Original early blight-affected potato leaf image used for IoU analysis.
https://doi.org/10.1371/journal.pone.0364096.s004
(TIF)
S5 Fig. Early blight ground-truth image.
Augmented ground-truth image used as the reference for IoU analysis of the early blight-affected leaf.
https://doi.org/10.1371/journal.pone.0364096.s005
(TIF)
S6 Fig. Early blight segmented image.
Segmentation result generated by the proposed algorithm for IoU analysis of the early blight-affected leaf.
https://doi.org/10.1371/journal.pone.0364096.s006
(TIF)
S7 Fig. Late blight leaf.
Original late blight-affected potato leaf image used for IoU analysis.
https://doi.org/10.1371/journal.pone.0364096.s007
(TIF)
S8 Fig. Late blight ground-truth image.
Augmented ground-truth image used as the reference for IoU analysis of the late blight-affected leaf.
https://doi.org/10.1371/journal.pone.0364096.s008
(TIF)
S9 Fig. Late blight segmented image.
Segmentation result generated by the proposed algorithm for IoU analysis of the late blight-affected leaf.
https://doi.org/10.1371/journal.pone.0364096.s009
(TIF)
S10 Fig. ANN loss curve.
Training loss curve illustrating the variation in loss over successive training iterations of the ANN.
https://doi.org/10.1371/journal.pone.0364096.s010
(TIF)
References
- 1. Fenu G, Malloci FM. Forecasting Plant and Crop Disease: An Explorative Study on Current Algorithms. Big Data Cogn Comput. 2021;5(1):2.
- 2. Crupi L, Butera L, Ferrante A, Giusti A, Palossi D. An efficient ground-aerial transportation system for pest control enabled by AI-based autonomous nano-UAVs. ACM J Auton Transport Syst. 2025.
- 3. Khan A, Malebary SJ, Dang LM, Binzagr F, Song H-K, Moon H. AI-Enabled Crop Management Framework for Pest Detection Using Visual Sensor Data. Plants (Basel). 2024;13(5):653. pmid:38475499
- 4. Chin R, Catal C, Kassahun A. Plant disease detection using drones in precision agriculture. Precision Agric. 2023;24(5):1663–82.
- 5. Yamasaki Y, Morie M, Noguchi N. Development of a high-accuracy autonomous sensing system for a field scouting robot. Comput Electron Agric. 2022;193:106630.
- 6. Singh C, Randhawa GS, Farooque AA, Gill YS, Fraser A, Lokesh Kumar KM, et al. AgriScout: AI-powered robot for precise detection of PVY-infected potato plants. Comput Electron Agric. 2025;238:110781.
- 7. Radwan M, Alhussan AA, Ibrahim A, Tawfeek SM. Potato leaf disease classification using optimized machine learning models and feature selection techniques. Potato Res. 2024;:1–25.
- 8. Hou C, Zhuang J, Tang Y, He Y, Miao A, Huang H, et al. Recognition of early blight and late blight diseases on potato leaves based on graph cut segmentation. J Agric Food Res. 2021;5:100154.
- 9. Luna-Benoso B, Martínez-Perales JC, Cortés-Galicia J, Flores-Carapia R, Silva-García VM. Detection of Diseases in Tomato Leaves by Color Analysis. Electronics. 2021;10(9):1055.
- 10. Akram T, Naqvi SR, Haider SA, Kamran M. Towards real-time crops surveillance for disease classification: exploiting parallelism in computer vision. Comput Electr Eng. 2017;59:15–26.
- 11. Ghosh H, Rahat IS, Emon MdMR, Mashrafi MdJ, Al Arafat Tanzin MA, Mohanty SN, et al. Advanced neural network architectures for tomato leaf disease diagnosis in precision agriculture. Discov Sustain. 2025;6(1).
- 12. Catal Reis H, Turk V. Potato leaf disease detection with a novel deep learning model based on depthwise separable convolution and transformer networks. Eng Appl Artif Intell. 2024;133:108307.
- 13. Chakraborty KK, Mukherjee R, Chakroborty C, Bora K. Automated recognition of optical image based potato leaf blight diseases using deep learning. Physiol Mol Plant Pathol. 2022;117:101781.
- 14. Khalid M, Sarfraz M, Iqbal U, Aftab M, Niedbała G, Rauf H. Real-Time Plant Health Detection Using Deep Convolutional Neural Networks. Agriculture. 2023;13(2):510.
- 15. Luo Y, Cai X, Qi J, Guo D, Che W. FPGA–accelerated CNN for real-time plant disease identification. Comput Electron Agric. 2023;207:107715.
- 16. Chen D, Li D, Zheng J, Cai Y, Wu K, Huang X, et al. FPGA-based Mb2DKDNet for field disease and pest diagnosis. Smart Agric Technol. 2025;12:101516.
- 17. Wen H, Li C, Wang X, Chen L. Software and hardware synergy for accelerated plant disease identification. Appl Soft Comput. 2025;174:112926.
- 18. Perumal VK, T S, P R S, S D. CNN based plant disease identification using PYNQ FPGA. Syst Soft Comput. 2024;6:200088.
- 19. Ahmed J, Zaidi SAA, Aziz S, Rashid A, Haider S. Real time vision-based implementation of plant disease identification system on FPGA. Mehran Univ Res J Eng Technol. 2023;42(2):19.
- 20.
Mendeley Dataset: Potato Plant Disease. https://doi.org/10.6084/m9.figshare.34948846
- 21.
Hassan M, Bhagvati C. Optimal Color Palette for Error Diffusion Techniques. In: Proceedings of the Fourth International Conference on Signal and Image Processing 2012 (ICSIP 2012). Springer; 2013. p. 183–91.
- 22. Liao PS, Chen TS, Chung PC, et al. A fast algorithm for multilevel thresholding. J Inf Sci Eng. 2001;17(5):713–27.
- 23. Ojala T, Pietikainen M, Maenpaa T. Multiresolution gray-scale and rotation invariant texture classification with local binary patterns. IEEE Trans Pattern Anal Machine Intell. 2002;24(7):971–87.
- 24.
Iqbal MA, Talukder KH. Detection of potato disease using image segmentation and machine learning. In: 2020 International Conference on Wireless Communications Signal Processing and Networking (WiSPNET). IEEE; 2020. p. 43–7.
- 25. Singh V, Misra AK. Detection of plant leaf diseases using image segmentation and soft computing techniques. Inform Process Agric. 2017;4(1):41–9.

관련 뉴스