Sonar image small target detection method based on YOLOv5s

By improving the YOLOv5s model and introducing CARAFE feature upsampling, Slimneck structure and ACmix attention mechanism, the problem of traditional sonar image detection methods being unable to efficiently detect small targets in complex seabed environments is solved, achieving higher detection accuracy and recall.

CN122067084APending Publication Date: 2026-05-19GUILIN UNIV OF ELECTRONIC TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUILIN UNIV OF ELECTRONIC TECH
Filing Date
2026-03-03
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

Traditional sonar image detection methods are insufficient for efficiently detecting small targets in complex seabed environments, and they rely on manual operation, which is time-consuming and labor-intensive.

Method used

An improved object detection model based on YOLOv5s is adopted, which enhances feature extraction and detection capabilities by introducing the CARAFE feature upsampling operator, Slimneck structure and ACmix attention mechanism.

Benefits of technology

It improves the recall and accuracy of small target detection, reduces false positives, and enhances the model's detection performance in complex seabed environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122067084A_ABST
    Figure CN122067084A_ABST
Patent Text Reader

Abstract

The invention is suitable for the technical field of sonar target detection, and particularly relates to a sonar image small target detection method based on YOLOv5s, and the method comprises the steps: constructing an improved target detection model based on a YOLOv5 basic model; the improved target detection model uses a CARAFE feature up-sampling operator to replace nearest neighbor interpolation up-sampling of a YOLOv5 basic model; using a Slimcheck structure to replace a Neck part in the YOLOv5 basic model, and adding an attention mechanism Acmix in the YOLOv5 basic model; and during target detection, inputting data to be detected into the improved target detection model, and outputting a detection result through the improved target detection model. According to the method, in YOLOv5s, a CARAFE feature up-sampling operator is used for replacing up-sampling in an original network, so that the receptive field of up-sampling feature extraction operation of the network is increased; a Slimcheck structure is used to replace a Neck structure of an original network, detail information of extraction features of a backbone network extraction feature layer is enhanced, and the feature extraction capability of the network to small targets is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of sonar target detection technology, and particularly relates to a method for small target detection in sonar images based on YOLOv5s. Background Technology

[0002] The ocean possesses abundant natural resources such as minerals and oil and gas. With the continuous expansion of marine resource development and military applications, the importance of sonar image detection technology is increasingly prominent. Its applications cover underwater target identification (such as shipwrecks, schools of fish, and submarines), seabed topography mapping, and underwater infrastructure monitoring. Sonar image detection is one of the key technologies in marine exploration, underwater target identification, and environmental monitoring. Sonar generates images of target objects in the underwater environment by emitting sound waves and receiving their reflected signals. Because the propagation of light and electromagnetic waves in water is limited, sonar has become the primary means of underwater detection. Therefore, efficient sonar image detection algorithms can not only improve the accuracy of target identification but also provide reliable data support for marine scientific research and underwater operations.

[0003] Traditional underwater sonar image target detection algorithms generally consist of two parts: feature extraction and a classifier. Scott Reed et al. extracted the highlight and shadow regions of side-scan sonar images and proposed a cooperative statistical model to extract target features by utilizing the spatial relationship between the two. DMLane et al. obtained the classification output by combining prior information and a knowledge base based on image preprocessing, and then extracted features such as volume, variance, brightness, and shape.

[0004] Due to the complex underwater environment, sonar images are subject to various external interferences, which can cause distortion. Traditional sonar image detection methods can only identify sonar images with simple backgrounds and obvious features. Furthermore, detection relies on manual operation, which is time-consuming and labor-intensive. Therefore, traditional sonar image detection methods cannot meet the current requirements for efficient sonar image detection tasks. Summary of the Invention

[0005] The purpose of this invention is to provide a method for small target detection in sonar images based on YOLOv5s, which aims to solve the problem that traditional sonar image detection methods are difficult to meet the current requirements for efficient sonar image detection tasks.

[0006] This invention is implemented as follows: a method for small target detection in sonar images based on YOLOv5s, the method comprising: An improved target detection model based on the YOLOv5 basic model is constructed; the YOLOv5 basic model includes four parts: Input, Backbone, Neck, and Head. The improved target detection model replaces the nearest neighbor interpolation upsampling of the YOLOv5 base model with the CARAFE feature upsampling operator; it replaces the Neck part in the YOLOv5 base model with the Slimneck structure; and it adds the attention mechanism Acmix to the YOLOv5 base model. When performing target detection, the data to be detected is input into the improved target detection model, and the detection results are output through the improved target detection model.

[0007] Preferably, the CARAFE feature upsampling operator is divided into two parts: a prediction module and a recombination module. The prediction module uses 11 Conv to compress the number of channels of the CHW-sized input feature map into CmHW, and generates a prediction module based on the compressed features. The upsampling kernel has a weight sum that remains 1 after normalization. During the recombination process, the module maps the output feature maps of each region back to their corresponding positions in the input feature maps, and then reassembles the feature maps. The region is multiplied by the sampling kernel, and the final output is... The feature map.

[0008] Preferably, the feature recombination formula is expressed as: in, , This indicates the value of a pixel in the output feature map. This represents the weight of the content-aware kernel at offset (n, m). It is the pixel value or feature vector at a certain location on the input feature map. These are the input coordinates, where, It is a neighborhood offset. It is the half-width of the core.

[0009] Preferably, the Slimneck structure is composed of a GSConv module and a VoVGSCSP module, which are a mixture of convolution and depthwise separable convolution. After the regular convolutions exchange the local feature information of each channel, they are replaced with the output of depthwise separable convolution to form the GSConv module. The VoVGSCSP module is constructed by using a one-time aggregation method on the GSbottleneck constructed by the GSConv module.

[0010] Preferably, the attention mechanism Acmix is ​​an attention mechanism that combines convolution and self-attention, and its working mechanism mainly consists of two stages: In the first stage, three 11 convolutions are used to project and reconstruct the input features, resulting in 3N intermediate features of mapped features. The second stage is divided into a self-attention branch and a convolution branch. The self-attention branch is responsible for dividing the reconstructed intermediate features into N groups of three feature parts containing three 11 convolutions and mapping them as queries, keys, and values. The convolution branch generates the feature results through convolution operations. Finally, the results of the self-attention branch and the convolution branch are merged and processed to obtain the final feature results.

[0011] Preferably, the data to be detected is preprocessed before the step of inputting the data to be detected into the improved target detection model.

[0012] Preferably, after constructing the improved target detection model, the improved target detection model is trained and validated.

[0013] The present invention provides a method for small target detection in sonar images based on YOLOv5s. In YOLOv5s, the CARAFE feature upsampling operator is used to replace the upsampling in the original network, thereby increasing the receptive field of the network for upsampling feature extraction. The Slimneck structure is used to replace the Neck structure of the original network, which strengthens the detailed information of the feature extraction layer of the backbone network and enhances the network's feature extraction capability for small targets. The ACmix attention mechanism is introduced so that the network takes into account both global and local features when outputting features, thereby improving the detection effect of small targets. Attached Figure Description

[0014] Figure 1 This is a structural diagram of the improved target detection model provided in an embodiment of the present invention; Figure 2 This is a structural diagram of the YOLOv5 basic model provided in an embodiment of the present invention; Figure 3 This is a structural diagram of the CARAFE feature upsampling operator provided in an embodiment of the present invention; Figure 4 This is a structural diagram of the GSConv model provided in an embodiment of the present invention; Figure 5 The GSBottleneck structure diagram and VoVGSCSP structure diagram provided in the embodiments of the present invention; Figure 6 This is a schematic diagram of the Slimneck structure provided in an embodiment of the present invention; Figure 7 A structural diagram of ACmix provided in an embodiment of the present invention; Figure 8 Sonar image samples provided in embodiments of the present invention; Figure 9 The sonar image target detection results provided in the embodiments of the present invention. Detailed Implementation

[0015] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0016] The improved solution of this invention can be summarized as follows: 1. In the upsampling part of the YOLOv5 base model, the CARAFE feature upsampling operator designed for dense and small objects is introduced to increase the receptive field of the model's upsampling feature extraction operation.

[0017] 2. The Slimneck module, designed to reduce model complexity, replaces the Neck region of YOLOv5s, resulting in lower computational costs and higher detection accuracy when the receptive field for feature extraction is increased.

[0018] 3. An ACmix attention mechanism has been added, making the model focus more on feature extraction of target information.

[0019] like Figure 1 As shown, a method for small target detection in sonar images based on YOLOv5s is described, the method comprising: An improved target detection model based on the YOLOv5 basic model is constructed; the YOLOv5 basic model includes four parts: Input, Backbone, Neck, and Head. The improved target detection model replaces the nearest neighbor interpolation upsampling of the YOLOv5 base model with the CARAFE feature upsampling operator; it replaces the Neck part in the YOLOv5 base model with the Slimneck structure; and it adds the attention mechanism Acmix to the YOLOv5 base model. When performing target detection, the data to be detected is input into the improved target detection model, and the detection results are output through the improved target detection model.

[0020] In this embodiment of the invention, YOLOv5 is the most widely used object detection network in the YOLO series, and YOLOv5s is selected as the baseline network. YOLOv5s consists of four parts: Input, Backbone, Neck, and Head.

[0021] The test data is input into the model for data preprocessing, and then fed into the Backbone for feature extraction. Backbone employs a ResNet and CSP-based architecture, while using adaptive domain scaling to adapt to data at different scales. The features extracted by Backbone are then fed into the Neck for feature fusion. The Neck network consists of a bidirectional feature pyramid structure composed of a Feature Pyramid Network (FPN) and a Path Aggregation Network (PAN), effectively fusing feature maps from different stages to improve the model's detection accuracy. After feature fusion in the Neck, the data is finally output as a prediction result through the Head. The structure of YOLOv5s is as follows: Figure 2 As shown.

[0022] This invention provides a small target detection method for sonar images based on YOLOv5s, which introduces the CARAFE feature upsampling operator. Feature upsampling can display the extracted feature information at a higher resolution, making it a crucial operation for convolutional neural networks to extract target features. By replacing the nearest neighbor interpolation upsampling in YOLOv5s with the CARAFE feature upsampling operator, the receptive field of YOLOv5s is increased, the semantic information required for small target samples is aggregated, and the expressive power of the feature map is enhanced.

[0023] like Figure 3 As shown, the CARAFE operator consists of two modules: a prediction module and a reconstruction module. The prediction module uses a Conv of size 11 to compress the input feature map of size CHW to CmHW, reducing the image dimensionality. Then, based on the compressed features, a reconstruction module is generated. The upsampling kernel, after normalization, has a weight sum maintained at 1 to facilitate subsequent reconstruction. During reconstruction, the module maps the output feature maps of each region back to their corresponding positions in the input feature maps, and then... Perform a dot product between the domain and the sampling kernel, and finally output the result. The feature map. The feature recombination formula is shown in Equation 1: (1) in, The feature recombination operation can calculate the receptive field size on the input feature map based on the differences of each output pixel, and dynamically allocate weights so that the model upsampling operation can capture more semantic information of the small target feature map. Through this two-stage processing, the CARAFE operator achieves adaptive receptive field expansion, effectively expanding the receptive region, thereby improving the semantic information required for small target detection and improving the small target recall rate.

[0024] Replacing the upsampling operation of the YOLOv5s model with the CARAFE feature upsampling operator increases the information content of the feature map, providing strong support for subsequent image detection of small targets.

[0025] In embodiments of the present invention, such as Figure 6 As shown, the Slimneck structure has the function of extracting features at different scales. Slimneck is a novel GSConv and VoVGSCSP module composed of a mixture of regular convolutions and depthwise separable convolutions. The GSConv module is constructed by exchanging local feature information of each channel among regular convolutions and then replacing it with the output of depthwise separable convolutions. Figure 4 As shown. The VoVGSCSP module is built on the GSbottleneck based on the GSConv module using a one-time aggregation method, as shown. Figure 5 As shown, the GSConv module effectively reduces the number of parameters in convolution feature extraction, accelerating the model's feature extraction efficiency. The VoVGSCSP module reduces the overall complexity of the network structure while effectively improving the network's detection accuracy, maintaining good detection performance while keeping the network lightweight. The Slimneck structure combines the characteristics of these two modules. Replacing the YOLOv5s Neck network with the Slimneck structure strengthens the feature extraction layer of the YOLOv5s backbone network, enriches the semantic information of deep features, expands the feature extraction range for small targets, and improves the detection performance of small targets.

[0026] The Slimneck structure combines the characteristics of these two modules. Replacing the Neck network of YOLOv5s with the Slimneck structure can strengthen the feature extraction layer of the YOLOv5s backbone network, enrich the semantic information of deep features, expand the feature extraction range of small targets, and improve the detection performance of small targets.

[0027] In embodiments of the present invention, such as Figure 7 As shown, ACmix is ​​an attention mechanism that combines convolution and self-attention. Its working mechanism mainly consists of two stages. In the first stage, three 1 / 11 convolutions are used to project and reconstruct the input features, resulting in 3N intermediate features mapped to each other. The second stage is divided into a self-attention branch and a convolution branch. The self-attention branch is responsible for dividing the reconstructed intermediate features into N groups, each containing three feature parts from the three 1 / 11 convolutions, and mapping them as queries, keys, and values. The convolution branch generates its feature results through regular convolution operations. Finally, the results from the self-attention branch and the convolution branch are merged to obtain the final feature result. The ACmix attention mechanism complements the advantages of convolution and traditional self-attention mechanisms, forming a feature extraction and fusion operation that considers both global and local aspects. This greatly enhances the network's ability to detect small targets and effectively improves the accuracy of small target detection.

[0028] Adding the ACmix attention mechanism to the network allows it to focus on key locations in the input image, reducing computation at non-key locations and thus improving network computational efficiency. Simultaneously, the ACmix attention mechanism enhances the model's ability to extract features from small objects, resulting in better generalization ability when handling small targets.

[0029] Experimental data and evaluation indicators: Experimental data and parameters: such as Figure 8 As shown, the underwater sonar datasets used in this experiment are the SeabedObjects-KLSG-II dataset and the STCD dataset. The total dataset contains 753 images of shipwrecks, 34 images of human remains, and 123 images of crashed aircraft. After image enhancement techniques such as random cropping, rotation, enlargement, and reduction, the dataset was expanded to 2242 images, including 704 images of human remains, 785 images of aircraft wreckage, and 753 images of shipwrecks. Figure 8 This is a sample image of the dataset used in this experiment.

[0030] The experimental environment in this paper is based on a Windows 10 operating system, using PyTorch as the framework to build the detection model, an NVIDIA Telsa graphics card with 80GB of VRAM, Python version 3.7, and the corresponding PyTorch version 1.7.1 for training. To better verify the detection performance of the improved model, this paper mainly uses three metrics to evaluate the model's feasibility: mean accuracy (mAP), precision, and recall. P represents precision, indicating the accuracy of the model's prediction of positive samples; a larger P value indicates a lower probability of false positives for sonar images, calculated as shown in Equation 1. R represents the model's effectiveness in predicting positive samples; a larger R value indicates a lower probability of false negatives for sonar images, calculated as shown in Equation 2. mAP is the mean accuracy, representing the area under the PR curve; a higher value indicates better detection accuracy.

[0031] (2) (3) Ablation experiment: To better evaluate the impact of the three improvements on the basic model, ablation experiments were conducted while ensuring that all experimental data and operations were consistent. The experimental results are shown in the table below. None CARAFE Slimneck ACmix P R mAP@0.5 0.921 0.926 0.943 0.95 0.927 0.944 0.932 0.93 0.938 0.94 0.949 0.947 0.954 0.924 0.958

[0032] As shown in Table 1, after introducing the CARAFE feature upsampling operator into the basic model, P increases to 0.95, R increases to 0.927, and mAP increases to 0.944 compared to the basic model. When the basic model is combined with a Slimneck structure to build a lightweight Neck network, P increases to 0.932 and R increases to 0.93 compared to the basic model, but mAP decreases to 0.938. This is because the Slimneck structure reduces the network complexity to some extent, leading to a decrease in the model's feature extraction capability. Introducing the ACmix attention mechanism into the basic model increases P to 0.94, R to 0.946, and mAP to 0.947 compared to the basic model. When all three modules are combined, mAP increases to 0.958, a 1.5 percentage point improvement compared to the basic model, demonstrating that the improved YOLOv5 algorithm has a good effect on the detection of small targets in sonar images. The sonar image obtained after detection by the improved YOLOv5 algorithm is shown below. Figure 9 As shown.

[0033] Figure 9 This demonstrates the improved model's performance in detecting small targets in sonar images. Figure 9 It can be seen that the improved model can accurately select small targets with clear anchor box boundaries; in the context of low signal-to-noise ratio, the improved model effectively suppresses noise interference and no false detections occur.

[0034] Comparative Experiments and Analysis: To better demonstrate the superiority of the proposed method, this paper selects the typical two-stage object detection network Faster R-CNN and the one-stage object detection networks YOLOv3 and YOLOv4 for horizontal comparison with the improved model. The results are shown in the table below: Model P R mAP@0.5 Faster R-CNN 0.733 0.78 0.719 YOLOv3 0.911 0.914 0.929 YOLOv4 0.764 0.919 0.924 YOLOv5s 0.921 0.922 0.943 Ours 0.954 0.924 0.958 As shown in the table above, the improved YOLOv5s model performs better than other models. Compared with the base YOLOv5s model, the improved YOLOv5s model shows improvements in precision (P) and recall (R), and a 1.5 percentage point increase in mean AP, demonstrating that the improved YOLOv5s model has a significant effect on the detection of small target sonar images.

[0035] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for small target detection in sonar images based on YOLOv5s, characterized in that, The method includes: An improved target detection model based on the YOLOv5 basic model is constructed; the YOLOv5 basic model includes four parts: Input, Backbone, Neck, and Head. The improved target detection model replaces the nearest neighbor interpolation upsampling of the YOLOv5 base model with the CARAFE feature upsampling operator; it replaces the Neck part in the YOLOv5 base model with the Slimneck structure; and it adds the attention mechanism Acmix to the YOLOv5 base model. When performing target detection, the data to be detected is input into the improved target detection model, and the detection results are output through the improved target detection model.

2. The method for small target detection in sonar images based on YOLOv5s according to claim 1, characterized in that, The CARAFE feature upsampling operator is divided into two parts: a prediction module and a recombination module. The prediction module uses 11 Conv to compress the number of channels of the CHW-sized input feature map into CmHW, and generates a prediction module based on the compressed features. The upsampling kernel has a weight sum that remains 1 after normalization. During the recombination process, the module maps the output feature maps of each region back to their corresponding positions in the input feature maps, and then reassembles the feature maps. The region is multiplied by the sampling kernel, and the final output is... The feature map.

3. The method for small target detection in sonar images based on YOLOv5s according to claim 1, characterized in that, The feature recombination formula is expressed as follows: in, , This indicates the value of a pixel in the output feature map. This represents the weight of the content-aware kernel at offset (n, m). It is the pixel value or feature vector at a certain location on the input feature map. These are the input coordinates, where, It is a neighborhood offset. It is the half-width of the core.

4. The method for small target detection in sonar images based on YOLOv5s according to claim 1, characterized in that, The Slimneck structure consists of a GSConv module and a VoVGSCSP module, which are composed of a mixture of convolution and depthwise separable convolution. After the regular convolutions exchange the local feature information of each channel, they are replaced with the output of depthwise separable convolution to form the GSConv module. The VoVGSCSP module is constructed using a one-time aggregation method on the GSbottleneck built from the GSConv module.

5. The method for small target detection in sonar images based on YOLOv5s according to claim 1, characterized in that, The Acmix attention mechanism is an attention mechanism that combines convolution and self-attention. Its working mechanism mainly consists of two stages: In the first stage, three 11 convolutions are used to project and reconstruct the input features, resulting in 3N intermediate features of mapped features. The second stage is divided into a self-attention branch and a convolution branch. The self-attention branch is responsible for dividing the reconstructed intermediate features into N groups of three feature parts containing three 11 convolutions and mapping them as queries, keys, and values. The convolution branch generates the feature results through convolution operations. Finally, the results of the self-attention branch and the convolution branch are merged and processed to obtain the final feature results.

6. The method for small target detection in sonar images based on YOLOv5s according to claim 1, characterized in that, Before inputting the data to be detected into the improved target detection model, the data to be detected is preprocessed.

7. The method for small target detection in sonar images based on YOLOv5s according to claim 1, characterized in that, After constructing the improved target detection model, the improved target detection model is trained and validated.