Abstract
Peanut leaf disease detection in complex field environments faces two major challenges: distinguishing visually similar symptoms and identifying severely occluded lesions. This study presents YOLOv8-MSDH, a lightweight detection model built upon an improved YOLOv8 framework to address these issues. Four architectural enhancements are introduced. First, the MHSA attention mechanism is integrated to enhance sequential feature dependency modeling and suppress background noise. Second, the Slim-Neck module is adopted for neck reconstruction, which lowers computational cost and facilitates multi-scale feature fusion. Third, the original C2f module is replaced with the C2f-Dual module to further reduce computational load. Last, the HWD downsampling module is incorporated into the backbone to improve the retention of disease-specific features while promoting lightweight design. Evaluated on a peanut leaf disease dataset, YOLOv8-MSDH achieves 90.14% precision, 82.16% recall, 90.71% mAP50 and 72.14% mAP50-95 under complex conditions—surpassing the baseline YOLOv8 by 3.5, 0.7, 1.5 and 2.89 percentage points, respectively. Parameter count and computational complexity are reduced by 12.9% and 20.7%, confirming effective lightweighting. Operating at 509.95 FPS, the model maintains strong real-time performance and exhibits high robustness across varying lighting conditions.
1. Introduction
In 2025, global peanut production surpassed 50 million tons [1]. Peanuts are among the most widely cultivated crops globally and hold considerable economic importance. However, leaf diseases consistently reduce both quality and yield each year, causing substantial financial harm to growers. Therefore, timely and accurate diagnosis of peanut leaf diseases followed by prompt control measures is essential for reducing economic losses among farmers. Conventional disease identification relies heavily on manual inspection, a method that is inefficient, demands expert knowledge, and is vulnerable to human error [2]. Intelligent recognition technology offers great promise for peanut leaf disease identification, facilitating timely and targeted pesticide application. Achieving efficient and accurate disease classification under natural challenges like weather variability and foliage occlusion is critical for precision pesticide application [3]. Traditional object detection methods based on image processing, such as feature extraction [4], color space conversion [5], and texture segmentation [6], can effectively identify specific diseases in simple scenarios. However, in complex field environments, the presence of multiple disease types, frequent leaf occlusion, and visual similarities among certain symptoms make accurate detection of peanut leaf diseases particularly challenging.
With the ongoing advancement of agricultural modernization and intelligentization, deep learning-based detection techniques have been widely adopted in agricultural image processing. These methods effectively address the inherent limitations of traditional approaches while offering superior generalization capability and detection performance [7]. Deep learning-based detection methods are generally categorized into two main types: single-stage detectors and two-stage detectors. Among two-stage detectors, the R-CNN family of algorithms is the most representative [8]. These algorithms operate in two sequential stages: the first stage extracts regions of interest (ROIs) from the input image, and the second stage performs object classification and bounding box regression on each extracted ROI [9]. However, due to their sequential processing pipeline and substantial redundant computations for candidate regions, two-stage detectors typically suffer from slower inference speeds, limited real-time performance, and high computational resource consumption. In contrast, single-stage detectors offer end-to-end processing, faster inference speed, and simpler and more lightweight architectures. These characteristics make them particularly suitable for real-time disease detection tasks in agricultural scenarios, where deployment efficiency is critical. Consequently, single-stage detection has emerged as the mainstream focus for optimization and application in recent years [10].
The YOLO family represents a typical class of single-stage detectors, operating without a separate region proposal stage and completing detection in a single forward pass. After feature extraction through a backbone network, these models directly predict object locations and categories on the feature map, performing bounding box regression and classification simultaneously [11].
Recent advances have applied various deep learning enhancements to plant disease detection. Naresh et al. [12] developed a Deep Cross-Residual Skip-Connected Separable Convolutional Neural Network (DCRSCSCNN) based on R-CNN, achieving robust performance across multiple crop leaf disease datasets, including apple, corn, cucumber, grape, potato, and guava. Xue et al. [13] improved YOLOv11 by incorporating GSConv into the backbone, integrating a C2f module with efficient multi-scale attention (EMC), and adopting the Wise-IOU loss function; these modifications enhanced citrus disease detection accuracy while reducing model complexity. Li et al. [14] redesigned the YOLOv8 backbone using C3 Ghost and Ghost modules, integrated the lightweight TA attention mechanism into the neck network, and applied the ECIOU loss function, substantially lowering computational cost and parameter count while maintaining effective corn leaf disease recognition. Chen et al. [15] enhanced YOLOv8 by incorporating DynamicConv, SimAM attention, Dysample upsampling, and GIOU loss, achieving marked improvements in accuracy, localization precision, and computational efficiency on a tomato leaf disease dataset. Liu et al. [16] proposed YOLO-LWS, which adopts an inverted bottleneck structure from LeYOLO-small in the backbone, integrates the SA attention mechanism, and replaces the original loss function with WIOUv3—offering a lightweight yet generalizable solution for real-time bitter melon disease detection under complex field conditions. Zhou et al. [17] incorporated dynamic residual blocks (DRBs) and self-attention (SBAY) into YOLOv8, along with an ultra-small detection head and streamlined computations, demonstrating improved performance over the original model in apple scab detection. In addition to the YOLO series, Transformer architectures have also been applied to the field of plant disease detection in recent years. Vision Transformer (ViT) achieves global modeling through self-attention mechanisms, while Swin Transformer reduces computational complexity via hierarchical windowed attention; both have achieved good results in leaf disease classification tasks. To improve upon ViT, Shahi et al. [18] proposed the AgriTL-ViT model, which replaces the MLP structure with Transformer ResNet modules and introduces a dual multi-head self-attention mechanism, achieving accuracy rates of 98.5%, 97.2%, and 97.0% on tomato, corn, and rice leaf disease datasets, respectively. Sherihan et al. [19] proposed a hybrid architecture combining CNN and ViT, utilizing an ensemble of CNNs for global feature extraction and integrating ViT for local feature extraction, achieving accuracy rates of 99.24% and 98% on apple and corn leaf datasets, respectively. However, the aforementioned Transformer and hybrid models have a large number of parameters and high computational complexity, posing challenges for deployment in resource-constrained field environments.
The aforementioned research has advanced the development of leaf disease identification and detection technologies. However, most experimental studies have not considered the impact of actual natural environments and the similarity of disease characteristics. In natural settings, peanut leaves are numerous and complex, often overlapping and shading one another. Leaf shading not only limits the visible characteristics of obscured leaves but also creates significant variations in light exposure between different leaves. Furthermore, Leaf Spot and Alternaria diseases exhibit highly similar characteristics, both forming circular or near-circular brown to dark brown lesions on leaves, differing only in lesion size and location. These confounding factors significantly impact the precision of peanut leaf disease detection. To address this, this study proposes YOLOv8-MSDH, a peanut leaf disease detection model that balances detection accuracy with lightweight design, providing technical support for precise peanut leaf disease detection.
The proposed YOLOv8-MSDH model for peanut leaf disease detection incorporates four key architectural enhancements, as outlined below:
- (1)
- HWD downsampling module. The conventional Conv module in the backbone is replaced with a Haar wavelet-based downsampling (HWD) module. By leveraging Haar wavelets, this module preserves maximal information during resolution reduction, effectively decreasing spatial dimensions while minimizing information loss. This improvement enhances the retention of disease-relevant features and contributes to further lightweight optimization.
- (2)
- The original C2f module. The native C2f module within the backbone is substituted with the newly proposed C2f-Dual module. This upgraded component integrates a lightweight dual-convolution technique into the C2f architecture. This modification reduces computational overhead, mitigates the degradation of feature information during propagation, and strengthens the model’s discriminative capacity for identifying the key pathological characteristics of peanut leaf diseases.
- (3)
- Slim-Neck neck network. The neck network is completely reconstructed using the Slim-Neck architecture. This design employs GSConv, a hybrid convolution that combines group convolutions with depthwise separable convolutions, and incorporates the VoV-GSCSP module—a cross-stage partial network constructed via one-time aggregation. This structure reduces computational costs while enabling effective multi-scale feature fusion across different network stages, achieving a favorable balance between lightweight architecture and improved detection accuracy.
- (4)
- MHSA attention mechanism. A multi-head self-attention (MHSA) mechanism is introduced to augment the model’s capability to model long-range dependencies within feature sequences. By computing multiple self-attention heads in parallel, the network is better able to focus on target features of interest, suppress interference from irrelevant background clutter, and increase its sensitivity to the critical visual indicators associated with peanut leaf diseases.
The aforementioned improvements are not merely a simple stacking of existing modules, but rather systematic optimizations tailored to the task of peanut disease detection. The main innovations and contributions of this study are reflected in the following three aspects:
- (1)
- Context-Aware Integration Innovation: Addressing practical challenges in peanut fields—such as severe leaf occlusion and the difficulty in distinguishing similar diseases—we organically integrated and collaboratively optimized the MHSA attention mechanism, Slim-Neck, C2f-Dual, and HWD downsampling to construct a dedicated, lightweight detection framework, rather than a simple stack of modules.
- (2)
- Synergistic Improvement in Accuracy and Efficiency: While enhancing the model’s ability to distinguish between the two similar diseases—Alternaria and Leaf Spot—and detect occluded leaves, we significantly reduced the number of parameters and computational load, achieving a balance between detection accuracy and lightweight design, making it more suitable for deployment on edge devices.
- (3)
- Strong Practicality and Robustness: The model maintains stable and efficient detection performance under real-world field conditions, such as complex lighting and leaf occlusion, providing a viable technical solution for the intelligent identification and precise prevention and control of peanut diseases.
2. Materials and Methods
2.1. Dataset Collection
This study utilized the Mendeley Data public dataset [20]. Within this public dataset, Sasmal et al. captured 1120 images of peanut leaf disease scenarios in Ramchandrapur village, West Bengal, India. These images encompass four common peanut leaf diseases: Alternaria, Leaf Spot, Rust, and Rosette. Alternaria manifests as near-circular or irregular brown lesions on leaves, often with a yellow halo around the edges. Leaf Spot lesions are smaller and lighter in color, typically appearing as circular spots ranging from yellowish-brown to dark brown. Rust produces abundant orange-yellow to reddish-brown rust-like spore masses on leaf surfaces. Rosette causes leaves to yellow, wrinkle, and form rosette-like clusters, severely disrupting plant morphology.
To ensure the representativeness and robustness of the dataset, the data collection process fully accounted for the diversity of complex natural environments. First, weather conditions encompassed both cloudy and sunny days with varying light intensities. Secondly, imaging scales ranged from close-up shots focusing on leaf lesion details to wide-angle views preserving the overall plant morphology. Finally, the sample composition encompassed single-leaf lesions, clustered multi-leaf infections, and scenarios with partially obscured leaves. Specific images of leaf lesions are shown in Figure 1. This multidimensional design for collecting peanut leaf disease data enables the dataset to effectively simulate real-world disease occurrence in peanut fields, providing a data foundation for subsequent model training that closely mirrors practical application scenarios.
Figure 1.
Images of four types of peanut leaf diseases.
2.2. Dataset Preparation
Image collection in open-field agricultural environments is inherently susceptible to a variety of confounding factors, such as fluctuations in light intensity, diverse shooting perspectives, and the complexity of leaf occlusion. To further enrich the diversity of the dataset and bolster the model’s generalization capacity, a series of data augmentation strategies were implemented on the raw peanut leaf disease image dataset. This augmentation workflow empowers the model to learn more comprehensive and robust feature representations of leaf diseases under unstructured natural conditions, thereby elevating its adaptability and performance in practical deployment scenarios.
A diverse suite of augmentation techniques was employed, encompassing random rotation, horizontal flipping, random noise addition, luminance adjustment, and simulated fog effects. Through these operations, the size of the dataset was expanded to a total of 4828 images. Representative examples of the augmented image samples are illustrated in Figure 2.
Figure 2.
Examples of data augmentation.
Subsequently, the augmented dataset was randomly split into training and validation subsets following an approximate 4:1 ratio, resulting in 3888 images allocated to the training set and 940 images for the validation set. The division of the dataset is shown in Table 1. Given that the leaf symptoms of Alternaria and Leaf Spot are morphologically similar and their characteristics are easily confused, and since this study focuses on distinguishing between these two similar diseases, the number of samples for these two disease categories was appropriately increased during the data augmentation phase to enhance the model’s ability to distinguish between similar diseases; the remaining two disease categories were distributed evenly based on their natural sample distribution, thereby ensuring a relatively balanced distribution of samples across categories in both the training and validation sets, effectively mitigating the negative impact of class imbalance on model training. All images were manually annotated using the LabelImg tool to mark diseased peanut leaf regions. Bounding box annotations were generated for each of the four primary peanut leaf disease categories, and all annotation files were formatted according to the YOLO specification to facilitate seamless integration with subsequent model training processes.
Table 1.
Sample distribution of the data set after data augmentation.
2.3. YOLOv8
YOLOv8 is a single-stage detection algorithm introduced by Ultralytics in 2023. Characterized by its simple architecture and high accuracy, it stands as one of the most advanced object detection models currently available [21]. Compared to previous YOLO series models, YOLOv8 demonstrates significant advantages in both detection accuracy and inference speed. To accommodate diverse detection scenarios, YOLOv8 offers five model scales—n, s, m, l, and x—with progressively increasing network depth and width. While enhancing detection precision, this design also increases training and inference time costs. To ensure real-time performance and manageable model size for resource-constrained devices, this study selected YOLOv8—the model with the fewest parameters and fastest inference speed—as the baseline for optimization. For multi-object peanut leaf disease detection in natural fields, YOLOv8 employs an improved Darknet 53 backbone structure combined with a C2f module. This leverages rich gradient flow information to enhance feature extraction, enabling precise capture of subtle and complex disease features on peanut leaves. The neck network effectively integrates shallow and deep information through multi-scale feature fusion, while the detection head utilizes an efficient decoupled structure to improve classification and localization accuracy [22].
The overall YOLOv8 [23] architecture comprises four components: Input, Backbone, Neck, and Detection Head, as illustrated in Figure 3. At the input stage, the model employs Mosaic data augmentation and adaptive image scaling to enhance robustness, reduce computational complexity, and improve detection accuracy. The backbone network is built upon the CSPDarkNet architecture, primarily responsible for image feature extraction. It introduces the C2f module with richer gradient flow as the core feature extraction unit and utilizes the SPPF module to fuse features from different receptive fields, thereby enhancing the model’s adaptability to multi-scale objects. The neck network adopts a Path Aggregation Network (PAN) structure to strengthen multi-level feature fusion capabilities. The detection head employs a decoupled head architecture with an anchor-free detection mechanism. By regressing the center point and width-height coordinates of objects across feature maps of varying scales, it significantly reduces computational overhead while accurately predicting the category and location information of objects of different sizes.
Figure 3.
YOLOv8 model architecture.
2.4. YOLOv8-MSDH Algorithm
Although YOLOv8 has been systematically optimized to achieve improved detection accuracy and computational efficiency, it remains limited in identifying peanut leaf diseases under challenging conditions—particularly when severe occlusion reduces visible disease features or when different diseases exhibit similar visual characteristics. The original model also suffers from a relatively large architecture, insufficient feature extraction capacity, and redundant parameters, which constrain its overall efficiency [24].
To address these limitations, this study introduces modular enhancements to the original YOLOv8 framework, resulting in YOLOv8-MSDH—a detection model specifically designed for peanut leaf diseases that balances accuracy with lightweight architecture. Four key improvements are implemented. First, the MHSA attention mechanism is incorporated to strengthen the capture of internal feature dependencies while suppressing background interference. Second, the neck network is reconstructed using Slim-Neck, which integrates GSConv and the VoV-GSCSP module to reduce computational cost and enable effective multi-scale feature fusion. Third, the original C2f module is replaced with C2f-Dual, which incorporates a lightweight DualConv technique to further lower computational demands. Fourth, conventional Conv modules in the backbone are substituted with HWD downsampling modules, which leverage Haar wavelets to retain maximal information during resolution reduction, enhancing the preservation of disease-specific features and contributing to model lightweighting. The architecture of the improved YOLOv8-MSDH algorithm is illustrated in Figure 4.
Figure 4.
YOLOv8-MSDH network structure.
2.4.1. HWD Downsampling Module
Downsampling operations inherently risk losing critical information when image resolution is reduced. Commonly used techniques in deep convolutional neural networks—such as max pooling, average pooling, and strided convolution—effectively decrease computational load and model complexity but often fail to preserve high-level feature information [25]. To address the loss of important targets caused by pixel inconsistencies during training, this study adopts a Haar wavelet-based HWD downsampling module [26]. The architecture of this module is illustrated in Figure 5.
Figure 5.
Structure diagram of the HWD downsampling module.
The HWD downsampling module is engineered to maximize information retention during image resolution reduction, with its core mechanism rooted in Haar wavelet decomposition. This module is composed of two distinct subcomponents: a lossless feature encoding submodule and a feature learning submodule, each fulfilling a specialized role in the downsampling pipeline.
The lossless feature encoding submodule is responsible for two key tasks: feature transformation and spatial resolution compression. In contrast, the feature learning submodule focuses on mining discriminative features from the encoded data and discarding redundant, non-informative components. A critical component integrated into the encoding submodule is the Haar wavelet transform, which decomposes input feature maps into hierarchical approximation components and detail components. This decomposition not only enables multi-scale feature analysis but also acts as a highly efficient compression strategy [27]. For an input feature map with the dimension of H × W × C, the process initiates with the application of low-pass and high-pass decomposition filters, which segregate the feature map into approximation (low-frequency) and high-frequency components, respectively. Subsequent downsampling on these two components yields approximation low-frequency coefficients and detail high-frequency coefficients across horizontal, vertical, and diagonal orientations. This entire decomposition and downsampling workflow effectively preserves the fine-grained feature details that are indispensable for accurate peanut leaf disease detection. The wavelet basis function and scaling function corresponding to the one-dimensional first-level Haar transform are formally defined in Equation (1).
The definition of is given by Equation (2).
In Equation (2), j denotes the scale of the Haar wavelet in the image domain, corresponding to the order of the basis function, while k represents the directional component in two-dimensional images, indicating the sequence of the basis function.
The feature learning module is composed of standard 1 × 1 convolutional layers, batch normalization layers, and ReLU activation functions. By leveraging 1 × 1 convolutions to adjust channel dimensions for compatibility with subsequent network layers, this module excels at eliminating redundant feature information. This optimization enables deeper network layers to focus on learning critical discriminative features with higher efficiency, and the resulting feature maps retain richer fine-grained details that are vital for disease detection.
Unlike traditional downsampling approaches, the HWD downsampling module reduces the spatial resolution of feature maps while minimizing the loss of essential information and contextual details. In this work, the conventional downsampling blocks in the YOLOv8 baseline are replaced with the proposed HWD module. This architectural modification effectively mitigates information degradation during spatial dimension reduction, and crucially, it achieves this without causing a substantial increase in either parameter count or floating-point operations (FLOPs). As a result, the model’s ability to preserve peanut leaf disease-specific features is significantly enhanced, laying a solid foundation for accurate lesion identification
2.4.2. C2f-Dual Feature Extraction Module
The C2f-Dual module is an enhanced feature extraction module built upon the DualConv architecture. DualConv is a lightweight deep neural network, with its structure illustrated in Figure 6. It jointly employs 3 × 3 and 1 × 1 convolution kernels. The 3 × 3 kernel captures richer spatial information during feature extraction, while the 1 × 1 kernel facilitates cross-channel interaction and information integration without substantially increasing parameter count or computational complexity [28].
Figure 6.
Structure diagram of the DualConv module.
In DualConv, the parallel use of 3 × 3 and 1 × 1 convolutional kernels serves complementary roles: the former captures spatial contextual information, while the latter enables cross-channel feature interaction with minimal parameter overhead. Group convolution is further employed to organize filters efficiently, reducing computational complexity while preserving model accuracy [29]. For a standard convolutional layer producing an output feature map of size D × D × N, the input is convolved with N filters, each of dimensions K × K × M. The associated computational cost, denoted as FConv is formulated in Equation (3).
In the equation, M represents the number of input channels, and N denotes the number of convolutional filters.
In the DualConv architecture, the number of filter groups, denoted as G, determines the ratio of K × K convolution kernels within each group. Specifically, within a convolutional layer comprising G filter groups, the proportion of filters that combine K × K and 1 × 1 kernels across all channels is 1/G, while the remaining filters consist solely of 1 × 1 kernels, accounting for a proportion of 1 − 1/G. Based on this configuration, the computational complexity contributed by the combined K × K and 1 × 1 kernels in a dual-convolution layer with G groups, denoted as FD1 can be expressed as shown in Equation (4).
For the remaining filters composed exclusively of 1 × 1 convolution kernels, the corresponding computational complexity, denoted as FD2, is given by Equation (5).
Combining the contributions from both kernel types, the total computational complexity of the DualConv layer, FDualConv, can be derived as shown in Equation (6).
As indicated in Equation (6), the kernel size K in DualConv is typically set to 3. When the number of groups G is sufficiently large, the DualConv structure increasingly resembles a standard convolution composed entirely of 1 × 1 kernels, thereby reducing computational complexity to approximately one-ninth of that incurred by conventional convolutions and yielding substantial efficiency gains [30]. Based on this principle, the present study incorporates DualConv into the Bottleneck module to construct a Bottleneck-Dual module, which is subsequently integrated into the C2f framework. The resulting module is denoted as C2f-Dual, with its architecture depicted in Figure 7. By leveraging group convolution, the C2f-Dual module effectively reduces computational cost while minimizing the loss of feature information.
Figure 7.
Structure diagram of the C2f-Dual module. Note: n is the number of Bottleneck-Dual module repetitions.
2.4.3. Slim-Neck Network
To balance detection accuracy and real-time performance while reducing computational cost in peanut leaf disease detection, this study adopts the Slim-Neck architecture to enhance the neck feature fusion network of YOLOv8. The neck module serves as a critical bridge between the backbone network and the detection head, responsible for efficient multi-scale feature fusion and propagation, which substantially influences final detection performance [31].
In the pursuit of lightweight network design, Depthwise Separable Convolution (DSConv) was initially explored as an alternative to standard convolution. While DSConv substantially reduces parameter count and computational burden, its channel-wise independent processing tends to cause semantic information loss during spatial compression and channel expansion, which can impair disease classification performance. To mitigate this issue, the GSConv module was adopted. This module fuses elements of group convolution and depthwise separable convolution, with the objective of lowering model complexity while preserving—or even strengthening—feature representation capability [32]. The structure of GSConv is presented in Figure 8. By integrating group-wise and per-channel operations, this design promotes cross-channel information exchange and feature reuse, establishing a solid basis for the development of more efficient lightweight feature fusion modules.
Figure 8.
Structure diagram of the GSConv module.
Another part of reconstructing the Slim-Neck network involves replacing the C2f module in the neck network section with the VoV-GSCSP network architecture. This combines GSConv with the concept of cross-level connections. Within the network neck structure, GSConv technology is integrated with the hierarchical interaction mechanism unique to VoV-GSCSP, forming a cross-level connection design analogous to a residual network, as illustrated in Figure 9. The VoV-GSCSP module employs an aggregation strategy to design the cross-layer network section, replacing the original neck C2f module. This approach reduces computational burden, simplifies network complexity [33], and simultaneously enhances model performance. By integrating GSConv and VoV-GSCSP, Slim-Neck optimizes and reconstructs the original model’s neck module, lowering computational requirements while improving detection accuracy.
Figure 9.
Structure diagram of the VoV-GSCSP module.
2.4.4. MHSA Attention Mechanism
Peanut plants in field settings typically grow with dense foliage, which leads to varying degrees of leaf occlusion when observed and identified from fixed angles and distances. At the same time, background soil regions that are irrelevant to the detection task are often included in the field of view, introducing interference from extraneous background information. Incorporating an attention mechanism enables the model to direct its focus toward target regions, thereby mitigating the interference caused by irrelevant background clutter and improving computational accuracy. Furthermore, the attention mechanism reduces redundant computations, leading to more efficient feature extraction.
The Multi-Head Self-Attention (MHSA) mechanism, which was first introduced in the Transformer architecture [34], has emerged as a fundamental building block in deep learning for modeling sequential dependencies. By computing multiple self-attention heads in parallel, MHSA empowers the network to capture a diverse array of relational patterns within input sequences, thereby significantly enhancing its representational capacity. The detailed structure of the MHSA mechanism is illustrated in Figure 10.
Figure 10.
Structure diagram of MHSA.
By modeling long-range dependencies between visual features, the Multi-Head Self-Attention (MHSA) mechanism substantially enhances a model’s capacity to encode global contextual information, which has led to its widespread adoption across computer vision applications. The core innovation of MHSA lies in the seamless integration of multi-head computation with the self-attention paradigm. Through the projection and interaction of query (Q), key (K), and value (V) matrices, the mechanism computes attention weights that quantify the relevance between each spatial position and all other positions within a feature map, thereby enabling adaptive feature recalibration [35]. Specifically, the input feature sequence X is transformed into three distinct representations—Q, K, and V—via separate linear projections, which are then partitioned into h parallel subspaces, as mathematically formulated in Equation (7).
where are learnable weight matrices.
Subsequently, multiple self-attention heads are computed in parallel to capture information from different subspaces, as shown in Equations (8) and (9).
In the formula, is the attention matrix obtained by computing the dot product between the query matrix Q and the key matrix K, representing the similarity between Q and K. The in the denominator prevents gradient vanishing caused by excessively large dot products. The result is normalized via the Softmax function to obtain the attention weight distribution for each head. This is then multiplied by the value matrix V to yield the weighted output.
The outputs from all attention heads are concatenated and passed through a linear transformation to generate the final multi-head attention representation, as defined in Equation (10).
where is the linear transformation matrix mapping the concatenated result to the output dimension.
By computing feature correlations across the entire image through self-attention, MHSA effectively captures the intricate relationships between distinct spatial regions, which directly contributes to improved detection accuracy. Integrating MHSA into the backbone network enhances the YOLO model’s capacity for global feature extraction and broadens its effective receptive field, thereby strengthening its overall performance in peanut leaf disease detection tasks.
3. Results
3.1. Experimental Platform
Model training and optimization were conducted on a rented server running Ubuntu 20.04 (Linux). The hardware configuration consisted of a 20vCPU Intel® Xeon® Platinum 8470Q processor, an NVIDIA RTX 4090 graphics card with 24 GB of VRAM, and 50 GB of RAM. The deep learning model was developed using the PyTorch 2.0.0 framework, with Python 3.8 and CUDA 11.8. Model weights were saved every 25 training epochs. The hyperparameter settings for the training strategy are summarized in Table 2.
Table 2.
Hyperparameter settings.
3.2. Evaluation Metrics
This study evaluates the proposed model using seven metrics: precision (P), recall (R), mean average precision at 50% (mAP50), frames per second (FPS), number of parameters (Parameters), and computational cost (GFLOPs) [36]. The calculation formulas for each metric are as follows.
where TP denotes correctly classified peanut leaf disease samples by the object detection model, FP denotes incorrectly classified peanut leaf disease samples, and FN denotes unidentified peanut leaf disease samples.
Here, Nc represents the total number of objects in the target dataset; APi denotes the average precision for class i; mAPt refers to the mean average precision at IoU threshold t (with a step size of 0.05 and a total of 10 values); mAP50 represents the average detection precision for peanut leaf disease targets when the IoU weight is 0.5, primarily reflecting the model’s ability to identify diseased targets; mAP50-95 represents the average of the average accuracy values across IoU thresholds ranging from 0.5 to 0.95, placing greater emphasis on evaluating the model’s localization accuracy.
3.3. Comparative Experiment of C2f-Dual Feature Fusion Module
Within the backbone network of YOLOv8, the native C2f unit leverages a multi-branch residual framework to facilitate fine-grained feature fusion, enabling the effective integration of shallow low-level features and deep semantic features and thereby strengthening the model’s feature representation capability; to validate the performance of the proposed C2f-Dual module in peanut leaf disease detection and further advance lightweight optimization, a comparative experiment was conducted using the optimized YOLOv8-MS as the baseline model, where three mainstream C2f-based feature fusion modules—C2f-Ghost [37], C2f-DynamicConv [38], and the newly designed C2f-Dual—were selected for comparative analysis, with evaluations performed from three key perspectives (detection accuracy, model complexity, and inference speed) and comprehensive experimental results detailed in Table 3.
Table 3.
Comparative experiment of C2f feature fusion modules.
Analysis of Table 3 reveals that all four C2f-based feature fusion modules achieve varying degrees of reduction in computational complexity and parameter count, thereby facilitating model lightweighting. Among these variants, the C2f-Dual module delivers the most favorable performance across multiple key evaluation metrics. Specifically, it attains 90.08% precision, 82.98% recall, 91.15% mAP50 and 72.38% mAP50-95, while maintaining an inference speed of 505.41 FPS, outperforming all other competing methods. Relative to the baseline YOLOv8-MS, the C2f-Dual module reduces parameter count and computational load by 5.3% and 6.7%, respectively, showcasing desirable lightweight properties. Conversely, while the C2f-Ghost module exhibits notable advantages in terms of computational complexity and parameter reduction, its detection accuracy is inferior to that of the proposed C2f-Dual, resulting in diminished precision in leaf disease identification. Collectively, the C2f-Dual module proposed in this work achieves a more favorable trade-off among detection accuracy, model complexity, and inference efficiency.
3.4. Comparative Experiment of Slim-Neck Network
The neck network plays a crucial role in further processing and fusing features extracted by the backbone, enhancing feature representation and improving detection performance across different object scales. An appropriately designed neck module can help address challenges in detecting peanut leaf diseases, particularly those with similar visual characteristics or those affected by occlusion. To evaluate the effectiveness of the Slim-Neck architecture in this context, a comparative experiment was conducted using YOLOv8-M integrated with the MHSA attention mechanism as the baseline model. The Slim-Neck module was compared with several commonly used neck networks in object detection, including BiFPN [39], iAFF [40], and ASF [41]. The experimental results are summarized in Table 4.
Table 4.
Comparative experiment of neck networks.
Table 4 summarizes the results of comparative experiments investigating the performance of distinct network architectures, and the findings confirm that integrating the Slim-Neck network brings about a notable enhancement in overall detection capability, with the modified model attaining 89.41% precision (P), 82.32% recall (R), and a 90.64% mAP50 score, as well as 70.90% mAP50-95. Although its mAP50-95 is slightly lower than that of BiFPN and iAFF modules, its lightweight advantage is extremely prominent. Beyond these accuracy improvements, the Slim-Neck variant also stands out as the most compact architecture in terms of parameter volume and computational cost, achieving a 6.5% reduction in parameters and a 10.7% decrease in GFLOPs when compared to the baseline YOLO-M model; this substantial reduction in model complexity successfully meets the design goal of lightweighting. Moreover, the model delivers an inference speed of 534.24 FPS, outperforming the other three comparative architectures and thus proving more suitable for real-time detection scenarios. Collectively, these neck network experiments verify that the Slim-Neck design successfully balances detection accuracy and computational efficiency: it drastically reduces computational overhead and accelerates inference speed without sacrificing detection precision, making it an extremely viable solution for practical peanut leaf disease detection applications.
3.5. Comparative Experiment of Attention Mechanisms
Attention mechanisms can significantly enhance neural networks’ ability to recognize task objectives. To thoroughly analyze the impact of different attention mechanism modules on network model performance, this study designed five sets of comparative experiments. Using YOLOv8 as the base model, common attention mechanisms SE [42], CBAM [43], ECA [44], and two novel attention mechanisms LSKblock [45] and MHSA to enhance the YOLOv8 network. These modifications were integrated into the upper layer of SPPF, and comparative detection performance tests were conducted on a peanut leaf disease dataset under identical server platforms. Table 5 presents the detection results comparing the performance of different attention mechanisms.
Table 5.
Comparative experiment of attention mechanisms.
Analysis of Table 5 shows that integrating different attention mechanisms into YOLOv8 leads to a slight increase in both parameter count and computational complexity. The inclusion of CBAM, SE, and LSKblock each improves detection performance to varying extents. Notably, the introduction of the Multi-Head Self-Attention (MHSA) mechanism yields the most significant improvement in identifying diseased regions. On the peanut leaf disease dataset constructed in this study, the model achieves 89.57% precision, 81.51% recall, 90.04% mAP50 and70.25% mAP50-95 all of which exceed the baseline metrics. These results indicate that, compared with other attention mechanisms, MHSA more effectively directs the model’s focus toward disease-affected areas while suppressing interference from irrelevant background information, thereby enhancing overall recognition accuracy. During image processing, MHSA leverages its self-attention mechanism to compute feature correlations across the entire image, effectively capturing relationships among different regions and contributing to improved detection accuracy. By incorporating MHSA into the backbone network, the YOLO model benefits from enhanced global feature extraction and an expanded receptive field, which collectively boost its performance in peanut leaf disease detection.
3.6. Ablation Experiments
To thoroughly quantify the contribution of the proposed optimization strategy to the model’s overall performance, ablation studies were carried out with YOLOv8 set as the foundational baseline. The efficacy of each enhanced component was investigated through both standalone integration and synergistic combinations of multiple modules. Specifically, a suite of eight ablation experiments was formulated and executed under unified training hyperparameters and identical hardware configurations to ensure the validity and comparability of the results. The comprehensive outcomes of these ablation analyses are tabulated in Table 6.
Table 6.
Ablation experiments.
As illustrated in Table 6, the integration of the MHSA module into the baseline YOLOv8 leads to a minor increase in computational complexity and parameter volume, yet yields notable performance gains, with precision (P) and mAP50 improved by 2.9% and 0.8%, respectively. Following the adoption of the Slim-Neck module, the model exhibits substantial enhancements across detection accuracy and speed, achieving 88.94% precision, 90.04% mAP50, and an inference speed of 549.94 FPS. When the C2f-Dual module is deployed in isolation, the model maintains its mAP50 performance while reducing parameter count and computational load by 5.1% and 6.1%, respectively. Similarly, the standalone application of the HWD module results in a negligible 0.1% drop in mAP50, accompanied by a 2.2% increase in precision, alongside 7.2% and 6.1% reductions in parameters and computational cost, thereby significantly mitigating computational overhead.
Furthermore, the synergistic combination of the MHSA and Slim-Neck modules empowers the YOLOv8-MS model to achieve simultaneous improvements in detection accuracy and lightweighting relative to the original architecture. When the MHSA, Slim-Neck, and C2f-Dual modules are deployed concurrently, the YOLOv8-MSD variant attains a peak mAP50 of 91.15% while delivering further reductions in computational overhead. The full integration of all four enhanced modules culminates in the YOLOv8-MSDH model, which delivers optimal overall detection performance. This configuration achieves precision and mAP50 scores of 90.14% and 90.71%, respectively, with parameter count and computational load reduced by 12.9% and 20.7% compared to the baseline. Although FPS experiences a slight decline, it remains at a high level, demonstrating robust real-time detection capabilities. It is worth noting that while YOLOv8-MSD achieves an mAP50 of 91.15%, which is higher than the 90.71% achieved by YOLOv8-MSDH, this is because the primary goal of the HWD module is model lightweighting rather than improving accuracy: after incorporating HWD, the number of parameters is reduced by 7.7% and computational complexity is reduced by 7.1%. Although mAP50 has decreased slightly, this trade-off is acceptable in resource-constrained edge deployment scenarios.
In summary, the ablation experiments confirm that the four proposed modules enhance model performance across multiple metrics while reducing parameters and computational complexity, thereby significantly lowering computational costs without sacrificing high inference speed. This work presents an efficient and practical technical solution, providing novel insights and methodologies for advancing detection tasks in this domain.
3.7. Comparative Experiment of Improved YOLOv8-MSDH Model
To validate the superiority of the YOLOv8-MSDH peanut leaf disease detection model in identifying target leaf diseases under natural field conditions, comparative experiments were performed between the original YOLOv8n model and the improved YOLOv8-MSDH model under identical training parameters and hardware environments. Table 7 presents the comprehensive performance metrics of each model before and after the architectural improvements were implemented.
Table 7.
Detection performance of the model before and after improvement.
Table 7 offers a rigorous quantitative comparison between the proposed YOLOv8-MSDH model and the baseline YOLOv8 specifically for peanut leaf disease detection tasks. The results demonstrate that YOLOv8-MSDH achieves a 3.5% gain in precision, a 0.7% increase in recall, a 1.5% rise in mAP50 and a 2.89% increase in mAP50-95 which collectively verify a marked improvement in overall detection accuracy. Simultaneously, the architectural optimizations result in a 12.9% reduction in parameter count and a 20.7% decrease in computational complexity. Although there is a slight drop in FPS, the inference speed remains sufficiently high to maintain real-time detection capabilities. As a result, YOLOv8-MSDH effectively reduces the consumption of computational resources and storage space while preserving high detection throughput, rendering it highly suitable for the efficient and accurate real-time diagnosis of peanut leaf diseases in complex field environments.
Figure 11 visualizes the evolution of loss functions and accuracy metrics throughout the training process, contrasting the improved model with the baseline. YOLOv8-MSDH exhibits accelerated convergence rates for both bounding box regression loss and classification loss, ultimately settling at lower loss values. This outcome reflects superior learning efficiency and convergence quality, particularly in the critical tasks of lesion localization and disease category identification. Moreover, the recall and mAP50 curves further validate that the optimized model not only converges more rapidly but also achieves superior final performance metrics compared to the original YOLOv8. Taken together, these findings demonstrate that the proposed model ensures more stable training convergence, possesses enhanced capabilities for target recognition and localization, and delivers superior detection performance and robustness when deployed for peanut leaf disease detection tasks.
Figure 11.
Model loss function and accuracy curves.
Figure 12 demonstrates the detection performance of YOLOv8 and the improved YOLOv8-MSDH model developed in this study for different diseases and leaves at varying depths. The red boxes indicate disease-affected leaves missed or misclassified by the models. Both models exhibit excellent detection capabilities when identifying single or surface-level targets. However, the original YOLOv8 model not only frequently misses obscured and deep-seated leaf targets but also misclassifies the visually similar Alternaria and Leaf Spot diseases. This stems primarily from the model’s insufficient focus on leaf disease features, hindering its ability to effectively capture diseased leaves in complex backgrounds and distinguish between similar characteristics. In contrast, the YOLOv8-MSDH model effectively reduces both false negative and false positive rates. It demonstrates superior recognition, capture, and differentiation capabilities for severely obscured leaves, leaves in depth, and the two diseases with similar features, highlighting the YOLOv8-MSDH model’s superior leaf disease detection performance.
Figure 12.
Comparison of detection results between the original and improved models.
3.8. 5-Fold Cross-Validation Experiments
To evaluate the statistical stability and generalization ability of the YOLOv8-MSDH model, this study employed 5-fold cross-validation to retrain and evaluate the model. The original training set (3888 augmented images) was randomly divided into five subsets of equal size, with each subset containing approximately 778 images. In each experiment, four of these subsets were selected for training, while the remaining subset was excluded from that training run. To prevent data leakage between training subsets, the original validation set was used for performance evaluation in all five experiments. The process was repeated five times to ensure that each subset was excluded exactly once. Each experiment used the same hyperparameter settings as those in Table 1, and relevant evaluation metrics—including P, R, mAP50, and mAP50-95—were recorded. The results of the five experiments, along with their means and standard deviations, are shown in Table 8.
Table 8.
Results of the 5-fold cross-validation experiment.
Analysis of Table 8 shows that, under 5-fold cross-validation, the YOLOv8-MSDH model achieved mean values of 88.49%, 81.51%, 90.11%, and 71.12% for P, R, mAP50, and mAP50-95, respectively. Since the number of samples in the training set for this cross-validation experiment was reduced by 20% compared to the original training set, it is normal for accuracy metrics such as P and R to show a slight decrease. The standard deviations for these metrics are 0.75%, 0.64%, 0.37%, and 0.37%, respectively. Since all standard deviations are less than 1%, this indicates that the model’s performance is insensitive to the training data partitioning method, demonstrating good statistical stability and generalization robustness. This further validates the model’s effectiveness and reliability in the task of detecting leaf diseases in peanuts.
3.9. Comparison with Mainstream Detection Models
To conduct a rigorous validation of the YOLOv8-MSDH model’s superiority for the target task, a comprehensive comparative analysis was carried out against a suite of state-of-the-art object detection frameworks. The selected baselines included representative models from the YOLO series—YOLOv5 [46], YOLOv7 [47], YOLOv8, YOLOv10 [48], and YOLOv11 [49]—alongside the RT-DETR [50] detector. To guarantee the fairness and cross-model comparability of the experimental results, all models were trained under uniform conditions, with strict adherence to the hyperparameter configurations outlined in Table 1. A standardized evaluation protocol was additionally implemented to eliminate performance discrepancies caused by variations in training strategies, ensuring that the final experimental outcomes accurately reflect the intrinsic performance characteristics of each network architecture. The systematic performance differences observed between the various detection models are detailed in Table 9.
Table 9.
Performance comparison of different models.
Quantitative analysis of Table 9 underscores the superior accuracy of the YOLOv8-MSDH algorithm, which attains an mAP50 of 90.71%. This represents respective improvements of 1.86%, 1.03%, 1.46%, 2.25%, 1.51%, and 1.1% over YOLOv5, YOLOv7, YOLOv8, YOLOv10, YOLOv11, and RT-DETR. Beyond mAP50, the precision (P) of the optimized model also exhibits comprehensive and significant gains relative to all comparative baselines.
In terms of computational efficiency, while YOLOv8-MSDH is not as lightweight as YOLOv5 and exhibits comparable complexity to YOLOv11, its parameter count and computational load remain markedly lower than those of the other competing models. Regarding real-time inference performance, YOLOv8-MSDH demonstrates exceptional capability with a frame rate of 509.95 FPS. Although this value is marginally lower than YOLOv10’s 531.62 FPS, it still maintains a high level of real-time responsiveness, validating the model’s suitability for time-sensitive detection scenarios.
When evaluating the trade-off between accuracy, computational cost, and real-time performance holistically, YOLOv8-MSDH outperforms all alternative approaches by a considerable margin. It not only preserves high recognition accuracy for peanut leaf diseases but also ensures low computational overhead and robust real-time detection capabilities. These attributes lay a solid technical foundation for the deployment of the proposed algorithm on edge and mobile computing devices.
3.10. Comparison with Existing Disease Detection Studies
To validate the effectiveness of the YOLOv8-MSDH model proposed in this study for peanut leaf disease detection, we conducted a systematic comparison with various mainstream plant disease detection methods from recent studies of a similar nature. The compared methods include the ESM-YOLOv11 [2] model for peanut leaf spot disease, the PEW-YOLO [13] model for citrus pests and diseases, the YOLOv8n-DSG model [15] for tomato diseases, and the YOLOv8-LSW model [16] for bitter melon diseases. A comparison of the performance of these methods is shown in Table 10.
Table 10.
Performance comparison with recent studies of a similar nature.
An analysis of Table 10 reveals the following shortcomings in existing methods: Studies [2] and [15] detect only a single disease and have not validated their generalization capabilities in scenarios involving the classification of multiple disease categories. Although Study [13] detects five types of citrus pests and diseases, its confusion matrix indicates significant misclassification issues, and its ability to distinguish between similar features needs improvement. Study [16] achieved a high mAP50 of 98.1%, but its dataset did not include scenarios involving the differentiation of similar diseases or occlusion, and the validation set consisted mostly of single-object images, resulting in a relatively low task difficulty. In contrast, the YOLOv8-MSDH model proposed in this study must simultaneously identify four types of peanut leaf diseases: Alternaria, Leaf Spot, Rust, and Rosette. Among these, Alternaria and Leaf Spot exhibit highly similar lesion morphologies, and the dataset includes complex scenarios such as leaf occlusion, making the task more challenging. This model achieves an mAP50 of 90.71% and a precision of 90.14%, with 2.62 million parameters and a computational cost of 6.5 GFLOPs. Overall, this model achieves a better balance among task complexity, detection accuracy, and model lightweighting, providing an effective technical solution for the intelligent identification of multiple diseases in peanut fields.
3.11. Grad-CAM Visualization Results
Gradient-weighted Class Activation Mapping (Grad-CAM) [51] is a gradient-informed visualization technique designed to interpret the decision-making logic of convolutional neural networks (CNNs). For the four categories of peanut leaf diseases investigated in this study, attention heatmaps were generated for the ninth layer of the original model (corresponding to the tenth layer in the improved architecture, due to the integration of an attention mechanism). These heatmaps intuitively illustrate the spatial distribution of the model’s focus during disease recognition. This study leverages Grad-CAM to conduct a comparative analysis between the baseline YOLOv8 and the improved YOLOv8-MSDH model, aiming to uncover disparities in their feature attention mechanisms and the fundamental reasons behind the observed performance gains. The Grad-CAM visualization results for both models, before and after the architectural improvements, are presented in Figure 13.
Figure 13.
Grad-CAM comparison.
As shown in Figure 13, YOLOv8 exhibits attention dispersion issues in disease detection, being susceptible to background interference such as soil or healthy leaves. It fails to adequately focus on core lesion features, resulting in diffuse activation regions and blurred boundaries in heatmaps. This leads to elevated rates of missed and false detections in complex scenarios, limiting its recognition robustness. In contrast, the improved YOLOv8-MSDH model establishes a superior attention allocation mechanism. It enhances focus on core disease features, effectively filters background interference, and demonstrates stronger target concentration and anti-interference capabilities. Heatmaps demonstrate that the YOLOv8-MSDH model exhibits concentrated activation regions with clear disease boundaries, enabling precise localization and classification. It demonstrates superior performance in distinguishing subtle differences among similar-featured diseases and handling complex characteristics like occluded lesions, significantly enhancing disease recognition accuracy and robustness in complex field environments.
4. Discussion
This work addresses the critical challenge of achieving precise and efficient peanut leaf disease detection within unconstrained field environments through the development of the lightweight YOLOv8-MSDH detection framework. By orchestrating the synergistic optimization of multiple integrated modules, the proposed methodology successfully strikes a favorable equilibrium between detection precision and computational efficiency. Grounded in the empirical findings and real-world deployment considerations, this section provides a comprehensive discussion on the model’s robustness to variations in illumination, delineates the inherent limitations of the current research, and proposes prospective avenues for subsequent investigation.
4.1. Detection Under Different Lighting Conditions
To assess the adaptability of the YOLOv8-MSDH model to fluctuating light environments in actual peanut fields, the experiment selected representative peanut leaf disease images captured under obvious sunny and overcast conditions from the original validation set for testing. Specifically, there are 261 sunny images and 275 overcast images, with the sample distribution of each disease category being basically balanced under the two illumination conditions. The quantitative detection performance under these distinct illumination scenarios is summarized in Table 11. Specifically, under sunny illumination, the model achieved a precision of 90.08%, an mAP50 of 90.64%, and an inference speed of 512.21 FPS. In contrast, under cloudy conditions, it recorded 90.11% precision, 90.31% mAP50, and a frame rate of 505.48 FPS.
Table 11.
Detection results under different lighting conditions.
Despite minor fluctuations in the numerical values of the evaluation metrics across the two lighting conditions, the YOLOv8-MSDH model consistently retained a high level of detection efficacy, which verifies its strong resilience to changes in ambient illumination. Qualitative detection results under varying light conditions are visualized in Figure 14, which further corroborates that the proposed model not only exhibits robust disease recognition capabilities across diverse lighting scenarios but also sustains a high real-time inference rate. These findings confirm that the model is well suited to meet the practical demands of on-site deployment in complex agricultural environments.
Figure 14.
Detection performance under different lighting conditions. Note: (a–c) Detection results under sunny conditions; (d–f) Detection results under cloudy conditions.
4.2. Research Limitations and Future Prospects
Building upon the original YOLOv8 model, this study leverages the synergistic effects of various enhancement modules. Within the constructed peanut leaf disease dataset, not only has detection accuracy been improved to a certain extent, but computational complexity and parameter counts of the detection model have also been effectively reduced through lightweighting modules. Despite these advances, three limitations remain: First, the constructed dataset only includes four common peanut leaf diseases—Alternaria, Leaf Spot, Rosette, and Rust—leaving the detection capability for other rare peanut leaf diseases unvalidated. Second, the samples do not cover peanut leaves across different growth stages, potentially affecting the model’s disease recognition performance during specific phases like seedling or flowering stages. Third, this research remains confined to the laboratory simulation phase and has not yet undergone actual terminal deployment or field engineering validation. The detection efficiency and disease recognition accuracy of this model in real hardware environments require further testing.
Future efforts can advance this research through multiple avenues to deepen its application and practical implementation. First, addressing the first two limitations, the dataset coverage should be expanded by collecting more samples of different disease types and samples from various growth stages of peanuts. Combining drone aerial photography with ground-based sampling can enhance the model’s ability to identify diseases at different detection heights, thereby improving its generalization capability. Second, further optimize the model architecture by exploring novel improvement methods. This aims not only to achieve collaborative judgments with high consistency probabilities for multiple leaf diseases on the same stem, thereby reducing misclassifications caused by similar disease features, but also to enhance the accuracy of identifying early-stage diseases with minute lesions. Finally, we aim to deploy the model for practical peanut cultivation by embedding it into field-based real-time detection systems. This system will integrate with intelligent spraying equipment to enable targeted pest control, reducing pesticide misuse while alleviating environmental pressure.
5. Conclusions
The innovation of this study does not lie in proposing entirely new basic modules, but rather in the targeted integration, optimization, and engineering innovations developed for the specific agricultural task of detecting leaf diseases in peanuts. To address the core challenges of distinguishing morphologically similar peanut leaf diseases and accurately identifying heavily occluded diseased leaves in unstructured agricultural environments, this paper presents YOLOv8-MSDH—a lightweight detector developed through targeted modular upgrades to the baseline YOLOv8 framework. The integration of the Multi-Head Self-Attention (MHSA) mechanism enhances the model’s ability to model long-range contextual dependencies while mitigating interference from irrelevant background clutter. The redesign of the neck network using the Slim-Neck architecture reduces computational overhead while enabling robust multi-scale feature aggregation across different feature pyramid levels. Replacing the native C2f module with the proposed C2f-Dual further optimizes computational efficiency, and the incorporation of the Haar wavelet-based downsampling (HWD) module into the backbone network enhances the preservation of fine-grained disease-specific features while contributing to overall model lightweighting.
Empirical results confirm that YOLOv8-MSDH achieves 90.14% precision, 82.16% recall, 90.71% mAP50 and 72.14% mAP50-95 in complex field environments, representing respective improvements of 3.5%, 0.7%, 1.5% and 2.89% over the original YOLOv8. These gains effectively mitigate false positive and false negative errors in peanut leaf disease detection. Moreover, architectural optimizations yield a 12.9% reduction in parameter count and a 20.7% decrease in computational load, realizing significant lightweighting. Despite a marginal 1.7 FPS reduction in inference speed, the model retains high real-time performance, making it amenable to deployment on resource-constrained mobile and edge devices. Additionally, YOLOv8-MSDH exhibits exceptional detection stability and strong robustness across varying illumination conditions in practical scenarios. Taken together, these comprehensive experiments fully validate the effectiveness and practical feasibility of the proposed YOLOv8-MSDH model for peanut leaf disease recognition tasks.
Notwithstanding its competitive performance, the present study is subject to several notable limitations that warrant consideration. First, the training dataset is confined to four prevalent peanut leaf disease categories and lacks representation of rare pathotypes as well as samples spanning different phenological growth stages of peanuts, which suggests that the model’s generalization capability remains amenable to further enhancement. Second, the research is presently limited to laboratory-based simulation experiments; end-device deployment and rigorous field validation have not yet been implemented. As such, the model’s detection efficacy in unregulated real-world agricultural settings necessitates additional empirical assessment.
Subsequent research efforts will prioritize three key directions. Primarily, we aim to substantially expand the diversity and scope of the dataset to address the current generalization gap. Secondly, the model architecture will be further refined to boost recognition accuracy for subtle lesions and morphologically analogous diseases that pose significant detection challenges. Finally, we will accelerate the engineering translation of the proposed method, with the ultimate goal of developing an integrated intelligent system that synergizes real-time field detection with automated pesticide application. This system is intended to provide critical technical underpinnings for yield preservation, quality improvement in large-scale peanut cultivation, and the advancement of precision smart plant protection practices.
Author Contributions
Conceptualization, Z.X. and J.Z.; methodology, Z.X. and X.L.; software, Z.X.; validation, J.Z. and X.L.; formal analysis, F.S.; investigation, W.M. and Z.X.; resources, X.L.; data curation, Z.X. and W.M.; writing—original draft preparation, Z.X.; writing—review and editing, Z.X., J.Z., X.L., W.M. and F.S.; funding acquisition, F.S. All authors have read and agreed to the published version of the manuscript.
Funding
This research was Supported by the Natural Science Foundation of Sichuan Province, China (Grant No. 2026NSFSC1511).
Data Availability Statement
The dataset supporting this research is available within the article. Data access requests should be addressed to the corresponding author.
Conflicts of Interest
The authors declare no conflicts of interest.
References
- NetEase News. Global Peanuts: Changes in Production and Exports, with Variations Among Major Countries NetEase News. 3 March 2025. Available online: https://www.163.com/dy/article/JPONPQH30519D4UH.html (accessed on 21 January 2026).
- Zhang, Y.; Liu, J.; Li, S.; Feng, S.; Sun, Z.; Cui, Y.; Liu, H.; Zhang, J.; Cheein, F.A.; Guo, W. ESM-YOLOv11: A lightweight deep learning framework for real-time peanut leaf spot disease detection and precision severity quantification in field conditions. Comput. Electron. Agric. 2025, 238, 110801. [Google Scholar] [CrossRef] [Scilit]
- Sun, J.; Feng, Z.; Han, J.; Xu, F.; Zhang, H.; Guo, Y. YOLO-PLNet: A lightweight real-time detection model for peanut leaf diseases based on edge deployment. Front. Plant Sci. 2025, 16, 1707501. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Lu, J.; Lee, W.S.; Gan, H.; Hu, X. Immature citrus fruit detection based on local binary pattern feature and hierarchical contour analysis. Biosyst. Eng. 2018, 171, 78–90. [Google Scholar] [CrossRef] [Scilit]
- Wu, G.; Li, B.; Zhu, Q.; Huang, M.; Guo, Y. Using color and 3D geometry features to segment fruit point cloud and improve fruit recognition accuracy. Comput. Electron. Agric. 2020, 174, 105475. [Google Scholar] [CrossRef] [Scilit]
- Dubey, S.R.; Jalal, A.S. Apple disease classification using color, texture and shape features from images. Signal Image Video Process. 2016, 10, 819–826. [Google Scholar] [CrossRef] [Scilit]
- Xia, M.; Chen, X.; Tian, X.; Wen, H.; Zhao, Y.; Liu, H.; Liu, W.; Zheng, Y. Lightweight Deep Learning for Real-Time Cotton Monitoring: UAV-Based Defoliation and Boll-Opening Rate Assessment. Agriculture 2025, 15, 2095. [Google Scholar] [CrossRef] [Scilit]
- Xie, F.; Xie, M.; Wang, C.; Li, D.; Zhang, X. PDCG-Enhanced CNN for Pattern Recognition in Time Series Data. Biomimetics 2025, 10, 263. [Google Scholar] [CrossRef] [Scilit]
- He, F.; Fu, T.Y.; Lee, W.C. Rel-CNN: Learning relationship features in time series for classification. IEEE Trans. Knowl. Data Eng. 2022, 35, 7412–7426. [Google Scholar] [CrossRef] [Scilit]
- Kang, S.; Hu, Z.; Liu, L.; Zhang, K.; Cao, Z. Object detection YOLO algorithms and their industrial applications: Overview and comparative analysis. Electronics 2025, 14, 1104. [Google Scholar] [CrossRef] [Scilit]
- Vijayakumar, A.; Vairavasundaram, S. Yolo-based object detection models: A review and its applications. Multimed. Tools Appl. 2024, 83, 83535–83574. [Google Scholar] [CrossRef] [Scilit]
- Yogeswararao, G.; Naresh, V.; Malmathanraj, R.; Palanisamy, P. An efficient densely connected convolutional neural network for identification of plant diseases. Multimed. Tools Appl. 2022, 81, 32791–32816. [Google Scholar] [CrossRef] [Scilit]
- Xue, R.; Wang, L. Research on Lightweight Citrus Leaf Pest and Disease Detection Based on PEW-YOLO. Processes 2025, 13, 1365. [Google Scholar] [CrossRef] [Scilit]
- Li, R.; Li, Y.; Qin, W.; Abbas, A.; Li, S.; Ji, R.; Wu, Y.; He, Y.; Yang, J. Lightweight network for corn leaf disease identification based on improved YOLO v8s. Agriculture 2024, 14, 220. [Google Scholar] [CrossRef] [Scilit]
- Chen, M.; Wang, C.; Liu, C.; Yu, Y.; Yuan, Y.; Ma, J.; Zhang, K. Tomato leaf disease detection method based on improved YOLOv8n. Sci. Rep. 2025, 15, 25837. [Google Scholar] [CrossRef] [Scilit]
- Liu, S.; Xu, H.; Deng, Y.; Cai, Y.; Wu, Y.; Zhong, X.; Zheng, J.; Lin, Z.; Ruan, M.; Chen, J.; et al. YOLOv8-LSW: A Lightweight Bitter Melon Leaf Disease Detection Model. Agriculture 2025, 15, 1281. [Google Scholar] [CrossRef] [Scilit]
- Zhou, S.; Yin, W.; He, Y.; Kan, X.; Li, X. Detection of Apple Leaf Gray Spot Disease Based on Improved YOLOv8 Network. Mathematics 2025, 13, 840. [Google Scholar] [CrossRef] [Scilit]
- Srivastava, M.; Sisaudia, V.; Meena, J. AgriTL-ViT: A Vision Transformer model with attention techniques for classification of plant leaf disease. Expert Syst. Appl. 2025, 294, 128793. [Google Scholar] [CrossRef] [Scilit]
- Aboelenin, S.; Elbasheer, F.A.; Eltoukhy, M.M.; El-Hady, W.M.; Hosny, K.M. A hybrid framework for plant leaf disease detection and classification using convolutional neural networks and vision transformer. Complex Intell. Syst. 2025, 11, 142. [Google Scholar] [CrossRef] [Scilit]
- Sasmal, B.; Das, A.; Dhal, K.G.; Saheb, S.B.; Khurma, R.A.; Castillo, P.A. A novel groundnut leaf dataset for detection and classification of groundnut leaf diseases. Data Brief. 2024, 55, 110763. [Google Scholar] [CrossRef] [Scilit]
- Zhou, J.; Sun, F.; Wu, H.; Lv, Q.; Feng, F.; Zhao, B.; Li, X. Kiwi-YOLO: A Kiwifruit Object Detection Algorithm for Complex Orchard Environments. Agronomy 2025, 15, 2424. [Google Scholar] [CrossRef] [Scilit]
- Gu, Z.; He, D.; Huang, J.; Chen, J.; Wu, B.; Huang, T.; Dong, Q.; Yang, H.; Li, H. Simultaneous detection of fruits and fruiting stems in mango using improved YOLOv8 model deployed by edge device. Comput. Electron. Agric. 2024, 227, 109512. [Google Scholar] [CrossRef] [Scilit]
- Wang, J.; Li, X.; Chen, J.; Zhou, L.; Guo, L.; He, Z.; Zhou, H.; Zhang, Z. DPH-YOLOv8: Improved YOLOv8 based on double prediction heads for the UAV image object detection. IEEE Trans. Geosci. Remote Sens. 2024, 62, 5647715. [Google Scholar] [CrossRef] [Scilit]
- Chen, T.; Zhang, J.; Chen, Y.; Wan, S.; Zhang, L. Detection of peanut leaf spots disease using canopy hyperspectral reflectance. Comput. Electron. Agric. 2019, 156, 677–683. [Google Scholar] [CrossRef] [Scilit]
- Pang, Y.; Li, Z.; Du, C.; Wang, Y.; Guo, Z. SHM-YOLO: Detection of occluded small objects in top-down views from tower cranes under adverse rain and snow conditions. Signal Image Video Process. 2025, 19, 1281. [Google Scholar] [CrossRef] [Scilit]
- Dai, S.; Bai, T.; Zhao, Y. Keypoint Detection and 3D Localization Method for Ridge-Cultivated Strawberry Harvesting Robots. Agriculture 2025, 15, 372. [Google Scholar] [CrossRef] [Scilit]
- Dai, J.; Ren, J.; Li, S. PHL-YOLO: A real-time lightweight yarn inspection method. J. Real-Time Image Process. 2025, 22, 20. [Google Scholar] [CrossRef] [Scilit]
- Chen, X.; Guo, X.; Yang, R. Crack Detection in Heritage Timber Structures Using an Improved YOLO-SDD. Int. J. Archit. Herit. 2025, 1–16. [Google Scholar] [CrossRef] [Scilit]
- Wang, H.; Zhang, Y.; Zhu, C. DAFPN-YOLO: An Improved UAV-Based Object Detection Algorithm Based on YOLOv8s. Comput. Mater. Contin. 2025, 83, 1929–1949. [Google Scholar] [CrossRef] [Scilit]
- Sun, T.; Zhang, S.; Ren, R.; Li, J.; Xia, Y. DAEF-YOLO Model for Individual and Behavior Recognition of Sanhua Geese in Precision Farming Applications. Animals 2025, 15, 3058. [Google Scholar] [CrossRef] [Scilit]
- Wang, J.; Qin, C.; Hou, B.; Yuan, Y.; Zhang, Y.; Feng, W. LCGSC-YOLO: A lightweight apple leaf diseases detection method based on LCNet and GSConv module under YOLO framework. Front. Plant Sci. 2024, 15, 1398277. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Zheng, H.; Liu, C.; Zhong, L.; Wang, J.; Huang, J.; Lin, F.; Ma, X.; Tan, S. An android-smartphone application for rice panicle detection and rice growth stage recognition using a lightweight YOLO network. Front. Plant Sci. 2025, 16, 1561632. [Google Scholar] [CrossRef] [Scilit]
- Zuo, Z.; Gao, S.; Peng, H.; Xue, Y.; Han, L.; Ma, G.; Mao, H. Lightweight detection of broccoli heads in complex field environments based on LBDC-YOLO. Agronomy 2024, 14, 2359. [Google Scholar] [CrossRef] [Scilit]
- Xie, Y.; Chen, L. CBLN-YOLO: An Improved YOLO11n-Seg Network for Cotton Topping in Fields. Agronomy 2025, 15, 996. [Google Scholar]
- Guo, B.; Ling, S.; Tan, H.; Wang, S.; Wu, C.; Yang, D. Detection of the grassland weed Phlomoides umbrosa using multi-source imagery and an improved YOLOv8 network. Agronomy 2023, 13, 3001. [Google Scholar] [CrossRef] [Scilit]
- Cheng, D.; Zhao, Z.; Feng, J. Rice diseases identification method based on Improved YOLOv7-Tiny. Agriculture 2024, 14, 709. [Google Scholar] [CrossRef] [Scilit]
- Ge, P.; Wan, M.; Qian, W.; Xu, Y.; Kong, X.; Gu, G.; Chen, Q. SGA-YOLO: A Lightweight Real-Time Object Detection Network for UAV Infrared Images. IEEE Trans. Intell. Transp. Syst. 2025, 26, 22432–22446. [Google Scholar] [CrossRef] [Scilit]
- Li, X.; Li, H.; Dai, J.; Liu, K.; Wang, G.; Nie, S.; Zhang, Z. MRV-YOLO: A Multi-Channel Remote Sensing Object Detection Method for Identifying Reclaimed Vegetation in Hilly and Mountainous Mining Areas. Forests 2025, 16, 1536. [Google Scholar] [CrossRef] [Scilit]
- Wu, W.; Chen, L. GS-BiFPN-YOLO: A Lightweight and Efficient Method for Segmenting Cotton Leaves in the Field. Agriculture 2025, 16, 102. [Google Scholar] [CrossRef] [Scilit]
- Sun, W.; Xu, M.; Xu, K.; Chen, D.; Wang, J.; Yang, R.; Chen, Q.; Yang, S. CSGD-YOLO: A Corn Seed Germination Status Detection Model Based on YOLOv8n. Agronomy 2025, 15, 128. [Google Scholar] [CrossRef] [Scilit]
- Kang, M.; Ting, C.M.; Ting, F.F.; Phan, R.C.W. ASF-YOLO: A novel YOLO model with attentional scale sequence fusion for cell instance segmentation. Image Vis. Comput. 2024, 147, 105057. [Google Scholar] [CrossRef] [Scilit]
- Hu, J.; Shen, L.; Sun, G. Squeeze-and-excitation networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–22 June 2018; pp. 7132–7141. [Google Scholar]
- Woo, S.; Park, J.; Lee, J.Y.; Kweon, I.S. Cbam: Convolutional block attention module. In Proceedings of the European Conference on Computer Vision (ECCV), Munich, Germany, 8–14 September 2018; pp. 3–19. [Google Scholar]
- Zhao, R.; Liao, C.; Yu, T.; Chen, J.; Li, Y.; Lin, G.; Huan, X.; Wang, Z. IMVTS: A detection model for multi-varieties of famous tea sprouts based on deep learning. Horticulturae 2023, 9, 819. [Google Scholar] [CrossRef] [Scilit]
- Yu, C.; Shi, X.; Luo, W.; Feng, J.; Zheng, Z.; Yorozu, A.; Hu, Y.; Guo, J. MLG-YOLO: A model for real-time accurate detection and localization of winter jujube in complex structured orchard environments. Plant Phenomics 2024, 6, 0258. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Cao, M.; Fu, H.; Zhu, J.; Cai, C. Lightweight tea bud recognition network integrating GhostNet and YOLOv5. Math. Biosci. Eng. 2022, 19, 12897–12914. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Jiang, K.; Xie, T.; Yan, R.; Wen, X.; Li, D.; Jiang, H.; Jiang, N.; Feng, L.; Duan, X.; Wang, J. An attention mechanism-improved YOLOv7 object detection algorithm for hemp duck count estimation. Agriculture 2022, 12, 1659. [Google Scholar] [CrossRef] [Scilit]
- Pan, W.; Chen, J.; Lv, B. Lightweight marine biodetection model based on improved YOLOv10. Alex. Eng. J. 2025, 119, 379–390. [Google Scholar] [CrossRef] [Scilit]
- Zou, C.; Yu, S.; Yu, Y.; Gu, H.; Xu, X. Side-scan sonar small objects detection based on improved YOLOv11. J. Mar. Sci. Eng. 2025, 13, 162. [Google Scholar] [CrossRef] [Scilit]
- Wang, S.; Jiang, H.; Yang, J.; Ma, X.; Chen, J.; Li, Z.; Tang, X. Lightweight tomato ripeness detection algorithm based on the improved RT-DETR. Front. Plant Sci. 2024, 15, 1415297. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Quach, L.D.; Quoc, K.N.; Quynh, A.N.; Ngoc, H.T.; Thai-Nghe, N. Tomato health monitoring system: Tomato classification, detection, and counting system based on YOLOv8 model with explainable MobileNet models using Grad-CAM++. IEEE Access 2024, 12, 9719–9737. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.

















