计算机工程与应用 ›› 2024, Vol. 60 ›› Issue (23): 238-248.DOI: 10.3778/j.issn.1002-8331.2406-0132

• 图形图像处理 • 上一篇    下一篇

改进YOLOv8n的果园番茄目标检测算法

杨国亮,盛杨杨,洪鑫芳,张佳琦   

  1. 江西理工大学 电气工程与自动化学院,江西 赣州 341000
  • 出版日期:2024-12-01 发布日期:2024-11-29

Improved YOLOv8n Orchard Tomato Target Detection Algorithm

YANG Guoliang, SHENG Yangyang, HONG Xinfang, ZHANG Jiaqi   

  1. School of Electrical Engineering and Automation, Jiangxi University of Science and Technology, Ganzhou, Jiangxi 341000, China
  • Online:2024-12-01 Published:2024-11-29

摘要: 针对自然果园环境下,不同生长周期的番茄姿态多变,易受光线、绿色叶片背景影响导致图像特征不明显,番茄果实生长时易出现扎堆密集以及枝叶藤蔓遮挡等情况,时常造成漏检、误检等问题,提出了一种基于改进YOLOv8n的番茄生长周期采摘检测方法。在Backbone中设计超分辨率自适应注意力模块(super-resolution adaptive attention module,SPAAM),有效提升特征图像分辨率,改善小目标番茄特征提取不充分的问题,并结合坐标注意力机制(coordinate attention,CA)提高关键位置信息提取能力;设计C2f-DCF替换原有C2f,用于自适应番茄姿态形变特征,提高对形变物体空间布局的建模能力,同时提升计算效率;设计GSCHead降低头部参数量,并且添加四倍下采样分支提高对小目标番茄的约束效果;引入Wise-IoU损失函数,提升模型在不同质量图像上训练的泛化性能。改进后的算法在测试集上精确率达到93.9%,相较于原模型提升1.9个百分点,参数量降低0.18×106,有效改善了遮挡情况的漏检率和小目标番茄的检测性能,同时检测速度达到139 FPS,可以便捷地部署到终端完成实时检测。

关键词: 番茄检测, YOLOv8n, 超分辨率自适应注意力模块(SPAAM), C2f-DCF, GSCHead, 损失函数

Abstract: In the environment of natural orchards, tomatoes with different growth cycles have various postures, are susceptible to the influence of light and green leaf background, resulting in not obvious image features, and tomato fruits are prone to cluster densely and branches and leaves are blocked by vines during growth, which often causes problems such as missed detection and false detection. A method for picking and detecting tomato growth cycles based on improved YOLOv8n is proposed. Firstly, super-resolution adaptive attention module (SPAAM) is designed in backbone to effectively improve feature image resolution and solve the problem of inadequate feature extraction of small target tomatoes. Combining coordinate attention (CA) can improve the ability of extracting key position information. Secondly, C2F-DCF is designed to replace the original C2f, which is used to adapt the tomato attitude deformation characteristics, improve the modeling ability of the spatial layout of the deformed object, and improve the calculation efficiency. GSCHead is designed to reduce the number of head parameters, and four-fold subsampling branches are added to improve the constraint effect on small target tomatoes. Finally, Wise-IoU loss function is introduced to improve the generalization performance of the model trained on different quality images. The accuracy of the improved algorithm on the test set reaches 93.9%, which is 1.9?percentage points higher than that of the original model, and the number of parameters is reduced by 0.18×106, which effectively improves the missed detection rate of occlusion and the detection performance of small target tomatoes. At the same time, the detection speed reaches 139 FPS, which can be easily deployed to the terminal to complete real-time detection.

Key words: tomato detection, YOLOv8n, super-resolution adaptive attention module (SPAAM), C2f-DCF, GSCHead, loss function