YOLOv11n-KL: A Lightweight Tomato Pest and Disease Detection Model for Edge Devices
Abstract
1. Introduction
2. Materials and Methods
2.1. Tomato Pest and Disease Dataset
2.2. Improvement Strategies
2.2.1. YOLOv11n-KL Model
2.2.2. Conv_KW Module
| Algorithm 1 Conv_KW Module |
| Input: Feature map X ∈ ℝ^B × Cin × H × W Output: Enhanced feature map Y ∈ ℝ^B × Cout × H × W 1. Initialize Kernel Warehouse: 2. Create N convolution kernels W1, W2, …, WN ∈ ℝ^Cout × Cin × K × K 3. All kernels share the same weight storage space 4. Compute Global Feature Descriptor: 5. Apply global average pooling to X: 6. G = AvgPool(X) ∈ ℝ^B × Cin × 1 × 1 7. Compute Attention Weights: 8. Apply first fully connected layer: 9. F1 = FC1(G) ∈ ℝ^B × R × 1 × 1 // R is reduction dimension 10. Apply batch normalization: 11. BN = BatchNorm(F1) 12. Apply second fully connected layer: 13. F2 = FC2(BN) ∈ ℝ^B × N × 1 × 1 14. Apply softmax with temperature parameter: 15. α = Softmax(F2/T) ∈ ℝ^B × N × 1 × 1 // T controls weight distribution 16. Dynamic Kernel Generation: 17. Compute weighted sum of warehouse kernels: 18. W_dynamic = Σ(αi × Wi) for i = 1…N 19. Apply Dynamic Convolution: 20. Perform convolution with dynamically weighted kernel: 21. Y = Conv(X, W_dynamic) + b 22. Optional: Apply activation function 23. Return Y |
2.2.3. C3k2_KW Module
| Algorithm 2 C3k2_KW Module |
| Input: Feature map X ∈ ℝ^B × Cin × H × W Output: Enhanced feature map Y ∈ ℝ^B × Cout × H × W 1. Initialize Parameters: 2. Cout: Number of output channels 3. shortcut: Whether to use residual connection (default: False) 4. g: Number of groups for group convolution 5. e: Expansion ratio (default: 0.25) 6. C3k: Whether to use C3k or Bottleneck blocks 7. Split Input Feature: 8. Create two parallel branches from input X 9. Branch1: Identity mapping (if shortcut is True) 10. Branch2: Main processing branch 11. Main Processing Branch: 12. a. First KWConv Layer: 13. Apply KWConv with dynamic kernel: 14. X1 = KWConv(X, channels = Cin × e) 15. Apply activation function (SiLU) 16. b. Create ModuleList of Bottleneck_KW blocks: 17. For each block in the list: 18. i. Apply Bottleneck_KW with dynamic kernels 19. ii. Update feature map 20. c. If C3k = True: 21. Replace Bottleneck_KW with C3k_KW blocks 22. Each C3k_KW contains multiple Bottleneck_KW sub-blocks 23. Merge Branches: 24. Combine outputs from branch1 and branch2: 25. if shortcut and Cin == Cout: 26. Y = X + X1 // Residual connection 27. else: 28. Y = X1 // No residual connection 29. Final Processing: 30. Apply Conv layer to ensure consistent output channels 31. Apply batch normalization 32. Apply activation function 33. Return Y |
2.2.4. Detect_LSCD Module
| Algorithm 3 Detect_LSCD Module |
| Input: Multi-scale feature map list X ∈ R^{B × C × H × W} (from P3, P4, P5) Number of classes nc, Hidden channel count hidc, Input channel tuple ch Output: Object detection results (bounding box coordinates and class probabilities) 1. Initialize detection head parameters 2. Create Conv_GN module list (one for each feature layer) 3. Create shared convolution layer share_conv (contains 2 cascaded Conv_GN modules) 4. Create bounding box prediction layer cv2 and class prediction layer cv3 5. Initialize scale factor list and DFL layer 6. Define forward propagation function 7. out = [] 8. for i in range(len(x)): 9. Step 1: Process each feature layer with dedicated Conv_GN 10. xi = self.cv1[i](x[i]) 11. Step 2: Apply shared convolution layer for feature processing 12. xi = self.share_conv(xi) 13. Step 3: Compute bounding box and class features 14. bbox_feat = self.cv2[i](xi) 15. cls_feat = self.cv3[i](xi) 16. Step 4: Concatenate features and add to output list 17. fi = torch.cat((bbox_feat, cls_feat), 1) 18. out.append(fi) 19. if training mode: 20. return tuple(out) 21. Inference mode 22. Generate anchors and perform bounding box decoding 23. z = [] 24. for i in range(len(out)): 25. bs, _, ny, nx = out[i].shape 26. out[i] = out[i].view(bs, self.no, ny, nx) 27. Step 1: Apply scale factors and DFL 28. if self.dynamic[i]: 29. out[i] = out[i] ∗ self.scale[i] 30. Step 2: Generate grid coordinates and compute anchors 31. grid = self._make_grid(nx, ny, i) 32. y = out[i].sigmoid() 33. Step 3: Decode bounding box coordinates 34. y[…, 0:2] = (y[…, 0:2] ∗ 2 − 0.5 + grid) ∗ self.stride[i] 35. y[…, 2:4] = ((y[…, 2:4] ∗ 2) ∗∗ 2) ∗ self.anchor_grid[i] 36. z.append(y.view(bs, −1, self.no)) 37. return torch.cat(z, 1) 38. Define helper function _make_grid(nx, ny, i) 39. Generate grid coordinates for bounding box decoding 40. return coordinate grid |
2.3. Model Training and Evaluation Metrics
2.3.1. Experimental Environment
2.3.2. Training Parameters
2.3.3. Evaluation Metrics
3. Results
3.1. Model Comparison and Evaluation
3.2. Exploring the Impact of Conv_KW Module Embedding Strategies
3.3. Analysis of C3k2_KW Module Embedding Strategies
3.4. Ablation Experiments and Analysis
3.5. Architectural Generalization and Scalability Validation
3.6. Visual Analysis of Detection Performance and Model Attention
4. Discussion
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Liu, J.; Wang, X. Tomato diseases and pests detection based on improved Yolo V3 convolutional neural network. Front. Plant Sci. 2020, 11, 898. [Google Scholar] [CrossRef] [PubMed]
- Iftikhar, Y.; Mubeen, M.; Sajid, A.; Zeshan, M.A.; Shakeel, Q.; Abbas, A.; Bashir, S.; Kamran, M.; Anwaar, H. Effects of tomato leaf curl virus on growth and yield parameters of tomato crop. Arab J. Plant Prot. 2021, 39, 79–83. [Google Scholar] [CrossRef]
- Ferrero, V.; Baeten, L.; Blanco-Sánchez, L.; Planelló, R.; Díaz-Pendón, J.A.; Rodríguez-Echeverría, S.; Haegeman, A.; de la Peña, E. Complex patterns in tolerance and resistance to pests and diseases underpin the domestication of tomato. New Phytol. 2020, 226, 254–266. [Google Scholar] [CrossRef]
- Panchal, A.V.; Patel, S.C.; Bagyalakshmi, K.; Kumar, P.; Khan, I.R.; Soni, M. Image-based plant diseases detection using deep learning. Mater. Today Proc. 2023, 80, 3500–3506. [Google Scholar] [CrossRef]
- Feng, Y.; Liu, C.; Han, J.; Lu, Q.; Xing, X. IRB-5-CA net: A lightweight, deep learning-based approach to wheat seed identification. IEEE Access 2023, 11, 119553–119559. [Google Scholar] [CrossRef]
- Han, K.; Zhang, N.; Xie, H.; Wang, Q.; Ding, W. An improved strategy of wheat kernel recognition based on deep learning. DYNA Ing. Ind. 2023, 98, 91–97. [Google Scholar] [CrossRef] [PubMed]
- Wang, X.; Liu, J.; Zhu, X. Early real-time detection algorithm of tomato diseases and pests in the natural environment. Plant Methods 2021, 17, 43. [Google Scholar] [CrossRef]
- Iftikhar, M.; Kandhro, I.A.; Kausar, N.; Kehar, A.; Uddin, M.; Dandoush, A. Plant disease management: A fine-tuned enhanced CNN approach with mobile app integration for early detection and classification. Artif. Intell. Rev. 2024, 57, 167. [Google Scholar] [CrossRef]
- Wrat, G.; Ranjan, P.; Mishra, S.K.; Jose, J.T.; Das, J. Neural network-enhanced internal leakage analysis for efficient fault detection in heavy machinery hydraulic actuator cylinders. J. Mech. Eng. Sci. 2025, 239, 1021–1031. [Google Scholar] [CrossRef]
- Chen, W.; Zheng, L.; Xiong, J. Algorithm for crop disease detection based on channel attention mechanism and lightweight up-sampling operator. IEEE Access 2024, 12, 109886–109899. [Google Scholar] [CrossRef]
- Wen, C.; Chen, H.; Ma, Z.; Zhang, T.; Yang, C.; Su, H.; Chen, H. Pest-YOLO: A model for large-scale multi-class dense and tiny pest detection and counting. Front. Plant Sci. 2022, 13, 973985. [Google Scholar] [CrossRef]
- Mo, L.; Xie, R.; Ye, F.; Wang, G.; Wu, P.; Yi, X. Enhanced tomato pest detection via leaf imagery with a new loss function. Agronomy 2024, 14, 1197. [Google Scholar] [CrossRef]
- Cai, H.; Li, J.; Hu, M.; Gan, C.; Han, S. EfficientViT: Lightweight Multi-Scale Attention for High-Resolution Dense Prediction. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Paris, France, 2–6 October 2023; pp. 17256–17267. [Google Scholar]
- Fang, M.; Tan, Z.; Tang, Y.; Chen, W.; Huang, H.; Dananjayan, S.; He, Y.; Luo, S. Pest-ConFormer: A hybrid CNN-Transformer architecture for large-scale multi-class crop pest recognition. Forests Expert Syst. Appl. 2024, 255, 124833. [Google Scholar] [CrossRef]
- Sun, H.; Fu, R.; Wang, X.; Wu, Y.; Al-Absi, M.A.; Cheng, Z.; Chen, Q.; Sun, Y. Efficient deep learning-based tomato leaf disease detection through global and local feature fusion. BMC Plant Biol. 2025, 25, 311. [Google Scholar] [CrossRef] [PubMed]
- Ye, Y.; Chen, Y.; Xiong, S. Field detection of pests based on adaptive feature fusion and evolutionary neural architecture search. Comput. Electron. Agric. 2024, 221, 108936. [Google Scholar] [CrossRef]
- Gao, W.; Zong, C.; Wang, M.; Zhang, H.; Fang, Y. Intelligent identification of rice leaf disease based on YOLO V5-EFFICIENT. Crop Prot. 2024, 183, 106758. [Google Scholar] [CrossRef]
- Liu, W.; Zhai, Y.; Xia, Y. Tomato leaf disease identification method based on improved YOLOX. Agronomy 2023, 13, 1455. [Google Scholar] [CrossRef]
- Albahar, M. A survey on deep learning and its impact on agriculture: Challenges and opportunities. Agriculture 2023, 13, 540. [Google Scholar] [CrossRef]
- Zhao, Z.; Song, A.; Zheng, S.; Xiong, Q.; Guo, J. DSC-HRNet: A lightweight teaching pose estimation model with depthwise separable convolution and deep high-resolution representation learning in computer-aided education. Int. J. Inf. Technol. 2023, 15, 2373–2385. [Google Scholar] [CrossRef]
- Chen, R.; Qi, H.; Liang, Y.; Yang, M. Identification of plant leaf diseases by deep learning based on channel attention and channel pruning. Front. Plant Sci. 2022, 13, 1023515. [Google Scholar] [CrossRef]
- Zhang, X.; Liang, K.; Zhang, Y. Plant pest and disease lightweight identification model by fusing tensor features and knowledge distillation. Front. Plant Sci. 2024, 15, 1443815. [Google Scholar] [CrossRef]
- Zhao, L.; Wang, L. A new lightweight network based on MobileNetV3. KSII Trans. Internet Inf. Syst. 2022, 16, 1–15. [Google Scholar] [CrossRef]
- Jiang, Y.; Tong, W. Improved lightweight identification of agricultural diseases based on MobileNetV3. arXiv 2025, arXiv:2207.11238. [Google Scholar]
- Song, Q.; Yao, B.; Xue, Y.; Ji, S. MS-YOLO: A lightweight and high-precision YOLO model for drowning detection. Sensors 2024, 24, 6955. [Google Scholar] [CrossRef]
- Yang, M.; Fan, X. YOLOv8-Lite: A lightweight object detection model for real-time autonomous driving systems. ICCK Trans. Emerg. Top. Artif. Intell. 2024, 1, 1–16. [Google Scholar] [CrossRef]
- Jia, L.; Wang, T.; Chen, Y.; Zang, Y.; Li, X.; Shi, H.; Gao, L. MobileNet-CA-YOLO: An improved YOLOv7 based on the MobileNetV3 and attention mechanism for Rice pests and diseases detection. Agriculture 2023, 13, 1285. [Google Scholar] [CrossRef]
- Li, C.; Yao, A. Kernelwarehouse: Rethinking the design of dynamic convolution. arXiv 2024, arXiv:2406.07879. [Google Scholar] [CrossRef]
- Dhanasekar, S. A comprehensive review on current issues and advancements of Internet of Things in precision agriculture. Comput. Sci. Rev. 2025, 55, 100694. [Google Scholar] [CrossRef]
- Zhang, Y.; Zhang, H.; Huang, Q.; Han, Y.; Zhao, M. DsP-YOLO: An anchor-free network with DsPAN for small object detection of multiscale defects. Expert Syst. Appl. 2024, 241, 122669. [Google Scholar] [CrossRef]
- Bochkovskiy, A.; Wang, C.-Y.; Liao, H.-Y.M. Yolov4: Optimal speed and accuracy of object detection. arXiv 2004, arXiv:2004.10934. [Google Scholar]
- Ren, S.; He, K.; Girshick, R.; Sun, J. Faster R-CNN: Towards real-time object detection with region proposal networks. IEEE Access 2016, 39, 1137–1149. [Google Scholar] [CrossRef]
- Shorten, C.; Khoshgoftaar, T.M. A survey on image data augmentation for deep learning. J. Big Data 2019, 6, 60. [Google Scholar] [CrossRef]
- Chen, G.; Hou, Y.; Cui, T.; Li, H.; Shangguan, F.; Cao, L. YOLOv8-CML: A lightweight target detection method for Color-changing melon ripening in intelligent agriculture. Sci. Rep. 2024, 14, 14400. [Google Scholar] [CrossRef] [PubMed]
- Stefenon, S.F.; Seman, L.O.; Klaar, A.C.R.; Ovejero, R.G.; Leithardt, V.R.Q. Hypertuned-YOLO for interpretable distribution power grid fault location based on EigenCAM. Ain Shams Eng. J. 2024, 15, 102722. [Google Scholar] [CrossRef]








| Category | Quantity | Training Set | Validation Set | Test Set |
|---|---|---|---|---|
| Sunscald Fruit | 1482 | 1186 | 148 | 148 |
| Blossom End Rot Fruit | 1255 | 1004 | 126 | 126 |
| Tomato Spotted Wilt Virus Fruit | 1023 | 818 | 102 | 102 |
| Fruit Cracking | 931 | 745 | 93 | 93 |
| Bacterial Spot of Fruit | 528 | 422 | 53 | 53 |
| Healthy Fruit | 1083 | 866 | 108 | 108 |
| Tomato Mosaic Virus Leaf | 699 | 559 | 70 | 70 |
| Late Blight of Leaf | 603 | 482 | 60 | 60 |
| Early Blight of Leaf | 600 | 480 | 60 | 60 |
| Leaf miner Damage | 589 | 471 | 59 | 59 |
| Leaf Mold | 475 | 380 | 48 | 48 |
| Septoria Leaf Spot | 418 | 334 | 42 | 42 |
| Spider Mite Damage | 303 | 242 | 30 | 30 |
| Yellow Leaf Curl Virus | 286 | 229 | 29 | 29 |
| Healthy Leaf | 154 | 123 | 15 | 15 |
| Total | 10,429 | 8343 | 1043 | 1043 |
| Environment | Item | Specifications |
|---|---|---|
| Hardware Environment | CPU | Intel Xeon Platinum 8352V Processor |
| GPU | NVIDIA GeForce RTX 4090 | |
| Memory | 32 GB | |
| Video Memory | 24 GB | |
| Software Environment | Operating System | Windows 11 |
| Deep Learning Framework | PyTorch 2.2.2 | |
| CUDA | 12.1 | |
| Programming Language | Python 3.10.14 |
| Parameter | Value | Parameter | Value |
|---|---|---|---|
| epochs | 200 | optimizer | SGD |
| patience | 100 | weight decay | 0.0005 |
| batch | 32 | momentum | 0.937 |
| imgsz | 640 | workers | 8 |
| lrf | 0.01 | close mosaic | 0 |
| Module | mAP@0.5 (%) | P (%) | R (%) | F1 (%) | Parameters (M) | GFLOPs |
|---|---|---|---|---|---|---|
| Faster R-CNN | 84.7 | 78.3 | 71.8 | 75.1 | 28.4 | 470.5 |
| YOLOv5s | 89.5 | 88.6 | 81.8 | 84.4 | 5.0 | 7.2 |
| YOLOv8n | 90.8 | 88.0 | 84.6 | 85.9 | 5.4 | 6.9 |
| YOLOv10n | 90.5 | 89.0 | 83.4 | 85.5 | 5.5 | 8.2 |
| YOLOv11n | 91.6 | 87.0 | 86.6 | 86.3 | 5.2 | 6.3 |
| YOLOv12n | 91.0 | 87.7 | 85.6 | 86.2 | 5.3 | 6.5 |
| YOLOv11n-KL | 92.5 | 89.9 | 86.3 | 87.7 | 5.2 | 3.0 |
| Module | Optimization Position | mAP@0.5 (%) | P (%) | R (%) | F1 (%) | Parameters (M) | GFLOPs |
|---|---|---|---|---|---|---|---|
| YOLOV11n | — | 91.6 | 86.7 | 86.6 | 86.3 | 5.2 | 6.3 |
| Conv_KW | Backbone | 92.1 | 87.5 | 87.6 | 87.4 | 5.3 | 4.9 |
| Neck | 91.7 | 90.5 | 84.6 | 86.9 | 5.3 | 6.1 | |
| Backbone + Neck | 92.7 | 89.5 | 87.1 | 88.0 | 5.3 | 4.6 |
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. |
© 2025 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.
Share and Cite
Peng, S.; Chen, X.; Jiang, Y.; Jia, Z.; Shang, Z.; Shi, L.; Yan, W.; Yang, L. YOLOv11n-KL: A Lightweight Tomato Pest and Disease Detection Model for Edge Devices. Horticulturae 2026, 12, 49. https://doi.org/10.3390/horticulturae12010049
Peng S, Chen X, Jiang Y, Jia Z, Shang Z, Shi L, Yan W, Yang L. YOLOv11n-KL: A Lightweight Tomato Pest and Disease Detection Model for Edge Devices. Horticulturae. 2026; 12(1):49. https://doi.org/10.3390/horticulturae12010049
Chicago/Turabian StylePeng, Shibo, Xiao Chen, Yirui Jiang, Zhiqi Jia, Zilong Shang, Lei Shi, Wenkai Yan, and Luming Yang. 2026. "YOLOv11n-KL: A Lightweight Tomato Pest and Disease Detection Model for Edge Devices" Horticulturae 12, no. 1: 49. https://doi.org/10.3390/horticulturae12010049
APA StylePeng, S., Chen, X., Jiang, Y., Jia, Z., Shang, Z., Shi, L., Yan, W., & Yang, L. (2026). YOLOv11n-KL: A Lightweight Tomato Pest and Disease Detection Model for Edge Devices. Horticulturae, 12(1), 49. https://doi.org/10.3390/horticulturae12010049

