Skip to main content
Plant Phenomics logoLink to Plant Phenomics
. 2025 Sep 18;8(2):100110. doi: 10.1016/j.plaphe.2025.100110

Edge computing-based computer vision and deep transfer learning for high-throughput assessment of Aspergillus flavus infection in crop seeds

Libin Wu a,c,e, Liangliang Zhu b, Haiyong Weng d, Guoping Chen f, Hongfei Liu g, Yande Liu a,, Dapeng Ye d,⁎⁎
PMCID: PMC13316237  PMID: 42382237

Abstract

Manual assessment of toxic fungal infection levels in crop seeds is important for developing antifungal-resistant cultivars, yet it has long been recognized as health-risking and inherently subjective. This study presents an edge computing-based computer vision approach for high-throughput on-site assessment and quantification of Aspergillus flavus infection in crop seeds. The edge computing-based computer vision approach, termed Edge CV, was developed using the Jetson Nano, embedded cameras, and deployed with the proposed Edge CV model to enable intelligent evaluation with constrained computing resources and GPU power. The Edge CV model: First, leveraging semantic segmentation in computer vision tasks to differentiate between A. flavus-infected and uninfected; Second, utilizing post-processing techniques to accurately separate connected peanut seeds while merging segments belonging to the same ones; Third, analyzing and quantifying infection indices, as well as results presentation. Finally, deep transfer learning was employed to validate the model's transferability for other crop seeds. As a result, Edge CV inference showed agreement with manual measurements (R2 = 0.901, RMSE = 0.07) and superior consistency, with only a 0.01 % fluctuation compared to 4.2 % for human assessments. Moreover, Edge CV demonstrated its transferability to other crop seeds, such as maize (R2 = 0.968, RMSE = 0.13) and rice (R2 = 0.949, RMSE = 0.26). These results underscore the potential of Edge CV as a transferable solution for assessing toxic fungal infections. The approach developed also offers valuable insights for enhancing proximal machine vision, improving the distinction of adjacent seeds, and enabling more accurate calculation of the infection index.

Keywords: Edge computing, Computer vision, Deep transfer learning, Aspergillus flavus, Crop seeds

1. Introduction

Crop seeds, especially oil seeds and staple seeds such as peanuts (Arachis hypogaea), maize (Zea mays), and rice (Oryza sativa), are vital human food resources. These crops play a crucial role in sustaining the global food supply. However, they are highly susceptible to infection by Aspergillus flavus (A. flavus), which tends to produce toxic carcinogenic and mutagenic aflatoxins [1,2]. In response, researchers and breeders are working to develop A. flavus-resistant cultivars [[3], [4], [5]], necessitating accurate and rapid quantification of infection statuses to evaluate their resistance levels [[6], [7], [8]]. However, current methods predominantly depend on subjective manual inspections, which not only lack objectivity but also pose significant safety concerns by exposing individuals to potential health risks associated with A. flavus airborne spores through inhalation and direct contact [9]. This underscores the pressing need to implement intelligent computer vision evaluation methods to accurately quantify the status of seeds’ toxic fungal infections.

Computer vision allows machines to interpret and analyze image data, making it highly suitable for intelligent surveillance across diverse applications [10,11]. However, conventional implementations often demand significant computational resources to perform high-resolution analysis, particularly when processing long-distance or high-definition video streams. This high resource requirement limits their feasibility for real-time, on-site monitoring. To address this challenge, edge computing-based computer vision has emerged as a promising solution. Edge computing refers to processing data at or near its source, thereby minimizing the need for transmitting large volumes to centralized cloud servers for analysis, storage, and decision-making [[12], [13], [14]]. This paradigm enhances computer vision by enabling rapid, localized processing on devices, without heavy reliance on remote infrastructure [[15], [16], [17], [18], [19]]. The outcome is faster decision-making, improved security, reduced latency, and lower bandwidth consumption [[20], [21], [22]].

As a result, edge computing-driven computer vision has found extensive application in fields that demand high responsiveness and robust security, including robotics [23,24], autonomous vehicles [25], and video surveillance [26,27]. For peanuts, a large number of studies focused on utilizing technologies such as computer vision [28], hyperspectral imaging, Raman spectroscopy [29], and Fourier transform infrared spectroscopy [30,31] have been extensively investigated as tools for the detection or classification of mycotoxins and toxigenic fungal contaminants [32]. Nonetheless, tailored edge computing-based computer vision systems need to be developed for the on-site quantification of toxic fungal infections in seeds post-harvest. Additionally, these systems should exhibit adaptability, allowing them to be transferred to different types of crop seeds with similar detection objectives.

To this end, the objectives of this study were threefold. First, to develop an edge computing-based computer vision model for precise and efficient quantification of fungal infection levels, incorporating improved segmentation algorithms and enhanced post-processing techniques. Second, to apply deep transfer learning methodologies, testing the system's adaptability and effectiveness across different crop seeds, such as maize and rice. Third, to optimize the edge computing model for lightweight deployment on embedded edge computing platforms, enabling real-time fungal infection assessments with minimal power consumption, making it suitable for on-site applications. Overall, the proposed edge computing-based computer vision approach provides a robust framework for implementing real-time vision tasks directly at the edge, enhancing its practical use in agricultural environments. This approach addresses the critical need for efficient, objective, and safe evaluation of toxic fungal infections and supports high-throughput phenotyping in breeding programs.

2. Materials and methods

2.1. Materials preparation

In this study, Aspergillus flavus (A. flavus) was provided by the Oil Crops Research Institute, Fujian Agriculture and Forestry University. The fungal isolates were cultured on Potato Dextrose Agar (PDA) medium, prepared using 200 g of potato, 20 g of dextrose, 15 g of agar, and water up to 1 L. Cultures were grown in 100 mL flasks at 28 °C for one week. A spore suspension of A. flavus was prepared in a 0.01 % Tween 20 solution, and the spore concentration was diluted to 1.9 × 106 conidia mL−1 before being used to inoculate peanut seeds. Peanut seeds were selected as the primary data source for initial model training, while maize and rice seeds were utilized for transfer learning. Seeds from five peanut cultivars—M16, XHXL, GH65, LH29, and YY92—were chosen due to their variations in infection levels, physical colors, and sizes. For objective and impartial experimental analysis, these cultivars were labeled as Seeds A, B, C, D, and E. Maize and rice seeds were purchased from a local supermarket and served as additional data sources for transfer learning experiments.

The inoculation protocol involved several key steps. First, seeds were selected with intact seed coats and no visible damage or pest infestations. Place the seeds into pre-perforated zip-lock bags labeled accordingly. Seeds in each variety were divided into 3 receipts, thus a total of 3 × 5 = 15 groups. Second, surface sterilization was performed by immersing the seeds in 70 % ethanol for 2 min, followed by three rinses with sterile water. Ensure the entire sterilization process is completed within 13 min. Then, remove excess water, maintaining a seed moisture content of approximately 20 %, which is optimal for A. flavus growth. Third, inoculation was carried out by adding 800 μL of A. flavus spore suspension to each Petri dish. Cover the dish and gently shake to ensure even contact of the spore suspension with the surface of each seed. Continuously shake the spore suspension during inoculation to prevent sedimentation and ensure consistent inoculum. Fourth, cultivation involved incubating the dishes in a dark environment at 28 °C for 7 days following inoculation.

2.2. Datasets preparation

A dataset of peanut seeds infected by A. flavus was curated for initial model training. Images were collected every 24 h following inoculation, using a diverse set of imaging devices to enhance dataset variability. The image acquisition setup included embedded cameras (Raspberry Pi Camera Module V2.0), a digital camera (Nikon Coolpix B700), and a smartphone (Apple iPhone 15), each capturing data under varied conditions and perspectives. The embedded cameras, mounted on a two-degree-of-freedom servo system, were controlled via a customized graphical user interface (GUI) for automated image capture. The Nikon Coolpix B700 recorded images and videos at 1920 × 1080 resolution and 30 frames per second (FPS). The iPhone 15 captured data under natural lighting. Still images were taken at 1-min intervals, while videos—recorded in 10-min sessions—were later converted into still frames to enrich the dataset. The dataset comprises 630 images containing 4951 peanut seeds. It was utilized for instance segmentation. Images were annotated in Roboflow, resized to 640 × 640 pixels, and augmented using grayscale conversion, brightness adjustment, and blurring to improve model generalization, expanding the dataset to 7356 images. The dataset was split into training, testing, and validation sets at an 8:1:1 ratio and exported in the appropriate format for model training. Similarly, datasets for maize (110 images of 315 seeds) and rice (140 images of 525 seeds) were prepared for transfer learning.

Manual assessment of seeds A. flavus infection level was conducted either through direct visualization at each time point or by capturing images. The images were then individually evaluated by researchers to calculate the infection areas and the number of infected and uninfected seeds. Then the infection level was recorded and quantified. Each seed infection level was graded according to the method described by Mehan et al. [33]: Grade 0: No visible Aspergillus flavus spores or mycelium on the seeds. Grade 1: 0–10 % of the seed surface is covered by Aspergillus flavus spores and mycelium. Grade 2: 10–20 % of the seed surface covered. Grade 3: 20–50 % of the seed surface covered. Grade 4: 50–80 % of the seed surface covered. Grade 5: 80–100 % of the seed surface covered. The infection index was calculated using the following Eq. (1):

Iindex=0.1N1+0.2N2+0.5N3+0.8N4+N5N×100% (1)

N1, N2, N3, N4, and N5 represent the number of seeds in each infection grade, and N is the total number of seeds per dish. Peanut seed resistance levels were determined based on infection grades and the relative number of infected seeds [34,35]: Highly Resistant (HR): No visible infection by A. flavus. Resistant (R): Infection Index 0–10 %. Moderately Resistant (MR): Infection Index 10–25 %. Moderately Susceptible (MS): Infection Index 25–50 %. Susceptible (S): Infection Index 50–75 %. Highly Susceptible (HS): Infection Index >75 %.

2.3. Edge computing-based computer vision model construction

Deep learning models enable edge computing devices to perform intelligent tasks [36]. The Edge CV model was constructed based on the structure of CSPNet (Cross-Stage Partial Networks) and E-ELAN (Efficient Layer Aggregation Networks) [37,38]. It incorporated backbone improvements for enhanced segmentation tasks and post-processing modifications to ensure accurate infection index calculation. Detailed information is provided below.

2.3.1. Backbone improved for enhancement segmentation

The final layers were adjusted to incorporate a segmentation head, enabling precise pixel-level classification of input images. Moreover, CBAM (Convolutional Block Attention Module) was incorporated to reduce model complexity and enhance the extraction of informative cross-channel and spatial features [39]. CBAM comprises two sequential sub-modules: the Channel Attention Module (CAM) and the Spatial Attention Module (SAM), as illustrated in Fig. 1. The CAM utilizes both max-pooling and average-pooling operations, whose outputs are processed through a shared Multi-Layer Perceptron (MLP). This MLP captures channel-wise dependencies, enabling the model to adaptively emphasize relevant features. The SAM applies max-pooling and average-pooling along the channel axis, followed by a convolutional layer to refine spatial feature selection. The mathematical formulations for channel and spatial attention mechanisms are presented in Eq. (2) and Eq. (3), respectively.

Mc(F)=σ(MLP(AvgPool(F))+MLP(MaxPool(F))) (2)
MS(F)=σ(f7×7(AvgPool(F)),MaxPool(F)) (3)

In the equations, σ denotes the sigmoid activation function, MLP refers to the Multi-Layer Perceptron, and f7×7 represents a convolution operation with a 7 × 7 filter size. These two modules—CAM and SAM—can be structured either in a parallel or sequential manner. Experimental results demonstrate that a sequential arrangement achieves superior performance. By applying channel and spatial attention sequentially. CBAM sequentially applies channel and spatial attention to regulate information flow, enhancing important features while suppressing irrelevant ones.

Fig. 1.

Fig. 1

The architecture of CBAM (Convolutional Block Attention Module), and its constituent modules CAM (Channel Attention Module) and SAM (Spatial Attention Module.

2.3.2. Post-processing techniques for assessment of A. flavus infection index

After segmentation, challenges often arise when molded and unmolded areas of the same seed are mistakenly identified as separate seeds, leading to inaccuracies in the calculation of the infection index. Other challenges include adjacent seeds being recognized as a single seed, further complicating the accurate calculation of the infection index. To address these issues, improved post-processing techniques are employed to effectively separate closely connected seeds and ensure precise infection index evaluation. Distance Transform, Local Maxima Detection, and the Watershed Algorithm were applied to quantify infected seeds and evaluate the infection index.

The Distance Transform: The Distance Transform calculates the Euclidean distance from each pixel of an object to the nearest background pixel. This is useful for analyzing the proximity of each pixel to the background and identifying the shapes of objects within the image. The Euclidean distance is given by Eq. (4).

D(x,y)=min(xb,yb)Background(xxb)2+(yyb)2 (4)

Here, (x,y) are the coordinates of the pixel for which the distance is being calculated, (xb,yb) are the coordinates of a background pixel. Computes the Euclidean distance from each pixel to the nearest background pixel, aiding in overlapping region detection.

Local Maxima Detection: Once the Distance Transform is applied to the image, local maxima can be identified. These maxima represent points of high distance from the background and can correspond to the centers of objects in the image. Uses these local maxima as markers to segment the binary mask into distinct components. Local Maxima Detection checks whether the value at a given pixel is greater than its neighbors. Mathematically:

D(x,y)>D(x,y)(x,y)N(x,y) (5)

Here, D(x,y) is the value of the Distance Transform at the pixel (x,y). N(x,y) represents the set of neighboring pixels around (x,y).

Watershed Algorithm: The Watershed Algorithm is used for segmenting an image by treating the local maxima as markers that define the boundaries between different regions. The watershed algorithm essentially simulates the flooding of the image from these markers, with boundaries forming between regions based on the topology of the gradient. The gradient is given by Eq. (6):

I(x,y)>(Ix,Iy) (6)

Where Ix and Iy are the partial derivatives of the image with respect to the horizontal and vertical axes, respectively. Once the gradient image and the local maxima are determined, the watershed algorithm is applied to the gradient map, with the local maxima acting as markers. The watershed algorithm works by flooding the image from these markers and growing regions until the boundaries meet. This operation ensures that the image is divided into distinct regions, each corresponding to a local maximum or the area around it. The boundaries between regions are formed where the gradient values change significantly. The equation for the watershed segmentation process is as Eq. (7):

Iwatershed_Segmentaion=WT(I,LMM) (7)

Where the WT represents watershed transform, which is applied to the gradient I using the LMM (local maxima markers) to separate the regions. This combination of techniques forms a powerful post-processing pipeline for object segmentation, especially in complex and overlapped regions. In all, the architecture of the Edge CV model is shown in Fig. 2, which includes an enhanced backbone and post-processing techniques, both highlighted in red boxes.

Fig. 2.

Fig. 2

Architecture of the Edge CV Model, incorporating the enhanced backbone module CBAM and post-processing techniques, highlighted within the red boxes.

2.3.3. Deep transfer learning for assessment in other crop seeds

Deep transfer learning is a machine learning approach where a model trained for one task is repurposed as the foundation for another related task. Deep transfer learning leverages the weights from a pre-trained network to accelerate and enhance the model's adaptability. In this study, the pre-trained model initially developed from a peanut seed dataset was utilized and extended to other seed types (maize and rice) that share similar objectives in image segmentation and fungal infection detection, as shown in Fig. 3. By using the pre-trained model as a starting point, the approach capitalized on previously learned features, significantly reducing the computational effort and training time required for new tasks. Lower layers of the model, which capture fundamental features such as edges and textures, were frozen to retain the knowledge from the initial training, while higher layers were adjusted to adapt to the segmentation of new seed types.

Fig. 3.

Fig. 3

The procedure for initial model training on the peanut dataset and subsequent transfer learning to assess Aspergillus flavus infection in maize and rice seeds.

2.3.4. Experiment configuration

The model was trained on a workstation equipped with an Intel CORE i9-10940X CPU @ 3.30 GHz processor, an NVIDIA RTX A4050 GPU, 64 GB of 64-bit DIMM RAM, and running the Windows 10 Professional 64-bit operating system. The primary libraries utilized included Python 3.11, PyTorch, and OpenCV, among others. During training, a learning rate of 0.001 was adopted with a batch size of 16. To reduce the risk of overfitting, a dropout rate of 0.5 was implemented. Images were resized to 640x640 pixels to conform to the format requirements.

To assess the performance of the segmentation model, segmentation-specific metrics were employed. The Intersection over Union (IoU) metric measured the overlap between the predicted segmentation mask and the ground truth, providing an evaluation of the model's precision. During training, loss was monitored to evaluate the effectiveness of the model's learning process. Fine-tuning and hyperparameter optimization were implemented to enhance the model's performance. Fine-tuning involved gradually unfreezing additional layers of the model and training them with lower learning rates, enabling more precise adjustments for improved accuracy.

2.4. Edge computing-based computer vision platform development

The Edge CV platform integrates both hardware and software components. Its hardware framework consists of an edge computing unit, storage and boot system, image sensing module, and wireless communication module. The NVIDIA Jetson Nano 4 GB board was selected for edge computing, utilizing its 128-core Maxwell GPU for parallel processing. CSI cameras were integrated for their reliability and optimal balance between data acquisition efficiency and compact design. A 128 GB microSD card served as the primary storage and boot medium. Wireless connectivity was enabled via a network card and antenna, allowing for remote operation. Depending on specific applications, CSI cameras and monitoring screens can interface with the Nano board via Wi-Fi, USB, or headless configurations. Fig. 4a depicts the system's key functional components and their interconnections. This compact AI platform integrates the Tegra X1 SoC, featuring a quad-core ARM Cortex-A57 CPU and a 128-core Maxwell GPU, supported by 4 GB of LPDDR4 memory. Storage is managed via a microSD card and QSPI NOR Flash. The system provides extensive connectivity options, including four USB 3.0 ports, HDMI, Gigabit Ethernet, and Camera Serial Interface (CSI), alongside GPIO, I2C, SPI, and UART interfaces. Designed for AI and computer vision applications, it operates on a 5V DC input with optimized power management. Fig. 4b shows the power tree of the interface connector. The Jetson Nano is supplied with 5V DC through either a micro-USB port for basic setups or a DC jack for industrial applications. An internal regulator efficiently distributes power to all core components, including the CPU, GPU, memory, and I/O. Additional power pins support peripheral devices, enhancing system stability and performance.

Fig. 4.

Fig. 4

Block diagram illustrating the major functional units and interconnections of the Edge Computer Vision (CV) hardware components (a) and the interface power distribution tree (b).

The software development of the Edge CV platform encompassed operating system setup and environment configuration. NVIDIA JetPack, a comprehensive SDK optimized for the Jetson Nano, facilitated both the development and deployment of deep learning and computer vision applications. Specifically, JetPack 4.3 was installed on a microSD card to boot the device. VSCode was used for programming, while the PyTorch framework served as the core deep learning environment. Additionally, essential libraries, including OpenCV, were integrated for image processing and computer vision tasks. Finally, the trained computer vision model was deployed on Edge CV devices in the Open Neural Network Exchange (ONNX) format. ONNX offers a standardized representation, ensuring compatibility across different platforms and hardware configurations, enabling seamless deployment and inference. By enabling interoperability between deep learning frameworks, ONNX simplifies the transition from development to production. The complete workflow of this study is illustrated in Fig. 5.

Fig. 5.

Fig. 5

The workflow of this study, including (a) sample preparation, inoculation, and cultivation with Aspergillus flavus; (b) Data collection, annotation, and augmentation. (c) Edge CV Model construction, and (d) Edge CV System development, including training, validation, deployment, and application.

3. Results and discussion

3.1. Performance of improved segmentation

The quantitative results of the model's performance are summarized in Table 1. The metrics include inference time (s), model size (MB), accuracy, precision, recall, and other relevant parameters. Notably, the Edge CV model developed in this study (labeled as “ours”) demonstrates superior performance with a balance of computational efficiency and accuracy, achieving an accuracy of 89.7 % and a reasonable inference speed of 21.3 GFLOPs. These results suggest that the proposed Edge CV model offers a competitive alternative for real-time, on-site fungal infection detection in crop seeds. Thus, the integration of the CBAM module effectively regulates information flow within the network, determining which features to emphasize or suppress. This modification also aids in lightweight the model by focusing on salient features rather than computing a full attention map by applying channel and spatial attention sequentially.

Table 1.

Quantitative results of different models on the Edge CV platform.

Model Version FLOPs (G) Params (M) mAP50:95 (%) Speed (ms)
Preprocess Inference Postprocess
YOLOv8 s 28.8 11.2 78.26 6.5 1172.9 83.9
YOLOv10 n 21.7 12.9 81.31 5.9 726.1 67.86
YOLO-11 n 16.6 9.43 84.6 8.4 873.2 58.7
RTMdet s 29.7 8.8 73.54 6.2 929.3 63.0
RT-DETR R18 56.8 20.7 79.37 7.7 1005.5 61.4
Edge CV ours 21.3 10.08 89.7 7.2 875.0 62.8

Note: small (s), nano (n), or models such as R18, are typically chosen for low-resource or edge devices.

The segmentation results of the computer vision model are presented in Fig. 6. Designed for pixel-wise classification, the model incorporates segmentation loss (seg loss) alongside box and class (cls) losses to quantify discrepancies between predicted and actual segmentation masks. Performance evaluation includes metrics for both Bounding Boxes (B) and Masks (M). Fig. 6(a and b) illustrate training and validation losses, which stabilize after approximately 100 epochs. The cls, box, seg, and distribution focal loss (dfl) decrease rapidly before converging, indicating improved detection and segmentation accuracy. Precision, recall, mAP50, and mAP50:95 metrics, shown in Fig. 6(c and d) steadily improve throughout training. The model achieved a precision(B) of 97.7 % and recall(B) of 96.3 %, while for masks, precision(M) reached 97.6 % and recall(M) 96.4 %. The highest mAP50 scores were 97.6 % for Bounding Boxes and 97.9 % for Masks.

Fig. 6.

Fig. 6

Model's semantic segmentation results after 100 epochs of training: (a) training loss for box, class, seg, and dfl, listed from left to right; (b) the validation loss for box, class, seg, and dfl, listed from left to right; (c) evaluation metrics for bounding boxes: precision (B), recall (B), mAP50 (B), and mAP50:95 (B), listed from left to right; and (d) evaluation metrics for masks: precision (M), recall (M), mAP50 (M), and mAP50:95 (M), listed from left to right. Note seg: segmentation, dfl: detection and false localization, B: bounding box metrics, and M: mask metrics.

Furthermore, to evaluate the independent contributions of each module, an ablation study (Table 2) was conducted. The CBAM module and post-processing were tested individually and in combination. As shown in Table 2, each component of the Edge CV architecture contributed to performance improvement. Incorporating the backbone with the CBAM module increased mAP50:95 from 84.6 % to 86.9 %, while the post-processing pipeline alone provided a modest gain by refining seed boundaries. When combined, these modules achieved the best overall performance, with an mAP50:95 of 89.7 %. Notably, the post-processing step, which includes morphological operations and the watershed algorithm, requires only 0.5–2 ms per seed, representing a negligible contribution to the total inference time of 62.8 ms. This confirms that adding post-processing does not compromise real-time performance, enabling rapid and accurate on-site evaluation of seed infection.

Table 2.

Ablation study of Edge CV model components.

Model Variant FLOPs (G) Params (M) mAP50:95 (%) Speed (ms)
Preprocess Inference Postprocess
Baseline (YOLOv11-n) 16.6 9.43 84.6 8.4 873.2 58.7
+ CBAM Module 18.9 10.02 86.9 7.9 874.1 61.1
+ Post-Processing 16.6 9.43 86.1 8.4 873.5 60.5
Edge CV 21.3 10.08 89.7 7.2 875.0 62.8

3.2. Performance of improved post-processing

Based on the segmentation results, post-processing techniques were used to perceive and analyze the segmented results. The experimental results of morphological post-processing are shown in Fig. 7. Initially, class-specific masks are generated to separate mold-affected and unmolded areas, as depicted in Fig. 7a, allowing the calculation of infected and uninfected regions. Fig. 7b illustrates the merging of mold and unmold regions belonging to the same seed using the connected components algorithm, enhanced by morphological closing operations to improve the integration of adjacent segments within the same peanut. The kernel size of the morphological operations was adjusted based on the proximity of the seed segments. The watershed algorithm, shown in Fig. 7c, was used to effectively separate adjacent peanut seeds. This algorithm incorporates Distance Transform, Local Maxima Detection, and Watershed Transform. Fine-tuning ensured accurate separation of neighboring seeds while preserving the integrity of mold and unmold regions within individual seeds. Subsequently, the infection grades of each peanut seed were calculated. Following the precise identification of mold-affected and unaffected areas and the separation of individual seeds, infection indices and resistance levels were analyzed using methods from Mehan et al. [29] and Reid et al. [36]. The post-processing techniques successfully integrated mold-affected and unaffected regions of the same seed while effectively distinguishing closely connected seeds, which are often erroneously classified as a single entity.

Fig. 7.

Fig. 7

Enhanced post-processing techniques of the Edge CV model. (a) Generation of class-specific masks based on segmentation results. (b) Merging of masks corresponding to segments belonging to individual peanut seeds. (c) Separation of adjacent peanut seeds previously misidentified as a single seed.

3.3. Assessment of A. flavus infection index in peanut seeds

The results of both Edge CV inference and manual evaluation are shown in Table 3. Manual analysis involves taking images on-site, followed by calculation and recording by hand, requiring approximately 10 min per image. As shown in Table 3, manual evaluations are prone to variability, about ±4.2 % fluctuation, due to subjective differences in individual assessments. In contrast, Edge CV allows for real-time, on-site assessments, processing each image or video sample in 0.3–0.9 s, with results that are consistent (about ±0.01 % fluctuation) and less prone to bias compared to manual evaluations.

Table 3.

Comparison of assessment results of peanut seeds.

Variety Methods Infection index (%) Resistance Level Speed (s)
Seeds A Edge CV 18 ± 0.01 MR 0.3
Manual 16 ± 5.6 MR 378
Seeds B Edge CV 49.33 ± 0.03 MS 0.4
Manual 48 ± 5.8 MS 542
Seeds C Edge CV 33.33 ± 0.02 MS 0.5
Manual 34 ± 5.5 MS 465
Seeds D Edge CV 70 ± 0.01 S 1.0
Manual 73 ± 4.1 S 559
Seeds E Edge CV 100 ± 0.001 HS 0.8
Manual 100 ± 0.02 HS 310

Note: Resistant (R): Infection Index 0–10 %. Moderately Resistant (MR): Infection Index 10–25 %. Moderately Susceptible (MS): Infection Index 25–50 %. Susceptible (S): Infection Index 50–75 %. Highly Susceptible (HS): Infection Index >75 %.

Meanwhile, the assessment results of Edge CV inference for A. flavus infection index in peanut seeds are illustrated in Fig. 8. Specifically, Fig. 8bb presents the inference results across different peanut cultivars—M16, XHXL, GH65, LH29, and YY92. Different peanut seeds with their variations in infection levels, physical colors, and sizes. Additionally, Fig. 8c Zoomed-in views highlight detailed assessment outcomes from two representative samples by the Edge CV system, including grade-level calculations for each peanut seed, aggregation of counts, resistance level assessments, and visualizations designed to facilitate manual validation. It can be concluded that, despite variations in physical appearance among peanut cultivars, the Edge CV system consistently delivers effective and accurate inference outcomes.

Fig. 8.

Fig. 8

Results of A. flavus infection index assessments in peanut seeds using the Edge CV system. (a) Original images for manual speculation. (b) Inference results across different peanut cultivars. (c) Zoomed-in views highlighting detailed segmentation outcomes from two representative samples. (d) Statistical comparison between Edge CV predictions and manual evaluation results. (e) Time efficiency analysis comparing evaluation durations.

The statistical comparison with manual measurements was performed using regression analysis, evaluating the model's performance with R2 (coefficient of determination) of 0.991 and RMSE (root mean squared error) of 0.007, as illustrated in Fig. 8d. These metrics assess the agreement between predicted and observed values and quantify prediction accuracy. The time spent by Edge CV on evaluation is significantly shorter than that of manual analysis, as shown in Fig. 8e. The time required for inference at different infection levels is presented on a Log10 scale, indicating that the evaluation time can be reduced by approximately 3 orders of magnitude (103). In summary, Edge CV offers a fast, precise, and efficient method for assessing infection levels. It is not only significantly safer than manual evaluation but also enables human operators to monitor and validate results provided by the system.

Despite the promising results, several challenges remain for deployment of the Edge CV system. First, illumination variability can influence image quality and model stability. Adaptive illumination calibration and standardized imaging protocols may help alleviate this issue. Second, seed stacking and occlusion often occur during bulk seed evaluation, which can reduce segmentation accuracy. Possible solutions include 3D imaging or multi-view acquisition strategies to capture hidden seed surfaces. In sumarry, although post-processing successfully separates most adjacent seeds, extreme clustering remains a challenge and may benefit from advanced contour refinement techniques. These limitations highlight opportunities for further development and refinement of Edge CV, particularly for scaling to diverse environmental and operational settings.

3.4. Assessment of A. flavus infection index in other crop seeds using transfer learning

The transfer learning models were evaluated on datasets of maize and rice seeds infected by A. flavus to evaluate their performance and adaptability. Fig. 9 displays the results of Edge CV after deep transfer learning. The statistical comparison with manual measurements for maize (R2 = 0.968, RMSE = 0.13) and rice (R2 = 0.949, RMSE = 0.26) showed slightly lower performance compared to peanut seeds (R2 = 0.991, RMSE = 0.07), with rice exhibiting a greater reduction in accuracy and more variability in predictions, due to its smaller seed size. However, all these can be improved by expanding the dataset. In all, the results demonstrated the ability of feature deep transfer learning to perform effectively across different seed types.

Fig. 9.

Fig. 9

Results of Edge CV transfer learning for assessments on other seeds. (a) maize assessment results. (b) Regression analysis of Edge CV and manual measurement on maize seeds. (c) rice assessment results. (d) Regression analysis of Edge CV and manual measurement on rice seeds.

4. Conclusion

This study demonstrates the effective application of edge computing-based computer vision (Edge CV) for evaluating Aspergillus flavus infection indices in crop seeds, thereby enabling high-throughput phenotyping and eliminating health-risk manual evaluation. This was achieved through the development and enhancement of an Edge CV model and platform. The model was optimized to improve segmentation accuracy in distinguishing between A. flavus-infected and uninfected regions. By integrating a Convolutional Block Attention Module (CBAM) into the model backbone, the system effectively separated channel and spatial attention, reducing computational complexity and parameter overhead. This made the model lightweight and well-suited for deployment on edge computing devices. It achieved a mean Intersection over Union (mIoU) of 86.7 % with a computational cost of 108.6 GFLOPs.

Meanwhile, enhanced post-processing techniques—including Distance Transform, Local Maxima Detection, and the Watershed Algorithm—accurately separated closely connected seeds, ensuring precise infection index evaluation and addressing the challenge of adjacent seeds being misidentified as a single unit. Additionally, the model demonstrated strong transferability to other crop seeds through deep feature transfer learning, only needing to be trained on small datasets. Statistical results confirmed its effectiveness, with high predictive accuracy for peanuts (R2 = 0.991, RMSE = 0.07), maize (R2 = 0.968, RMSE = 0.13), and rice (R2 = 0.949, RMSE = 0.26). Furthermore, the development of the Edge CV platform enabled real-time and on-site visualization of results. Overall, this study presents a robust, efficient, and objective solution for the safe evaluation of toxic fungal infections in crop seeds.

Although our proposed method effectively resolves the issue of adjacent seeds, challenges remain when dealing with seed occlusion or illumination variation. Future work should focus on incorporating three-dimensional and multi-view fusion techniques to address this limitation. In summary, the approach developed in this study offers valuable insights for the advancement of agricultural robotics by integrating proximal machine vision, thereby accelerating breeding efforts and supporting high-throughput phenotyping in modern breeding programs.

CRediT author statement

L.B. Wu: Conceptualization, Methodology, Writing-original draft, and Software. L.L. Zhu: Methodology, Resources, and Supervision. H.Y. Weng: Formal analysis. G.P. Chen: Investigation. H.F. Liu: Data Curation. D.P. Ye: Project administration and Supervision. Y.D. Liu: Project administration and Supervision. L.B. Wu and L.L. Zhu contributed equally to this work.

Declaration of competing interest

The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

Acknowledgment

This work was supported by the National Key R&D Program Project, Research and Development of Intelligent and Efficient Processing Technology and Equipment for Vegetable Production Areas(2023YFD2001301). The authors thank the China Scholarship Council (CSC No. 202408350068) for the financial support to the author (Libin Wu) to conduct her doctoral research in the Department of Bioresource Engineering at McGill University.

Contributor Information

Yande Liu, Email: xmlgliuyd@xmut.edu.cn.

Dapeng Ye, Email: ydp@fafu.edu.cn.

Data availability

The data and code will be made available on this URL: https://github.com/lililibin2022/Edge-CV-for-peanut-AF-infection-assessment.

References

  • 1.Amaike S., Keller N.P. Aspergillus flavus. Annu. Rev. Phytopathol. 2011;49(1):107–133. doi: 10.1146/annurev-phyto-072910-095221. [DOI] [PubMed] [Google Scholar]
  • 2.Kumar P., Mahato D.K., Kamle M., et al. Aflatoxins: a global concern for food safety, human health and their management. Front. Microbiol. 2017;7:2170. doi: 10.3389/fmicb.2016.02170. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 3.Raza A., Chen H., Zhang C., et al. Designing future peanut: the power of genomics-assisted breeding. Theor. Appl. Genet. 2024;137(3):66. doi: 10.1007/s00122-024-04575-3. [DOI] [PubMed] [Google Scholar]
  • 4.Sharma S., Choudhary B., Yadav S., et al. Metabolite profiling identified pipecolic acid as an important component of peanut seed resistance against Aspergillus flavus infection. J. Hazard Mater. 2021;404 doi: 10.1016/j.jhazmat.2020.124155. [DOI] [PubMed] [Google Scholar]
  • 5.Zhuang W., Varshney R.K. Peanut genomics and biotechnology in breeding applications. Front. Plant Sci. 2023;14 doi: 10.3389/fpls.2023.1226637. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 6.Li Q., Zhao Y., Zhu X., et al. Antifungal efficacy of paeonol on Aspergillus flavus and its mode of action on cell walls and cell membranes. LWT (Lebensm.-Wiss. & Technol.) 2021;149 doi: 10.1016/j.lwt.2021.111985. [DOI] [Google Scholar]
  • 7.Pradhan S., Ananthanarayan L., Prasad K., et al. Anti-fungal activity of lactic acid bacterial isolates against aflatoxigenic fungi inoculated on peanut kernels. LWT (Lebensm.-Wiss. & Technol.) 2021;143 doi: 10.1016/j.lwt.2021.111104. [DOI] [Google Scholar]
  • 8.Olagunju O., McHunu N., Durand N., et al. Effect of milling, fermentation or roasting on water activity, fungal growth, and aflatoxin contamination of Bambara groundnut (Vigna subterranea (L.) Verdc) LWT (Lebensm.-Wiss. & Technol.) 2018;98:533–539. doi: 10.1016/j.lwt.2018.09.001. [DOI] [Google Scholar]
  • 9.Baxi S.N., Portnoy J.M., Larenas-Linnemann D., et al. Exposure and health effects of fungi on humans. J. Allergy Clin. Immunol. Pract. 2016;4(3):396–404. doi: 10.1016/j.jaip.2016.01.008. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 10.Ghazal S., Munir A., Qureshi W.S. Computer vision in smart agriculture and precision farming: techniques and applications. Artificial Intelligence in Agriculture. 2024 doi: 10.1016/j.aiia.2024.06.004. [DOI] [Google Scholar]
  • 11.Patrício D.I., Rieder R. Computer vision and artificial intelligence in precision agriculture for grain crops: a systematic review. Comput. Electron. Agric. 2018;153:69–81. doi: 10.1016/j.compag.2018.08.001. [DOI] [Google Scholar]
  • 12.Lee S., Peng R., Wu C., et al. Programmable black phosphorus image sensor for broadband optoelectronic edge computing. Nat. Commun. 2022;13(1):1485. doi: 10.1038/s41467-022-29171-1. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 13.Satyanarayanan M. How we created edge computing. Nature Electronics. 2019;2(1) doi: 10.1038/s41928-018-0194-x. 42-42. [DOI] [Google Scholar]
  • 14.Gupta P., Chouhan A.V., Wajeed M.A., et al. Prediction of health monitoring with deep learning using edge computing. Measurement: Sensors. 2023;25 doi: 10.1016/j.measen.2022.100604. [DOI] [Google Scholar]
  • 15.Lin H., Zeadally S., Chen Z., et al. A survey on computation offloading modeling for edge computing. J. Netw. Comput. Appl. 2020;169 doi: 10.1016/j.jnca.2020.102781. [DOI] [Google Scholar]
  • 16.Rosende S.B., Ghisler S., Fernández-Andrés J., et al. Implementation of an edge-computing vision System on reduced-board computers embedded in UAVs for intelligent traffic management. Drones. 2023;7(11):682. doi: 10.3390/drones7110682. [DOI] [Google Scholar]
  • 17.Alqaisi O.I., Tosun A.S., Korkmaz T. Performance analysis of container technologies for computer vision applications on edge devices. IEEE Access. 2024;12:41852–41869. doi: 10.1109/ACCESS.2024.3376570. [DOI] [Google Scholar]
  • 18.Rosende S.B., Ghisler S., Fernández-Andrés J., et al. Implementation of an edge-computing vision System on reduced-board computers embedded in UAVs for intelligent traffic management. Drones. 2023;7(11) doi: 10.3390/drones7110682. [DOI] [Google Scholar]
  • 19.Shi W.S., Cao J., Zhang Q., et al. Edge computing: Vision and challenges. IEEE Internet Things J. 2016;3(5):637–646. doi: 10.1109/JIOT.2016.2579198. [DOI] [Google Scholar]
  • 20.Cruz M., Mafra S., Teixeira E., et al. Smart Strawberry farming using edge computing and IoT. Sensors. 2022;22(15):5866. doi: 10.3390/s22155866. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 21.Sun H., Yu Y., Sha K., et al. mVideo: Edge computing based Mobile video processing systems. IEEE Access. 2020;8:11615–11623. doi: 10.1109/ACCESS.2019.2963159. [DOI] [Google Scholar]
  • 22.Singh S., Sulthana R., Shewale T., et al. Machine-Learning-Assisted security and privacy provisioning for Edge Computing: a Survey. IEEE Internet Things J. 2022;9(1):236–260. doi: 10.1109/JIOT.2021.3098051. [DOI] [Google Scholar]
  • 23.Li J., Yin J., Deng L. A robot vision navigation method using deep learning in edge computing environment. EURASIP J. Appl. Signal Process. 2021;2021(1):22. doi: 10.1186/s13634-021-00734-6. [DOI] [Google Scholar]
  • 24.Groshev M., Baldoni G., Cominardi L., et al. Edge robotics: are we ready? An experimental evaluation of current vision and future directions. Digital Commun.Netw. 2023;9(1):166–174. doi: 10.1016/j.dcan.2022.04.032. [DOI] [Google Scholar]
  • 25.Liu S., Liu L., Tang J., et al. Edge computing for autonomous driving: opportunities and challenges. Proc. IEEE. 2019;107(8):1697–1716. doi: 10.1109/JPROC.2019.2915983. [DOI] [Google Scholar]
  • 26.Patrikar D.R., Parate M.R. Anomaly detection using edge computing in video surveillance system. Int.J. Multimed. Information Retr. 2022;11(2):85–110. doi: 10.1007/s13735-022-00227-8. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 27.Zhou X., Zhang Y., Jiang X., et al. Advancing tracking-by-detection with MultiMap: towards occlusion-resilient online multiclass strawberry counting. Expert Syst. Appl. 2024;255 doi: 10.1016/j.eswa.2024.124587. [DOI] [Google Scholar]
  • 28.Ren M., Dong Y., Wang J., et al. Computer vision-assisted smartphone microscope imaging digital immunosensor based on click chemistry-mediated microsphere counting technology for the detection of aflatoxin B1 in peanuts. Anal. Chim. Acta. 2023;1278 doi: 10.1016/j.aca.2023.341687. [DOI] [PubMed] [Google Scholar]
  • 29.Yang G., Tian X., Fan Y., et al. Identification of Peanut kernels infected with multiple Aspergillus flavus fungi using line-scan raman hyperspectral imaging. Food Anal. Methods. 2024;17(2):155–165. doi: 10.1007/s12161-023-02548-8. [DOI] [Google Scholar]
  • 30.Fatemi A., Singh V., Kamruzzaman M. Identification of informative spectral ranges for predicting major chemical constituents in corn using NIR spectroscopy. Food Chem. 2022;383 doi: 10.1016/j.foodchem.2022.132442. [DOI] [PubMed] [Google Scholar]
  • 31.Santos P.M., Simeone M.L.F., Pimentel M.A.G., et al. Non-destructive screening method for detecting the presence of insects in sorghum grains using near infrared spectroscopy and discriminant analysis. Microchem. J. 2019;149 doi: 10.1016/j.microc.2019.104057. [DOI] [Google Scholar]
  • 32.Liang P.S., Slaughter D.C., Ortega-Beltran A., et al. Detection of fungal infection in almond kernels using near-infrared reflectance spectroscopy. Biosyst. Eng. 2015;137:64–72. doi: 10.1016/j.biosystemseng.2015.07.010. [DOI] [Google Scholar]
  • 33.Mehan V., Reddy P., Vidyasagar Rao K., et al. Components of rust resistance in peanut genotypes. Phytopathology. 1994;84(12):1421–1426. doi: 10.1094/Phyto-84-1421. [DOI] [Google Scholar]
  • 34.Khan S.A., Chen H., Deng Y., et al. High-density SNP map facilitates fine mapping of QTLs and candidate genes discovery for Aspergillus flavus resistance in peanut (Arachis hypogaea) Theor. Appl. Genet. 2020;133:2239–2257. doi: 10.1007/s00122-020-03594-0. [DOI] [PubMed] [Google Scholar]
  • 35.Zhuang W.J., Chen H., Yang M., et al. The genome of cultivated peanut provides insight into legume karyotypes, polyploid evolution and crop domestication. Nat. Genet. 2019;51(5):865. doi: 10.1038/s41588-019-0402-2. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 36.Khanam R., Hussain M. YOLOv11: an overview of the key architectural enhancements. arXiv. 2024 doi: 10.48550/arXiv.2410.17725. [DOI] [Google Scholar]
  • 37.Wang C.-Y., Liao H.-Y.M., Wu Y.-H., et al. CSPNet: a new backbone that can enhance learning capability of CNN. arXiv. 2019 doi: 10.48550/arXiv.1911.11929. [DOI] [Google Scholar]
  • 38.Terven J., Córdova-Esparza D.-M., Romero-González J.-A. A comprehensive review of yolo architectures in computer vision: from yolov1 to yolov8 and yolo-nas. Machine learning knowledge extraction. 2023;5(4):1680–1716. doi: 10.3390/make5040083. [DOI] [Google Scholar]
  • 39.Woo S.H., Park J., Lee J.Y., et al. Computer Vision - ECCV 2018. PT VII; 2018. CBAM: convolutional block attention module; pp. 3–19. [DOI] [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Data Availability Statement

The data and code will be made available on this URL: https://github.com/lililibin2022/Edge-CV-for-peanut-AF-infection-assessment.


Articles from Plant Phenomics are provided here courtesy of Nanjing Agricultural University

RESOURCES