Abstract
Tomato leaf diseases seriously affect tomato production, and early image-based screening is important for assisted diagnosis under greenhouse or semi-controlled cultivation conditions. Traditional manual inspection methods are often inefficient and highly subjective. To address these limitations, this study proposes a lightweight tomato leaf disease detection model named HDR-YOLO, which integrates high-level semantic guidance and dynamic upsampling. First, a High-level Semantic Feature Pyramid Network (HSFPN) is introduced to reconstruct the feature fusion neck. This modification significantly reduces the parameter count while enhancing the fusion of semantic features. Second, a dynamic upsampling operator (DySample) replaces traditional upsampling techniques to minimize information loss during feature map expansion. Finally, Receptive Field Coordinate Attention Convolution (RFCAConv) is incorporated into the critical feature fusion path. This enhances spatial coordinate perception, thereby improving the recognition accuracy for diseases with complex textures, such as early blight. Experimental results demonstrate that HDR-YOLO achieves a mean average precision at an Intersection over Union of 0.5 (mAP(0.5%)) of 79.5% on the test dataset. Compared to the baseline YOLOv12n model, the proposed method increases mAP(0.5%) by 2.2% while reducing the number of parameters by approximately 29.5% and computational complexity by approximately 14.3%. HDR-YOLO achieves efficient and accurate detection, providing a lightweight image-based framework for tomato leaf disease screening and assisted diagnosis under greenhouse or semi-controlled cultivation conditions.
1. Introduction
1.1. Relevance of Tomato Leaf Disease Detection
Tomatoes are an important economic crop cultivated worldwide in both greenhouse and open-field production systems. In this study, we focus on image-based tomato leaf disease detection under greenhouse or semi-controlled cultivation conditions, where leaf images can be obtained in relatively stable imaging environments. Such application conditions are suitable for evaluating lightweight detection models because disease symptoms can be screened efficiently while reducing the workload and subjectivity of manual inspection. Throughout their growth cycle, tomatoes are highly susceptible to pathogens such as fungi, bacteria, and viruses. These give rise to various leaf diseases, including early blight, late blight, leaf mold, and viral diseases, which are characterized by rapid transmission and widespread impact. If these diseases are not detected and controlled in a timely manner, they can cause severe damage to plant growth, not only weakening the overall health of the plant but also hindering fruit development and reducing total yield. Currently, the detection of tomato leaf diseases primarily relies on manual visual inspection by farmers and agricultural experts [1]. While this approach may provide preliminary diagnostic suggestions, the results are often influenced by the subjective experience of the evaluator and varying observation conditions. Furthermore, inconsistent criteria for symptom interpretation frequently lead to unreliable detection outcomes. As modern agriculture evolves toward precision and intelligence, the use of computer vision technology to achieve automated, non-destructive detection of crop diseases has become both an urgent requirement and an inevitable trend [2]. However, the automated detection of tomato leaf diseases faces multiple visual challenges. (1) Extreme variations in lesion scale: For instance, early blight often manifests as large concentric rings, whereas bacterial spots appear as tiny, needle-like dots. This disparity places extremely high demands on the model’s scale invariance [3]. (2) Susceptibility to feature loss: During the multi-layer downsampling process of deep neural networks, the semantic information of tiny lesions is easily diluted. Consequently, their texture features tend to disappear in deep feature extraction, leading to missed detections. (3) Complex texture characteristics: Certain tomato lesions exhibit fine, directional concentric rings that are easily overwhelmed by the dense physiological textures of the leaves, making it difficult for traditional models to achieve precise localization. Therefore, developing a compact and efficient detection algorithm capable of capturing fine-grained lesion details is essential for image-based tomato leaf disease screening and assisted diagnosis under greenhouse or semi-controlled cultivation conditions.
1.2. Recent Advances and Limitations of Existing Studies
In recent years, the rapid development of deep learning technology has enabled target detection methods based on Convolutional Neural Networks (CNNs) to achieve substantial progress in the agricultural field. By leveraging powerful image processing capabilities and automated feature learning, CNNs provide a novel solution for the rapid detection of tomato leaf diseases [4]. In tomato disease detection tasks, models such as Faster R-CNN, SSD, EfficientDet, and YOLO have been widely applied. However, these models still face certain limitations in practical deployment: Faster R-CNN suffers from high computational complexity and limited inference speed due to its two-stage detection architecture [5]. SSD exhibits poor detection performance when dealing with small-target diseases and struggles to achieve an optimal balance between speed and precision [6]. Although EfficientDet offers high precision, its inference speed is relatively slow, and its training process demands significant computational resources, making it difficult to deploy in resource-constrained edge device environments [7]. As an advanced object recognition model, YOLO has gained widespread recognition for its end-to-end detection capabilities, exceptional efficiency, and accuracy in capturing local features. It is particularly noted for its ability to reduce background false detections and its suitability for deployment on edge devices. To further enhance model performance in complex agricultural environments, researchers have conducted extensive explorations in areas such as lightweight model design, feature fusion mechanisms, and attention enhancement. In agricultural scenarios, where lesions are often similar in color to the background foliage or are obscured by occlusion, attention mechanisms have become a key means of addressing these challenges. Kang et al. [8] proposed a lightweight network, YOLO-TGI, which integrates Ghost convolution with the Convolutional Block Attention Module (CBAM). This approach significantly reduces computational overhead while maintaining high detection precision. Wang et al. [9] incorporated the Sub-Element Attention Mechanism (SEAM) and Mixed Local Channel Attention (MLCA) to enhance the model’s ability to detect key disease features, ultimately achieving a of 90.6% on the test set. The feature fusion capability of the Neck network directly determines the model’s detection performance for multi-scale targets. Although the traditional FPN + PANet structure is effective, it suffers from significant semantic information redundancy when processing multi-level features. To address this issue, some studies have attempted to introduce more efficient aggregation structures. For instance, Wang et al. [10] introduced BiFPN into YOLOv10 to optimize feature fusion and improve the extraction of small lesion areas, resulting in a 3.9% increase in . Furthermore, for the detection of small targets such as tomato bacterial spots, traditional nearest-neighbor upsampling often leads to blurred edges. Abuizi et al. [11] integrated the DySample dynamic upsampling module and the MPDIoU loss function into YOLOv9, significantly enhancing the model’s localization capability for tiny lesions and achieving a of 86.4%. Similarly, Yao et al. [12] designed the C3k2_WTConv feature extraction module for YOLO11 and combined it with ADown downsampling and the DySample dynamic upsampling module; this integration improved by 1.9% while reducing the parameter count by 10%. In summary, although existing research has made various contributions to improving detection accuracy or reducing parameter counts, challenges remain in lightweight network design. While architectures such as MobileNet and ShuffleNet significantly reduce computational overhead, they often suffer from insufficient semantic information capture when processing tiny tomato lesions due to the excessive compression of channels [13,14]. Regarding feature fusion, traditional FPN or PANet structures often introduce significant redundant background noise when merging high-level and low-level features, failing to effectively highlight lesion areas [15,16]. In terms of attention mechanisms, most existing modules lack perception of spatial coordinate information, which results in limited localization accuracy when dealing with early blight characterized by complex textures or fragmented bacterial spots [17]. As for upsampling operators, commonly used methods (such as nearest-neighbor or bilinear interpolation) only enlarge feature maps through geometric transformations. They fail to adaptively recover lesion details based on content, leading to a secondary loss of information [18].
1.3. Objectives and Contributions of This Study
Based on the aforementioned challenges, this paper proposes a lightweight tomato leaf disease detection model based on High-level semantic guidance and Dynamic upsampling, abbreviated as HDR-YOLO. The primary contributions of this study are as follows:
- (1)
- Reconstruction of the feature fusion network: A High-level Semantic Feature Pyramid Network (HSFPN) is introduced. By filtering key feature channels, this network significantly reduces the number of model parameters while simultaneously enhancing the transmission of semantic information.
- (2)
- Application of a dynamic upsampling operator: The dynamic upsampling operator (DySample) is employed to replace traditional nearest-neighbor interpolation. By utilizing point sampling and dynamic weight mechanisms, it effectively minimizes detail loss during the upsampling process and improves the model’s perception of tiny lesions.
- (3)
- Integration of Receptive Field Coordinate Attention Convolution: RFCAConv is incorporated into the critical paths of feature fusion. This module combines receptive field expansion with coordinate attention mechanisms, enabling the simultaneous capture of large-scale texture features of early blight and the precise localization of small disease spots.
Through this multi-module synergistic design, HDR-YOLO is expected to enhance the representation and localization of multi-scale and tiny tomato leaf lesions while maintaining a compact model structure suitable for image-based disease screening under relatively controlled imaging conditions.
2. Materials and Methods
2.1. Dataset Acquisition
The data used in this study were primarily obtained from the publicly available PlantVillage dataset. The dataset was downloaded, screened, and organized in November 2025. The images in this dataset were mostly captured in laboratory environments and exhibit a high diversity of diseases. Five representative tomato leaf disease categories were selected for this study: Bacterial spot, Early blight, Late blight, Leaf mold, and Septoria leaf spot. These diseases exhibit diverse lesion appearances and spatial scales, ranging from small punctate spots to large irregular lesions, providing a basis for evaluating the model’s ability to detect multi-scale disease symptoms. Furthermore, the color characteristics of leaf mold and early blight are highly similar during their initial stages and are often accompanied by complex overlapping textures, providing an effective basis for evaluating the model’s discriminative precision. Although healthy tomato leaf images are available in the PlantVillage dataset, they were not included in this study because the objective of this work is lesion-level detection and classification among pre-screened diseased samples. Thus, HDR-YOLO does not perform independent healthy–diseased classification, but focuses on detecting and localizing disease symptoms in suspected diseased leaves. Sample images at different disease stages are presented in Figure 1. The total number of selected samples is 3025, comprising 595 images of late blight, 596 of early blight, 612 of septoria leaf spot, 621 of leaf mold, and 601 of bacterial spot.
Figure 1.
Samples of five tomato leaf diseases in the dataset: (a) Leaf mold; (b) Septoria leaf spot; (c) Late blight; (d) Early blight; and (e) Bacterial spot.
2.2. Data Preprocessing and Partitioning
To increase the diversity of the training samples and improve the robustness of model training, data augmentation was applied only to the training set. These augmentation techniques included horizontal flipping, vertical flipping, random brightness and contrast adjustments, and random rotation. The original dataset contained 3025 images. To avoid data leakage [19], the original images were first divided into training, validation, and test sets according to a stratified ratio of 7:2:1, resulting in 2117 training images, 605 validation images, and 303 test images. Data augmentation was then applied only to the training set. After augmentation, the number of training images increased from 2117 to 4234, while the validation and test sets remained unchanged. Therefore, the final numbers of images used for model training, validation, and testing were 4234, 605, and 303, respectively, with a total of 5142 images. All images were resized to 640 × 640 pixels. The images and corresponding bounding-box annotations were obtained from the publicly available annotated tomato leaf disease detection dataset. The annotation files were provided in YOLO format. We further checked the labels and removed invalid or incomplete samples before model training. No additional manual annotation was performed, except for label consistency checking and dataset organization.
2.3. YOLOv12 Network
YOLOv12 is the first model in the YOLO series to break away from traditional methods purely based on CNNs. By leveraging an area-attention-centric design, it addresses previously unmet needs; this design partitions the feature map to focus more effectively on key regions [20]. While maintaining high inference speeds, it introduces more powerful feature extraction components. The model primarily consists of three parts: the Backbone, Neck, and Detection Head, with its overall architecture illustrated in Figure 2. Specifically, YOLOv12 utilizes C3k2 and A2C2f blocks to handle feature extraction at different stages of the backbone. The C3k2 block is responsible for feature extraction in the shallower stages of the backbone, employing a series of convolutional and deconvolutional layers while utilizing residual connections and bottleneck structures to reduce network size and enhance performance. As illustrated in Figure 2a, the C3k2 module optimizes the information flow within the network by partitioning feature maps and applying a series of smaller kernel convolutions (). This approach is faster and more computationally efficient than using larger kernels. Simultaneously, it employs a split-and-merge strategy to reduce redundant computations and preserve more feature information [21]. The A2C2f module, shown in Figure 2b, divides the feature map into multiple regions (defaulting to four). This design reduces the computational complexity of the attention mechanism from the traditional O(n2) to O(n) while maintaining a sufficiently large receptive field. This ensures that the model captures global contextual information, thereby reducing computational overhead and achieving higher efficiency. Despite the excellent performance of YOLOv12, it still exhibits limitations in tomato disease detection tasks: standard convolutions struggle to capture the geometric features of irregular lesions (such as early blight), and the downsampling process easily leads to the loss of features for tiny lesions (such as bacterial spots). Consequently, this paper proposes targeted improvements to YOLOv12 to address these specific issues.
Figure 2.
YOLOv12 network structure: (a) C3k2 module structure; (b) A2C2f module structure; (c) YOLOv12 network architecture.
2.4. HDR-YOLO Detection Model
The model is built upon the advanced YOLOv12n architecture. In traditional CNNs, as the network depth increases, successive downsampling operations—while expanding the receptive field and extracting abstract semantic features—inevitably lead to a reduction in spatial resolution and the loss of fine texture information. This is particularly detrimental for detecting tiny lesions, such as early-stage bacterial spots. To overcome this deficiency, rather than simply following the original feature fusion path, we have constructed a novel network architecture based on a “High-level Semantic Guidance” mechanism. The core design philosophy of this architecture is to utilize the rich semantic information from high-level feature maps as weights to selectively filter and enhance the raw texture information from low-level feature maps. The overall network structure of the model is illustrated in Figure 3.
Figure 3.
HDR-YOLO network architecture.
2.4.1. HSFPN
While the original PANet neck network enhances feature fusion through bidirectional paths, it employs simple concatenation operations when processing features from different levels, failing to fully account for the semantic discrepancies between them. In tomato disease detection, low-level feature maps (e.g., P3) contain rich leaf textures and edge information but are also cluttered with significant background noise. Conversely, high-level feature maps (e.g., P5) possess clear semantic information but suffer from low spatial resolution. Direct fusion often leads to critical pathological features being overwhelmed by background noise. Furthermore, the complex structure of PANet introduces substantial parameter redundancy, which is unfavorable for efficient inference due to parameter redundancy. Therefore, we have reconstructed the neck network and developed the HSFPN, as illustrated in Figure 4. A channel attention module was designed and embedded within the HSFPN. This module aims to leverage high-level semantic information to re-weight each channel of the feature map, effectively suppressing redundant background channels while highlighting feature channels closely related to disease lesions [22]. Given an input feature map , global average pooling and global max pooling are first applied along the spatial dimensions to aggregate spatial information, generating two spatial context descriptors, and , respectively. These descriptors are then fed into a shared two-layer neural network for channel interaction. The first layer consists of a convolution with a compression ratio of (set to in this study) to reduce dimensionality and minimize parameter count, followed by a ReLU activation function. The second layer is an expansion 1 × 1 convolution that restores the number of channels to . The feature maps from the two output paths are then combined via element-wise summation, and a Sigmoid activation function is applied to generate the final channel attention weights . Finally, is multiplied by the original input feature map to obtain the recalibrated feature map.
Figure 4.
HSFPN model architecture.
The mathematical expression for the above process is as follows:
In this context, denotes the Sigmoid activation function, represents the ReLU activation function, and signify the convolutional kernel weights for dimensionality reduction and expansion respectively, and indicates element-wise multiplication.
This architecture introduces a heterogeneous feature flow processing mechanism, utilizing highly abstract and class-discriminative semantic vectors extracted from the deep network as spatial anchors to nonlinearly recalibrate the rich but fragmented geometric features from the shallow layers. This heterogeneous fusion strategy achieves significant lightweighting by pruning redundant feature channels while simultaneously highlighting the texture details of lesions. For instance, when dealing with diseases such as leaf mold—which exhibit blurred boundaries and subtle color differences compared to healthy leaves—the shared convolutional network can adaptively learn these nuanced inter-channel dependencies. Consequently, the model can actively assign higher weights to those channels that encode “lesion color” and “edge texture.”
2.4.2. DySample
In the original HSFPN architecture, to align the spatial dimensions of high-level semantic features with low-level textural features, transposed convolution or nearest neighbor interpolation is typically employed for upsampling [23]. However, in the detection of tiny tomato diseases (such as bacterial spot), we observed the following:
- (1)
- Transposed Convolution: Although it possesses learnable parameters, it incurs a heavy computational load and is highly prone to introducing checkerboard artifacts into the feature maps. This results in artificial patterns at the edges of tiny lesions.
- (2)
- Nearest Neighbor Interpolation: While computationally simple, it ignores the semantic information of the image content, leading to a severe loss of geometric details for the lesions.
To address these issues, we replaced the original transposed convolution layers with the DySample operator. The core philosophy of DySample is to transform the upsampling process into a dynamic coordinate sampling problem, thereby eliminating dependence on fixed interpolation kernels [24]. Based on the input feature map a standardized base sampling set is first generated according to the predefined upsampling scale (set to in this study). Subsequently, a lightweight point convolution ( convolution) is applied to the input feature map X to predict the content-specific local coordinate offsets . Although this operation introduces learnable parameters, the parameter overhead is very small compared with transposed convolution. To control the intensity of the deformation, a scaling constraint is applied to the offsets (with the coefficient set to ) The mathematical expression for this step is as follows:
In this context, represents the final set of dynamic sampling coordinates. maps the number of channels to (where is the number of groups, set to g = 4 in our experiments to further compress parameters).
Finally, by combining the input and the generated sampling set , the bilinear interpolation method via the underlying grid_sample function is used to extract pixel values. This process generates a high-resolution output feature map with the spatial resolution expanded by a factor of :
Figure 5 illustrates the dynamic upsampling structure of DySample. This multi-scale dynamic fusion mechanism effectively resolves the conflict between the limited receptive field of low-level information and the insufficient textural features of high-level information. When the model processes tiny targets such as bacterial spots which may occupy only a few pixels, the offsets generated by DySample adaptively guide the sampling grid to cluster around the actual physical boundaries of the lesions. Since this module predicts offsets using only an extremely lightweight grouped convolution, it eliminates the parameter-heavy transposed convolution layers while effectively compensating for the loss of spatial information entropy during the downsampling process. This significantly enhances the model’s sensitivity to tiny disease spots.
Figure 5.
Dysample upsampling module structure.
2.4.3. RFCAConv
In CNNs, the receptive fields of standard convolutional kernels are local and fixed, making it difficult to simultaneously process multi-scale targets. Tomato diseases exhibit significant scale variations: Early Blight typically presents as large-scale concentric rings, requiring extensive contextual information for recognition, whereas Septoria Leaf Spot appears as scattered tiny dots, necessitating precise spatial localization. To resolve the conflict between receptive field size and positional awareness, we introduced RFCAConv at critical nodes of feature fusion [25]. First, a deep grouped convolutional layer is utilized to process the input features . This layer employs a k × k convolutional kernel (where k = 3 in this study) to map spatial information into the channel dimension via grouped convolution, generating intermediate features with a dimension of . This step achieves the decoupling and reconstruction of spatial information within the local receptive field. To capture precise spatial positional information, the restructured features are fed into two parallel adaptive average pooling layers: H AvgPool and W AvgPool. These layers perform global aggregation along the horizontal and vertical directions, respectively. The aggregated features then undergo a convolution for dimensionality reduction (with a reduction ratio of reduction = 32), followed by the h-swish activation function to enhance non-linear expressive capacity. Finally, the original channel count is restored through Conv_h and Conv_w, generating horizontal and vertical attention weights. The resulting spatial weights are applied to the restructured features, which are then restored to the target dimensions using a large-stride convolution with a stride of . By rearranging the pixels within the receptive field, RFCAConv enables the model to capture the textural details of lesions at a finer granularity, thereby improving the accuracy of disease recognition.
To further enhance the feature extraction capability, we integrated RFCAConv into the Bottleneck of the C3k2 module. By replacing the standard convolution in the second layer with RFCAConv, the extracted rich information is subsequently concatenated with the preceding convolution. This effectively fuses the deep features with the original shallow features, ensuring a synergistic effect between semantic information and detailed features. The network’s feature extraction capability is significantly enhanced. This improvement markedly boosts the model’s robustness and detection accuracy, reducing instances of missed detections and false positives.
The structural diagrams of RFCAConv and C3k2_RFCAConv are illustrated in Figure 6.
Figure 6.
RFCAConv module and C3k2_RFCAConv module structure.
2.5. Experimental Platform and Parameters Settings
The training and testing of the model in this study were conducted on an experimental platform equipped with an AMD EPYC 9754 CPU, an RTX 4090D GPU, and 60 GB of RAM. The entire model was implemented using the PyTorch 2.2.2 framework and the Python programming language (Python version 3.10.14), with Torch version 2.2.2 and CUDA version 12.1. The specific training parameters are detailed in Table 1.
Table 1.
Training parameters setting.
2.6. Evaluation Indicators
The evaluation metrics in this study primarily include mean Average Precision (mAP(0.5)), Precision (), Recall (), F1-score, Floating Point Operations (FLOPs), number of parameters (Params), and model size. Here, (True Positive) represents correctly predicted objects, (False Positive) represents incorrectly predicted objects, and (False Negative) represents missed objects. denotes the total number of images, and represents the number of detected categories. The specific formulas are as follows:
3. Results
3.1. Base Model Selection
To further validate the comprehensive performance of the proposed HDR-YOLO model in tomato disease detection, we conducted an extensive horizontal comparison with current mainstream object detection algorithms under the same experimental environment and dataset partitioning. The compared models encompass the classical two-stage algorithm Faster R-CNN, the Transformer-based RT-DETR, the strong real-time baseline model RTMDet-Tiny, and the state-of-the-art single-stage YOLO series. The detailed results are presented in Table 2.
Table 2.
Results of comparative experiments.
As illustrated in Table 2, compared with Faster R-CNN, YOLOv12n achieves a 95.3% reduction in FLOPs and a 93.9% decrease in Parameters, while simultaneously improving the by 1.9%. Compared with RTMDet-Tiny, YOLOv12n achieves a 1.5% higher , while requiring slightly fewer FLOPs and parameters. When compared with RT-DETR, YOLOv12n exhibits a 93.9% lower computational cost and 92.0% fewer parameters, with a 6.0% gain in . Among the YOLO-series baselines, YOLOv12n achieves the highest of 77.3%, with 6.3 G FLOPs, 2.54 M parameters, and 349 FPS. YOLO13n obtains a comparable of 77.1%, while YOLO26n achieves the lowest FLOPs among the compared YOLO models but shows a lower mAP(0.5) of 73.9%. Compared with the YOLOv12n baseline, HDR-YOLO improves from 77.3% to 79.5%, corresponding to an increase of 2.2%. Meanwhile, the number of parameters decreases from 2.54 M to 1.79 M, representing a reduction of approximately 29.5%, and FLOPs decrease from 6.3 G to 5.4 G, corresponding to a reduction of approximately 14.3%. Although the FPS of HDR-YOLO decreases to 166 due to the introduced feature enhancement modules, it remains sufficiently high for efficient image-based disease screening under the evaluated hardware conditions. Therefore, HDR-YOLO achieves a favorable balance between detection accuracy, model compactness, and practical inference efficiency.
3.2. Analysis of Model Performance Through Ablation Experiments
To verify the effectiveness of each proposed module and clarify their independent contributions, we conducted a complete ablation study. As shown in Table 3, YOLOv12n was used as the baseline model (Group A), and HSFPN, DySample, and RFCAConv were evaluated individually and in different combinations under the same experimental settings. The results comprehensively demonstrate the effects of each module on detection accuracy, model compactness, and inference efficiency.
Table 3.
Results of ablation experiments. √ indicates that the corresponding module is used, whereas × indicates that the module is not used.
As shown in Table 3, the complete ablation study verifies the independent and combined effects of HSFPN, DySample, and RFCAConv. Compared with the baseline model in Group A, introducing HSFPN alone in Group B increases from 77.3% to 78.3%, while reducing FLOPs from 6.3 G to 5.7 G and parameters from 2.54 M to 1.82 M. The FPS also increases from 349 to 378, indicating that HSFPN effectively reduces redundant feature fusion operations while improving semantic representation.
When DySample is used alone in Group C, increases to 78.5%, suggesting that dynamic upsampling improves feature reconstruction for small lesion detection. However, since the neck structure is not redesigned, the FLOPs remain at 6.3 G and the parameter reduction is limited. In Group D, RFCAConv alone improves to 78.1%, but increases FLOPs to 6.6 G and reduces FPS to 66, indicating that it introduces considerable runtime overhead when used independently.
For the pairwise combinations, Group E combines DySample and RFCAConv without HSFPN and achieves an of 78.2%, but the parameters and FLOPs remain relatively high. Group F shows that combining HSFPN with RFCAConv reduces the parameter count to 1.86 M and improves FPS to 209 compared with RFCAConv alone, demonstrating that HSFPN can alleviate part of the computational burden. Group G, which combines HSFPN and DySample, achieves an of 78.8% with only 1.75 M parameters and 5.1 G FLOPs, showing the strongest pairwise performance.
Finally, the complete HDR-YOLO model in Group H achieves the best of 79.5%. Compared with YOLOv12, HDR-YOLO improves by 2.2 percentage points, while reducing parameters from 2.54 M to 1.79 M and FLOPs from 6.3 G to 5.4 G. Although the FPS decreases to 166 due to the additional RFCAConv operations, the model still maintains practical real-time inference capability. These results demonstrate that the proposed modules achieve a favorable trade-off between detection accuracy, model compactness, and inference speed.
Figure 7 illustrates the Precision, Recall, mAP(0.5), and mAP(0.5–0.95) curves of four representative ablation groups, including the baseline model, HSFPN, HSFPN + DySample, and the complete HDR-YOLO model. The curves show that the complete HDR-YOLO model achieves the best performance among these representative settings and maintains more stable recall performance. This indicates that the gradual integration of HSFPN, DySample, and RFCAConv helps improve lesion detection sensitivity and reduce missed detections. These visualization results are consistent with the quantitative comparisons of Groups A, B, G, and H in Table 3.
Figure 7.
Visualization of representative ablation results for Groups A, B, G, and H: (a) Precision curves; (b) Recall curves; (c) mAP(0.5) curves; (d) mAP(0.5–0.95) curves.
3.3. Confusion Matrix Analysis
To further evaluate the category-level detection performance of the proposed model, normalized confusion matrices were generated on the test set for YOLOv12n and HDR-YOLO, as shown in Figure 8. In the confusion matrices, the diagonal elements represent correctly detected disease categories, while the off-diagonal elements indicate misclassifications between different disease classes. The background row represents missed detections, and the background column represents false detections on background regions.
Figure 8.
Normalized confusion matrices on the tomato leaf disease test set: (a) HDR-YOLO; (b) YOLOv12n.
As shown in Figure 8a, the proposed HDR-YOLO model achieves higher diagonal values than the baseline YOLOv12n for all five tomato leaf disease categories. Specifically, the correct detection rates of Bacterial spot, Early blight, Late blight, Leaf mold, and Septoria leaf spot increase from 0.64, 0.82, 0.84, 0.70, and 0.77 in YOLOv12n to 0.66, 0.85, 0.88, 0.75, and 0.80 in HDR-YOLO, respectively. These results indicate that the proposed model improves the category-level recognition ability across different disease types.
Compared with YOLOv12n, HDR-YOLO also reduces the missed detection rate for several disease categories. For example, the background values corresponding to Bacterial spot, Early blight, Late blight, Leaf mold, and Septoria leaf spot decrease from 0.36, 0.17, 0.14, 0.30, and 0.23 to 0.34, 0.15, 0.12, 0.25, and 0.20, respectively. The reduction is particularly evident for Leaf mold, whose missed detection rate decreases from 0.30 to 0.25. This improvement suggests that the proposed feature fusion and attention enhancement modules help the model capture weak-boundary lesions and small disease regions more effectively.
In terms of inter-class confusion, YOLOv12n shows slight confusion between Early blight and Late blight, with off-diagonal values of 0.02 and 0.01. In contrast, HDR-YOLO shows almost no obvious inter-class confusion among the five disease categories. This indicates that the proposed high-level semantic guidance and RFCAConv module improve the discriminative representation of visually similar lesion patterns. However, some disease samples are still assigned to the background class, especially Bacterial spot and Leaf mold. This may be attributed to the small, scattered appearance of bacterial spots and the weak boundaries of leaf mold lesions, which make them difficult to distinguish from normal leaf texture.
Overall, the confusion matrix results demonstrate that HDR-YOLO improves category-level detection performance compared with the YOLOv12n baseline. The proposed model not only increases the correct detection rates of all five disease categories but also reduces missed detections and inter-class confusion. These findings provide more objective evidence for the quantitative results reported in Table 2 and further validate the effectiveness of the proposed HSFPN, DySample, and RFCAConv modules.
3.4. Model Visualization Analysis
3.4.1. Heatmap Visualization
In this study, the Grad-CAM visualization technique was employed to analyze the attention distribution of HDR-YOLO in tomato leaf disease detection [26]. As illustrated in Figure 9, for the diseased samples, HDR-YOLO exhibits a highly concentrated response within the lesion areas (represented by red to yellow regions), with the predicted positions aligning closely with the actual lesion locations. In contrast, healthy leaf tissues and background areas typically show low responses (represented by blue to purple regions). The heatmaps demonstrate that the model successfully suppresses irrelevant noise in the background, precisely focusing the high-response areas on the true lesion locations.
Figure 9.
Heatmap of tomato leaf diseases.
3.4.2. Visualization of Different Detection Models
As illustrated in the visual comparison results of different detection models in Figure 10, it is clearly observable that compared to other mainstream algorithms, HDR-YOLO not only aligns more precisely with the geometric edges of the lesions—thereby reducing background redundancy—but also exhibits a higher average predicted confidence score across the majority of targets. In the detection experiments for Leaf Mold, we observed that YOLOv8 is prone to generating nested bounding boxes (the “box-in-box” phenomenon) and repeatedly detecting the same lesion, whereas the bounding boxes of other models exhibit less overlap. In the case of Septoria Leaf Spot, which manifests as dense, scattered, and extremely minute spots, several comparative models show incomplete localization or missed detections to varying degrees, accompanied by insufficiently compact bounding box localization. Conversely, HDR-YOLO alleviates this problem to a certain extent. Regarding the detection of Bacterial Spot, while other models successfully focused on leaf edges and larger lesions, they still suffered from missed detections for smaller, marginal lesions due to the disease’s subtle features that are easily confounded with the background leaves. Compared with the baseline model, HDR-YOLO achieved fewer missed detections in this scenario. Overall, the proposed model can accurately identify lesions across diverse scales, significantly enhancing the detection capability for diminutive lesions. These results highlight its improved localization and recognition ability under the evaluated conditions.
Figure 10.
Visual comparison results of different detection models.
4. Discussion
Experimental results demonstrate that compared to existing lightweight detectors such as YOLOv8n, YOLOv10n, and YOLO11n, the proposed HDR-YOLO model achieves significant improvements in both detection accuracy and robustness for tomato disease identification. By integrating HSFPN, DySample, and RFCAConv modules, the network effectively enhances multi-scale feature extraction capabilities. The refined neck network filters critical feature channels, markedly reducing parameter redundancy, while the dynamic weight mechanism compensates for the loss of details during feature restoration. These enhancements significantly improve the model’s ability to distinguish between visually similar disease categories. Visualization results further confirm that HDR-YOLO exhibits superior performance in identifying tiny lesions and processing complex textures, leading to a substantial reduction in the false negative rate.
Although HDR-YOLO improves detection accuracy and model compactness, its limitations should be clearly noted. First, the dataset used in this study was obtained from the PlantVillage dataset, in which most images were captured under relatively controlled conditions. Therefore, the current model is mainly suitable for image-based tomato leaf disease screening under greenhouse or semi-controlled cultivation conditions, where images can be acquired with relatively stable illumination, limited background interference, and clear lesion visibility. Further validation is needed before applying the method to open-field environments with complex backgrounds, occlusion, and large illumination variations.
Second, the confusion matrix and visualization results show that missed detections still occur for tiny or weak-boundary lesions, especially Bacterial spot and Leaf mold. This indicates that fine-grained detection of subtle disease symptoms remains challenging. In addition, the present study only uses RGB images, which may be insufficient for detecting early biochemical changes before visible symptoms appear. Therefore, HDR-YOLO should currently be regarded as an assisted image-based screening tool rather than a fully autonomous diagnostic system.
In response to these challenges, future research can be conducted in the following three directions: (1) Early Diagnosis via Multi-modal Integration: By integrating hyperspectral or multispectral imaging technologies, spectral bands can be utilized to capture early biochemical changes—such as variations in chlorophyll concentration and water content—thereby enabling more precise diagnosis before visible symptoms appear and enhancing adaptability to environmental interference [27,28]. (2) Generative Data Augmentation: For disease categories with limited samples, generative models such as Diffusion Models or Generative Adversarial Networks (e.g., FWDGAN [29], EnlightenGAN [30], and SRGAN [31]) can be explored to expand dataset diversity and strengthen the model’s generalization capabilities. (3) Field Adaptation and Practical Validation: Future work will incorporate images collected from authentic field environments to evaluate the robustness and generalization ability of HDR-YOLO under more diverse illumination, occlusion, and background conditions. After sufficient field validation, device-level optimization and actual edge-platform testing may be further considered [32].
5. Conclusions
This study proposes HDR-YOLO, a lightweight tomato leaf disease detection model based on YOLOv12, integrating high-level semantic guidance and dynamic upsampling. The primary improvements are reflected in the following aspects: First, the feature fusion network was reconstructed by introducing a HSFPN, which filters critical feature channels and enhances the transmission of semantic information. Second, the DySample module was employed to utilize point sampling and dynamic weight mechanisms, effectively reducing detail loss during the upsampling process and improving the perception of tiny lesions. Finally, the RFCAConv module was introduced into key feature fusion paths to further boost model precision. Ultimately, the improved HDR-YOLO model significantly enhances detection accuracy while maintaining its lightweight characteristics, achieving an of 79.5%. Compared with the YOLOv12n baseline, the proposed model improves by 2.2%, achieves higher precision and recall, and reduces FLOPs by 14.3%, parameters by 29.5%, and also reduces the overall model size. Although the proposed detection model achieved ideal overall performance, certain limitations remain. First, the dataset used in this study was obtained from a public dataset, and most images were captured under relatively controlled or laboratory-like conditions; future work could incorporate data from real-field environments to expand the dataset, further increasing diversity and enhancing the model’s adaptability to various practical scenarios. Additionally, technologies such as multispectral and hyperspectral imaging could be integrated to further optimize and explore the effectiveness of disease detection.
Author Contributions
T.C.: methodology, experiments, data analysis and writing—original draft preparation; S.L.: software, visualization and formal analysis; Y.L.: conceptualization, supervision, project administration and writing—review and editing; X.L.: funding acquisition. All authors have read and agreed to the published version of the manuscript.
Funding
This research was funded by 2025 Doctoral Research Startup Special Project of University Science and Education Development Foundation with grant number 20250109, and 2025 University-level Scientific Research Innovation Platform Construction Project with grant number 202501; in part by the Scientific and Technological Innovation of Fujian Agriculture and Forestry University (Grant No. KFB24039).
Data Availability Statement
The data presented in this study are available in article. Further inquiries can be directed to the corresponding author.
Conflicts of Interest
The authors declare no conflicts of interest regarding the publication of this paper.
References
- 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]
- Rana, A.; Vaidya, P. YOLO-based deep learning framework for real-time multi-class plant health monitoring in precision agriculture. Sci. Rep. 2026, 16, 197. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Liu, J.; Wang, X. Tomato disease object detection method combining prior knowledge attention mechanism and multiscale features. Front. Plant Sci. 2023, 14, 1255119. [Google Scholar] [CrossRef] [Scilit]
- Krizhevsky, A.; Sutskever, I.; Hinton, G.E. Imagenet classification with deep convolutional neural networks. Adv. Neural Inf. Process. Syst. 2012, 25. [Google Scholar] [CrossRef] [Scilit]
- Girshick, R. Fast r-cnn. In Proceedings of the IEEE International Conference on Computer Vision; IEEE: New York, NY, USA, 2015. [Google Scholar]
- Liu, W.; Anguelov, D.; Erhan, D.; Szegedy, C.; Reed, S.; Fu, C.Y.; Berg, A.C. Ssd: Single shot multibox detector. In European Conference on Computer Vision; Springer International Publishing: Cham, Switzerland, 2016. [Google Scholar]
- Tan, M.; Pang, R.; Le, Q.V. Efficientdet: Scalable and efficient object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition; IEEE: New York, NY, USA, 2020. [Google Scholar]
- Kang, R.; Huang, J.; Zhou, X.; Ren, N.; Sun, S. Toward real scenery: A lightweight tomato growth inspection algorithm for leaf disease detection and fruit counting. Plant Phenomics 2024, 6, 0174. [Google Scholar] [CrossRef] [Scilit]
- Wang, M.; Cai, J.; Liu, W.; Yang, X.; Zhang, J.; Zhou, Q.; Wang, F.; Zhang, H.; Liu, T. YOLO-SPDNet: Multi-Scale Sequence and Attention-Based Tomato Leaf Disease Detection Model. Phyton 2026, 95, 17. [Google Scholar] [CrossRef] [Scilit]
- Wang, Q.; Yan, N.; Qin, Y.; Zhang, X.; Li, X. BED-YOLO: An enhanced YOLOv10n-Based tomato leaf disease detection algorithm. Sensors 2025, 25, 2882. [Google Scholar] [CrossRef] [Scilit]
- Abulizi, A.; Ye, J.; Abudukelimu, H.; Guo, W. DM-YOLO: Improved YOLOv9 model for tomato leaf disease detection. Front. Plant Sci. 2025, 15, 1473928. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Yao, J.; Li, Y.; Xia, Z.; Nie, P.; Li, X.; Li, Z. WTAD-YOLO: A lightweight tomato leaf disease detection model based on YOLO11. Smart Agric. Technol. 2025, 12, 101349. [Google Scholar] [CrossRef] [Scilit]
- Qiu, H.; Yang, J.; Jiang, J.; Zhang, W. Mob-psp: Modified MobileNet-V2 network for real-time detection of tomato diseases. J. Real-Time Image Process. 2024, 21, 181. [Google Scholar] [CrossRef] [Scilit]
- Hong, H.; Lin, J.; Huang, F. Tomato disease detection and classification by deep learning. In 2020 International Conference on Big Data, Artificial Intelligence and Internet of Things Engineering (ICBAIE); IEEE: New York, NY, USA, 2020. [Google Scholar]
- Lin, T.Y.; Dollár, P.; Girshick, R.; He, K.; Hariharan, B.; Belongie, S. Feature pyramid networks for object detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition; IEEE: New York, NY, USA, 2017. [Google Scholar]
- Liu, S.; Qi, L.; Qin, H.; Shi, J.; Jia, J. Path aggregation network for instance segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition; IEEE: New York, NY, USA, 2018. [Google Scholar]
- Hou, Q.; Zhou, D.; Feng, J. Coordinate attention for efficient mobile network design. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition; IEEE: New York, NY, USA, 2021. [Google Scholar]
- Wang, J.; Chen, K.; Xu, R.; Liu, Z.; Loy, C.C.; Lin, D. Carafe: Content-aware reassembly of features. In Proceedings of the IEEE/CVF International Conference on Computer Vision; IEEE: New York, NY, USA, 2019. [Google Scholar]
- Apicella, A.; Isgrò, F.; Prevete, R. Don’t push the button! exploring data leakage risks in machine learning and transfer learning. Artif. Intell. Rev. 2025, 58, 339. [Google Scholar] [CrossRef] [Scilit]
- Tian, Y.; Ye, Q.; Doermann, D. Yolov12: Attention-centric real-time object detectors. arXiv 2025, arXiv:2502.12524. [Google Scholar]
- Khanam, R.; Hussain, M. Yolov11: An overview of the key architectural enhancements. arXiv 2024, arXiv:2410.17725. [Google Scholar] [CrossRef] [Scilit]
- Chen, Y.; Zhang, C.; Chen, B.; Huang, Y.; Sun, Y.; Wang, C.; Fu, X.; Dai, Y.; Qin, F.; Peng, Y.; et al. Accurate leukocyte detection based on deformable-DETR and multi-level feature fusion for aiding diagnosis of blood diseases. Comput. Biol. Med. 2024, 170, 107917. [Google Scholar] [CrossRef] [Scilit]
- Rukundo, O.; Cao, H. Nearest neighbor value interpolation. arXiv 2012, arXiv:1211.1768. [Google Scholar]
- Liu, W.; Lu, H.; Fu, H.; Cao, Z. Learning to upsample by learning to sample. In Proceedings of the IEEE/CVF International Conference on Computer Vision; IEEE: New York, NY, USA, 2023. [Google Scholar]
- Zhang, X.; Liu, C.; Yang, D.; Song, T.; Ye, Y.; Li, K.; Song, Y. RFAConv: Innovating spatial attention and standard convolutional operation. arXiv 2023, arXiv:2304.03198. [Google Scholar]
- Selvaraju, R.R.; Cogswell, M.; Das, A.; Vedantam, R.; Parikh, D.; Batra, D. Grad-CAM: Visual explanations from deep networks via gradient-based localization. Int. J. Comput. Vis. 2020, 128, 336–359. [Google Scholar] [CrossRef] [Scilit]
- Xie, C.; Shao, Y.; Li, X.; He, Y. Detection of early blight and late blight diseases on tomato leaves using hyperspectral imaging. Sci. Rep. 2015, 5, 16564. [Google Scholar] [CrossRef] [Scilit]
- De Silva, M.; Brown, D. Tomato disease detection using multispectral imaging with deep learning models. In 2024 International Conference on Artificial Intelligence, Big Data, Computing and Data Communication Systems (icABCD); IEEE: New York, NY, USA, 2024. [Google Scholar]
- Li, M.; Zhou, G.; Chen, A.; Yi, J.; Lu, C.; He, M.; Hu, Y. FWDGAN-based data augmentation for tomato leaf disease identification. Comput. Electron. Agric. 2022, 194, 106779. [Google Scholar] [CrossRef] [Scilit]
- Jiang, Y.; Gong, X.; Liu, D.; Cheng, Y.; Fang, C.; Shen, X.; Yang, J.; Zhou, P.; Wang, Z. Enlightengan: Deep light enhancement without paired supervision. IEEE Trans. Image Process. 2021, 30, 2340–2349. [Google Scholar] [CrossRef] [Scilit]
- Xiong, Y.; Guo, S.; Chen, J.; Deng, X.; Sun, L.; Zheng, X.; Xu, W. Improved SRGAN for remote sensing image super-resolution across locations and sensors. Remote Sens. 2020, 12, 1263. [Google Scholar] [CrossRef] [Scilit]
- Jelali, M. Deep learning networks-based tomato disease and pest detection: A first review of research studies using real field datasets. Front. Plant Sci. 2024, 15, 1493322. [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.









