Enhanced YOLO11n-Seg with Attention Mechanism and Geometric Metric Optimization for Instance Segmentation of Ripe Blueberries in Complex Greenhouse Environments
Abstract
1. Introduction
2. Materials and Methods
2.1. The Dataset
2.2. Improved YOLO11n-Seg Algorithm
2.2.1. YOLO11n-Seg Network Architecture
2.2.2. Innovative Spatial and Channel Attention Mechanism
2.2.3. Dual Attention Block
2.2.4. Normalized Wasserstein Distance
3. Results
3.1. Experimental Equipment and Environment
3.2. Evaluation Metrics
3.3. Experimental Results and Analysis
3.3.1. Comparison Experiment
3.3.2. Ablation Experiment
3.3.3. Attention Mechanism Performance Comparison Experiment
3.3.4. Statistical Significance Analysis
3.3.5. Visual Results Analysis
4. Discussion
5. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Data Availability Statement
Conflicts of Interest
References
- Seeram, N.P.; Adams, L.S.; Zhang, Y.; Lee, R.; Sand, D.; Scheuller, H.S.; Heber, D. Blackberry, black raspberry, blueberry, cranberry, red raspberry, and strawberry extracts inhibit growth and stimulate apoptosis of human cancer cells in vitro. J. Agric. Food Chem. 2006, 54, 9329–9339. [Google Scholar] [CrossRef]
- Mallik, A.; Hamilton, J. Harvest date and storage effect on fruit size, phenolic content and antioxidant capacity of wild blueberries of NW Ontario, Canada. J. Food Sci. Technol. 2017, 54, 1545–1554. [Google Scholar] [CrossRef]
- Wu, X.; Beecher, G.R.; Holden, J.M.; Haytowitz, D.B.; Gebhardt, S.E.; Prior, R.L. Lipophilic and hydrophilic antioxidant capacities of common foods in the United States. J. Agric. Food Chem. 2004, 52, 4026–4037. [Google Scholar] [CrossRef] [PubMed]
- Hankinson, S.E.; Stampfer, M.J.; Seddon, J.M.; Colditz, G.A.; Rosner, B.; Speizer, F.E.; Willett, W.C. Nutrient intake and cataract extraction in women: A prospective study. Br. Med. J. 1992, 305, 335–339. [Google Scholar] [CrossRef] [PubMed]
- Trejo-Pech, C.O.; Rodríguez-Magaña, A.; Briseño-Ramírez, H.; Ahumada, R. A Monte Carlo simulation case study on blueberries from Mexico. Int. Food Agribus. Manag. Rev. 2024, 27, 359–377. [Google Scholar] [CrossRef]
- Darnell, R.L. Blueberries. In Temperate Fruit Crops in Warm Climates; Springer: Dordrecht, The Netherlands, 2000; pp. 429–444. [Google Scholar]
- Yeh, D.A.; Kramer, J.; Calvin, L.; Weber, C. The Changing Landscape of US Strawberry and Blueberry Markets: Production, Trade, and Challenges from 2000 to 2020; United States Department of Agriculture: Washington, DC, USA, 2023.
- Yu, H.; Wei, J.; Yang, S.; Yang, X.; He, S.a. The development situation and prospect of blueberry industry in China. In Proceedings of the XII International Vaccinium Symposium 1357, Halifax, NS, Canada, 30 August–1 September 2021; pp. 325–328. [Google Scholar]
- Manida, M. The future of food and agriculture trends and challenges. Agric. Food E-Newsl. 2022, 4, 27–29. [Google Scholar]
- Brondino, L.; Briano, R.; Massaglia, S.; Giuggioli, N. Influence of harvest method on the quality and storage of highbush blueberry. J. Agric. Food Res. 2022, 10, 100415. [Google Scholar] [CrossRef]
- Fang, Y.; Liao, B.; Wang, X.; Fang, J.; Qi, J.; Wu, R.; Niu, J.; Liu, W. You only look at one sequence: Rethinking transformer in vision through object detection. Adv. Neural Inf. Process. Syst. 2021, 34, 26183–26197. [Google Scholar]
- Magalhães, S.A.; Castro, L.; Moreira, G.; Dos Santos, F.N.; Cunha, M.; Dias, J.; Moreira, A.P. Evaluating the single-shot multibox detector and YOLO deep learning models for the detection of tomatoes in a greenhouse. Sensors 2021, 21, 3569. [Google Scholar] [CrossRef]
- Sun, P.; Zhang, R.; Jiang, Y.; Kong, T.; Xu, C.; Zhan, W.; Tomizuka, M.; Li, L.; Yuan, Z.; Wang, C. Sparse r-cnn: End-to-end object detection with learnable proposals. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Nashville, TN, USA, 20–25 June 2021; pp. 14454–14463. [Google Scholar]
- Li, X.; Lv, C.; Wang, W.; Li, G.; Yang, L.; Yang, J. Generalized focal loss: Towards efficient representation learning for dense object detection. IEEE Trans. Pattern Anal. Mach. Intell. 2022, 45, 3139–3153. [Google Scholar] [CrossRef]
- Wang, C.-Y.; Liao, H.-Y.M. YOLOv1 to YOLOv10: The fastest and most accurate real-time object detection systems. APSIPA Trans. Signal Inf. Process. 2024, 13, e29. [Google Scholar] [CrossRef]
- Hurtik, P.; Molek, V.; Hula, J.; Vajgl, M.; Vlasanek, P.; Nejezchleba, T. Poly-YOLO: Higher speed, more precise detection and instance segmentation for YOLOv3. Neural Comput. Appl. 2022, 34, 8275–8290. [Google Scholar] [CrossRef]
- Xiaofen, D.; James, O.; Russell, R. Comparison of fast gas chomatography-surface acoustic wave (FGC-SAW) detection and GC-MS for characterizing blueberry cultivars and maturity. J. Agric. Food Chem. 2012, 60, 5099–5106. [Google Scholar]
- MacEachern, C.B.; Esau, T.J.; Schumann, A.W.; Hennessy, P.J.; Zaman, Q.U. Detection of fruit maturity stage and yield estimation in wild blueberry using deep learning convolutional neural networks. Smart Agric. Technol. 2023, 3, 100099. [Google Scholar] [CrossRef]
- Yang, W.; Ma, X.; An, H. Blueberry Ripeness Detection Model Based on Enhanced Detail Feature and Content-Aware Reassembly. Agronomy 2023, 13, 1613. [Google Scholar] [CrossRef]
- Aguilera, C.A.; Flores, C.F.; Aguilera, C.; Navarrete, C. Comprehensive Analysis of Model Errors in Blueberry Detection and Maturity Classification: Identifying Limitations and Proposing Future Improvements in Agricultural Monitoring. Agriculture 2023, 14, 18. [Google Scholar] [CrossRef]
- Xiao, F.; Wang, H.; Xu, Y.; Shi, Z. A Lightweight Detection Method for Blueberry Fruit Maturity Based on an Improved YOLOv5 Algorithm. Agriculture 2023, 14, 36. [Google Scholar] [CrossRef]
- Wang, C.; Han, Q.; Li, J.; Li, C.; Zou, X. YOLO-BLBE: A Novel Model for Identifying Blueberry Fruits with Different Maturities Using the I-MSRCR Method. Agronomy 2024, 14, 658. [Google Scholar] [CrossRef]
- Gai, R.; Gao, J.; Xu, G. HPPEM: A High-Precision Blueberry Cluster Phenotype Extraction Model Based on Hybrid Task Cascade. Agronomy 2024, 14, 1178. [Google Scholar] [CrossRef]
- Liu, Y.; Zheng, H.; Zhang, Y.; Zhang, Q.; Chen, H.; Xu, X.; Wang, G. “Is this blueberry ripe?”: A blueberry ripeness detection algorithm for use on picking robots. Front. Plant Sci. 2023, 14, 1198650. [Google Scholar] [CrossRef]
- Feng, W.; Liu, M.; Sun, Y.; Wang, S.; Wang, J. The Use of a Blueberry Ripeness Detection Model in Dense Occlusion Scenarios Based on the Improved YOLOv9. Agronomy 2024, 14, 1860. [Google Scholar] [CrossRef]
- Zhai, X.; Zong, Z.; Xuan, K.; Zhang, R.; Shi, W.; Liu, H.; Han, Z.; Luan, T. Detection of maturity and counting of blueberry fruits based on attention mechanism and bi-directional feature pyramid network. J. Food Meas. Charact. 2024, 18, 6193–6208. [Google Scholar] [CrossRef]
- Tian, Y.; Qin, S.; Yan, Y.; Wang, J.; Jiang, F. Blueberry Maturity Detection in Complex Field Environments Based on Improved YOLOv8. Trans. Chin. Soc. Agric. Eng. 2024, 40, 153–162. [Google Scholar]
- Tian, Z.; Shen, C.; Chen, H.; He, T. Fcos: Fully convolutional one-stage object detection. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Seoul, Republic of Korea, 27 October–2 November 2019; pp. 9627–9636. [Google Scholar]
- Wang, J.; Yang, W.; Guo, H.; Zhang, R.; Xia, G.-S. Tiny object detection in aerial images. In Proceedings of the 2020 25th International Conference on Pattern Recognition (ICPR), Virtual Event/Milan, Italy, 10–15 January 2021; pp. 3791–3798. [Google Scholar]
- Huang, X.; Peng, D.; Qi, H.; Zhou, L.; Zhang, C. Detection and instance segmentation of grape clusters in orchard environments using an improved mask R-CNN model. Agriculture 2024, 14, 918. [Google Scholar] [CrossRef]
- Sun, T.; Zhang, W.; Gao, X.; Zhang, W.; Li, N.; Miao, Z. Efficient occlusion avoidance based on active deep sensing for harvesting robots. Comput. Electron. Agric. 2024, 225, 109360. [Google Scholar] [CrossRef]
- Li, C.-H.G.; Wu, J.-T. Deep learning approaches for improving robustness in real-time 3D-object positioning and manipulation in severe lighting conditions. Int. J. Adv. Manuf. Technol. 2023, 129, 3829–3847. [Google Scholar] [CrossRef]
- Wu, K.; Li, D. Chengjiang Blueberry Enters Version 4.0. Chengjiang Blueberry News, 20 May 2022; p. 001. [Google Scholar]
- Wu, K. Chengjiang Explores the Development of Modern Agriculture with an Industrialization Concept. Chengjiang Agriculture News, 26 October 2023; p. 002. [Google Scholar]
- Chen, J. Fuxian Lake Protection Stimulates the Development of Chengjiang’s Green Ecological Blueberry Industry around the Lake. Chengjiang Ecological Agriculture News, 11 May 2024; p. 001. [Google Scholar]
- Khanam, R.; Hussain, M. YOLO11: An overview of the key architectural enhancements. arXiv 2024, arXiv:2410.17725. [Google Scholar]
- Hu, B.; Pu, H.; Wei, Q.-Y.; Sun, D.-W. Recent Advances in Detecting and Regulating Ethylene Concentrations for Shelf-Life Extension and Maturity Control of Fruit: A Review. Trends Food Sci. Technol. 2019, 91, 66–82. [Google Scholar] [CrossRef]
- 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]
- 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, Nashville, TN, USA, 20–25 June 2021; pp. 13713–13722. [Google Scholar]
- Kim, N.; Choi, I.-S.; Han, S.-S.; Jeong, C.-S. DA-Net: Dual Attention Network for Haze Removal in Remote Sensing Image. IEEE Access 2024, 12, 136297–136312. [Google Scholar] [CrossRef]
- Wang, J.; Xu, C.; Yang, W.; Yu, L. A normalized Gaussian Wasserstein distance for tiny object detection. arXiv 2021, arXiv:2110.13389. [Google Scholar]
- Li, Z.; Xu, R.; Li, C.; Munoz, P.; Takeda, F.; Leme, B. In-field blueberry fruit phenotyping with a MARS-PhenoBot and customized BerryNet. Comput. Electron. Agric. 2025, 232, 110057. [Google Scholar] [CrossRef]
- Gonzalez, S.; Arellano, C.; Tapia, J.E. Deepblueberry: Quantification of blueberries in the wild using instance segmentation. IEEE Access 2019, 7, 105776–105788. [Google Scholar] [CrossRef]
- Ni, X.; Li, C.; Jiang, H.; Takeda, F. Deep learning image segmentation and extraction of blueberry fruit traits associated with harvestability and yield. Hortic. Res. 2020, 7, 110. [Google Scholar] [CrossRef] [PubMed]
- Zhang, M.; Jiang, Y.; Li, C.; Yang, F. Fully convolutional networks for blueberry bruising and calyx segmentation using hyperspectral transmittance imaging. Biosyst. Eng. 2020, 192, 159–175. [Google Scholar] [CrossRef]
- Ni, X.; Takeda, F.; Jiang, H.; Yang, W.Q.; Saito, S.; Li, C. A deep learning-based web application for segmentation and quantification of blueberry internal bruising. Comput. Electron. Agric. 2022, 201, 107200. [Google Scholar] [CrossRef]
- Mullins, C.C.; Esau, T.J.; Zaman, Q.U.; Al-Mallahi, A.A.; Farooque, A.A. Exploiting 2D Neural Network Frameworks for 3D Segmentation Through Depth Map Analytics of Harvested Wild Blueberries (Vaccinium angustifolium Ait.). J. Imaging 2024, 10, 324. [Google Scholar] [CrossRef]










| Dataset | Total Number of Pictures | Training Set | Validation Set | Test Set |
|---|---|---|---|---|
| Original image | 1405 | 984 | 282 | 139 |
| Data enhancement | 3400 | 2380 | 680 | 340 |
| Model | Detection (Box) Precision (P)/% | Detection (Box) Recall (R)/% | Detection (Box) mAP@0.5/% | Detection (Box) F1/% | GFLOPs | Inference (ms) |
|---|---|---|---|---|---|---|
| YOLOv8n-seg | 90.1 | 86.2 | 92.3 | 88.1 | 10.7 | 3.4 |
| YOLOv8n-seg-p6 | 92.1 | 84.1 | 92.1 | 87.9 | 10.7 | 3.8 |
| YOLOv9c-seg | 92.5 | 83.7 | 90.4 | 87.8 | 138.0 | 12.5 |
| YOLO11n-seg | 89.4 | 86.3 | 92.0 | 87.8 | 10.2 | 1.9 |
| Our model | 91.2 | 87.8 | 92.5 | 89.5 | 10.5 | 2.2 |
| Model | Segmentation (Mask) P/% | Segmentation (Mask) R/% | Segmentation (Mask) mAP@0.5/% | Segmentation (Mask) F1/% | GFLOPs (G) | Inference (ms) |
|---|---|---|---|---|---|---|
| YOLOv8n-seg | 90.1 | 86.2 | 92.2 | 88.1 | 10.7 | 3.4 |
| YOLOv8n-seg-p6 | 91.3 | 85.1 | 92.0 | 88.0 | 10.7 | 3.8 |
| YOLOv9c-seg | 92.8 | 83.9 | 90.5 | 88.1 | 138 | 12.5 |
| Deepblueberry | \ | \ | 75.9 | \ | \ | \ |
| BerryNet | 75.4 | 71.3 | 78.7 | 73.29 | 34.1 | \ |
| YOLO11n-seg | 89.8 | 86.6 | 92.2 | 88.1 | 10.2 | 1.9 |
| Our model | 90.6 | 87.8 | 92.3 | 89.2 | 10.5 | 2.2 |
| NWD | SCA | DAB | Detection (Box) Precision (P)/% | Detection (Box) Recall (R)/% | Detection (Box) mAP@0.5/% | Detection (Box) F1/% |
|---|---|---|---|---|---|---|
| √ | × | × | 89.2 | 87.0 | 92.4 | 88.1 |
| × | √ | × | 90.8 | 84.6 | 91.4 | 87.5 |
| × | × | √ | 88.5 | 86.3 | 91.7 | 87.3 |
| √ | √ | × | 90.2 | 85.1 | 92.3 | 87.5 |
| √ | × | √ | 89.2 | 86.2 | 92.0 | 87.6 |
| × | √ | √ | 90.5 | 85.5 | 92.6 | 87.9 |
| √ | √ | √ | 91.2 | 87.8 | 92.5 | 89.5 |
| NWD | SCA | DAB | Segmentation (Mask) Precision (P)/% | Segmentation (Mask) Recall (R)/% | Segmentation (Mask) mAP@0.5/% | Segmentation (Mask) F1/% |
|---|---|---|---|---|---|---|
| √ | × | × | 88.9 | 86.2 | 92.1 | 87.5 |
| × | √ | × | 90.8 | 91.0 | 91.3 | 90.8 |
| × | × | √ | 88.7 | 86.5 | 91.9 | 87.5 |
| √ | √ | × | 90.2 | 85.1 | 91.9 | 87.5 |
| √ | × | √ | 89.2 | 86.2 | 91.8 | 87.6 |
| × | √ | √ | 89.0 | 87.2 | 92.2 | 88.2 |
| √ | √ | √ | 90.6 | 87.8 | 92.3 | 88.7 |
| Loss Function | (P)/% | (R)/% | mAP@0.5/% | F1/% | GFLOPs (G) | Inference (ms) |
|---|---|---|---|---|---|---|
| SD-IoU | 89.0 | 86.6 | 91.8 | 87.7 | 10.5 | 2.2 |
| Inner-IoU | 92.1 | 83.5 | 92.3 | 87.5 | 10.5 | 2.2 |
| Shape-Iou | 87.9 | 87.3 | 92.0 | 87.5 | 10.5 | 2.2 |
| Unified-Iou | 90.5 | 85.2 | 91.5 | 87.7 | 10.5 | 2.2 |
| NWD | 91.2 | 87.8 | 92.5 | 89.5 | 10.5 | 2.2 |
| Loss Function | (P)/% | (R)/% | mAP@0.5/% | F1/% | GFLOPs (G) | Inference (ms) |
|---|---|---|---|---|---|---|
| SD-IoU | 89.1 | 86.6 | 92.0 | 87.8 | 10.5 | 2.2 |
| Inner-IoU | 90.0 | 85.6 | 92.2 | 87.7 | 10.5 | 2.2 |
| Shape-Iou | 88.3 | 87.6 | 92.1 | 87.9 | 10.5 | 2.2 |
| Unified-Iou | 90.6 | 85.4 | 91.2 | 87.9 | 10.5 | 2.2 |
| NWD | 90.6 | 87.8 | 92.3 | 89.2 | 10.5 | 2.2 |
| DAB | Detection (Box) Precision (P)/% | Detection (Box) Recall (R)/% | Detection (Box) mAP@0.5/% | Detection (Box) F1/% |
|---|---|---|---|---|
| CBAM | 90.0 | 84.9 | 92.2 | 87.3 |
| SE | 91.4 | 85.6 | 92.8 | 87.9 |
| SCA | 90.8 | 84.6 | 91.4 | 87.5 |
| DAB | 88.5 | 86.3 | 91.7 | 87.3 |
| SCA +DAB | 89.0 | 87.2 | 92.2 | 88.2 |
| Scene | Metrics | YOLOv8-Seg | YOLOv8-Seg-p6 | YOLOv9c-Seg | YOLO11-Seg | Our |
|---|---|---|---|---|---|---|
| (a) overlapping of fruits | Total number of targets | 11 | 10 | 9 | 10 | 10 |
| Total segmented area (%) | 10.19 | 9.48 | 8.68 | 10.44 | 11.36 | |
| Time taken (s) | 0.09 | 0.081 | 0.294 | 0.66 | 0.068 | |
| Confidence score (%) | 94.62 | 86.06 | 88.89 | 87.53 | 91.45 | |
| (b) shaded by branches and leaves | Total number of targets | 2 | 1 | 3 | 3 | 3 |
| Total segmented area (%) | 1.63 | 1.19 | 2.51 | 2.52 | 2.52 | |
| Time taken (s) | 0.04 | 0.047 | 0.182 | 0.040 | 0.042 | |
| Confidence score (%) | 85.82 | 75.91 | 79.51 | 82.07 | 88.6 | |
| (c) uneven illumination | Total number of targets | 7 | 4 | 4 | 4 | 5 |
| Total segmented area (%) | 17.68 | 11.71 | 11.10 | 11.46 | 11.46 | |
| Time taken (s) | 0.038 | 0.042 | 0.03 | 0.089 | 0.089 | |
| Confidence score (%) | 84.38 | 82.24 | 81.14 | 81.14 | 93.7 | |
| (d) background interference | Total number of targets | 9 | 8 | 8 | 8 | 7 |
| Total segmented area (%) | 6.42 | 6.10 | 6.23 | 6.31 | 6.30 | |
| Time taken (s) | 0.038 | 0.043 | 0.232 | 0.038 | 0.036 | |
| Confidence score (%) | 86.64 | 84.87 | 79.52 | 91.61 | ||
| (e) intensive small target | Total number of targets | 19 | 20 | 21 | 19 | 20 |
| Total segmented area (%) | 5.81 | 5.99 | 6.34 | 5.84 | 6.13 | |
| Time taken (s) | 0.045 | 0.048 | 0.023 | 0.44 | 0.040 | |
| Confidence score (%) | 90.40 | 89.29 | 86.59 | 86.04 | 86.17 | |
| (f) scale change | Total number of targets | 26 | 27 | 26 | 26 | 27 |
| Total segmented area (%) | 9.39 | 9.63 | 9.32 | 9.45 | 9.77 | |
| Time taken (s) | 0.05 | 0.051 | 0.244 | 0.05 | 0.046 | |
| Confidence score (%) | 87.82 | 87.07 | 86.17 | 82.96 | 92.90 |
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 (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Luo, R.; Zhao, R.; Yi, B. Enhanced YOLO11n-Seg with Attention Mechanism and Geometric Metric Optimization for Instance Segmentation of Ripe Blueberries in Complex Greenhouse Environments. Agriculture 2025, 15, 1697. https://doi.org/10.3390/agriculture15151697
Luo R, Zhao R, Yi B. Enhanced YOLO11n-Seg with Attention Mechanism and Geometric Metric Optimization for Instance Segmentation of Ripe Blueberries in Complex Greenhouse Environments. Agriculture. 2025; 15(15):1697. https://doi.org/10.3390/agriculture15151697
Chicago/Turabian StyleLuo, Rongxiang, Rongrui Zhao, and Bangjin Yi. 2025. "Enhanced YOLO11n-Seg with Attention Mechanism and Geometric Metric Optimization for Instance Segmentation of Ripe Blueberries in Complex Greenhouse Environments" Agriculture 15, no. 15: 1697. https://doi.org/10.3390/agriculture15151697
APA StyleLuo, R., Zhao, R., & Yi, B. (2025). Enhanced YOLO11n-Seg with Attention Mechanism and Geometric Metric Optimization for Instance Segmentation of Ripe Blueberries in Complex Greenhouse Environments. Agriculture, 15(15), 1697. https://doi.org/10.3390/agriculture15151697

