作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2025, Vol. 51 ›› Issue (9): 294-305. doi: 10.19678/j.issn.1000-3428.0069459

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

结合改进YOLOv5s和动态数据增强的海面舰船检测

马淦, 谷雨*(), 彭冬亮   

  1. 杭州电子科技大学自动化学院, 浙江 杭州 310018
  • 收稿日期:2024-03-01 修回日期:2024-04-23 出版日期:2025-09-15 发布日期:2025-09-26
  • 通讯作者: 谷雨
  • 基金资助:
    浙江省自然科学基金(LY21F030010); 浙江省自然科学基金(LZ23F030002)

Combining Improved YOLOv5s and Dynamic Data Augmentation for Sea Surface Ship Detection

MA Gan, GU Yu*(), PENG Dongliang   

  1. School of Automation, Hangzhou Dianzi University, Hangzhou 310018, Zhejiang, China
  • Received:2024-03-01 Revised:2024-04-23 Online:2025-09-15 Published:2025-09-26
  • Contact: GU Yu

摘要:

海面成像过程易受天气、光照、水雾等因素的影响,针对海面舰船检测过程中的小目标模糊、目标尺度差异大、类别不均衡等问题,设计一种动态“复制-粘贴”的数据增强方式,将其嵌入到YOLOv5框架,提出了一种改进YOLOv5s的海面目标检测算法。在主干网络中,设计浅层局部感知模块,混合空洞卷积、深度可分离卷积与残差连接支路以并联的方式提升模块感受野,加强提取局部细节信息的能力;在颈部网络中,设计了注意力融合模块,利用空间注意力机制与通道注意力机制,聚合浅层空间信息与深层语义信息,提高网络特征表达能力;在检测输出中,通过对其相邻的浅层检测头特征进行下采样与融合,设计了层级融合解耦头,提升了目标分类与定位精度。动态“复制-粘贴”数据增强策略从训练集图像中裁剪目标,存入目标样本库,在每个训练轮次中,根据目标分布的概率,从样本库中随机选取目标,进行一定比例的几何与光度变换后,随机粘贴至训练图像中,从而提升前景目标密度。在SMD-Plus数据集上的实验结果表明,所提算法的mAP@0.5、mAP@0.5 ∶0.95与YOLOv5s模型相比分别提升了6.7和5.2百分点。在WSODD数据集上开展迁移实验,所提算法的mAP@0.5、mAP@0.5 ∶0.95与YOLOv5s模型相比分别提升3.7和3.3百分点。改进后的算法与提出的动态数据增强方法能有效缓解类别与尺寸不均衡问题,提高小目标检测精度,适用于海面场景下的舰船检测任务。

关键词: 舰船检测, 数据增强, 多尺度特征, 小目标检测, 注意力机制

Abstract:

To address the challenges of small object blurring, large object scale difference, and category imbalance in ship detection, this paper designs a dynamic ″copy-paste″ data augmentation method, embeds it into the YOLOv5 model, and proposes an improved YOLOv5s algorithm for sea surface object detection. In the backbone network, a shallow local perception module is introduced to improve the receptive field by combining a hybrid dilated convolution, depthwise separable convolution, and residual connection branch in parallel. This enhances the extraction of detailed local information. In the neck network, an attention fusion module is designed to aggregate shallow spatial information and deep semantic information using spatial and channel attention mechanisms, respectively. This improves the feature expression capability of the network. For the detection head, a hierarchical fusion decoupling head is designed by downsampling and fusing features from the adjacent shallow detection head to enhance object classification and positioning accuracy. The dynamic ″copy-paste″ data augmentation strategy involves extracting objects from training set images and storing them in a target sample library. During each training epoch, targets are randomly selected from this library based on their probability distribution values. After applying geometric and photometric transformations in certain proportions, these targets are pasted into the training images to increase the foreground target density. The SMD-Plus dataset is used for experimental verification. The experimental results show that mAP@0.5 and mAP@0.5 ∶95 values for the proposed algorithm are improved by 6.7 and 5.2 percentage points, respectively, compared with the YOLOv5s model. Migration experiments are conducted on the WSODD dataset, and mAP@0.5 and mAP@0.5 ∶95 values are improved by 3.7 and 3.3 percentage points, respectively. Additionally, the improved algorithm and the proposed dynamic data augmentation method alleviate the problems of class and size imbalance, improve the detection accuracy of small targets, and are suitable for ship detection tasks.

Key words: ship detection, data augmentation, multi-scale features, small object detection, attention mechanism