Side-scan sonar target real-time detection method and system based on improved YOLOv8

By improving the YOLOv8 target detection method and combining the C2f feature extraction submodule and the focused linear attention submodule, the problem of inaccurate detection of small targets with weak echoes in traditional side-scan sonar under complex underwater backgrounds is solved, and higher detection accuracy and stability are achieved.

CN121921631APending Publication Date: 2026-04-24WUHAN UNIV OF TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
WUHAN UNIV OF TECH
Filing Date
2026-01-08
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Traditional side-scan sonar target detection methods are insufficient in their ability to detect small targets with weak echoes under complex underwater backgrounds and strong noise conditions, which can easily lead to missed or false detections.

Method used

An improved YOLOv8 object detection method is adopted, which constructs an object detection model by alternately stacking the C2f feature extraction submodule and the spatial channel decoupled downsampling submodule, combined with the focusing linear attention submodule and the spatial pyramid pooling layer, and optimizing the model parameters to improve detection accuracy and stability.

Benefits of technology

It effectively reduces the false negative and false positive rates, improves the ability to distinguish low-contrast, weak-echo targets, enhances adaptability to complex seabed backgrounds, reduces computational load and inference time, and improves the accuracy and stability of target detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121921631A_ABST
    Figure CN121921631A_ABST
Patent Text Reader

Abstract

The invention provides a side-scan sonar target real-time detection method and system based on improved YOLOv8, and relates to the technical field of underwater target detection, and the method comprises the steps: obtaining a side-scan sonar image data set, and carrying out the marking and dividing of the side-scan sonar image data set, so as to obtain a training set corresponding to the side-scan sonar image data set; constructing a target detection model, wherein the target detection model comprises a Backbone backbone network, a Neck feature fusion network and a lightweight detection head; inputting the training set into a target detection model for training, and optimizing model parameters of the target detection model through a bounding box regression loss function to obtain a sonar target detection model; and inputting a to-be-detected side-scan sonar image into the sonar target detection model to obtain a target category, bounding box coordinates and confidence corresponding to the to-be-detected side-scan sonar image. The accuracy and the stability of the target detection result can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of underwater target detection technology, and in particular to a real-time target detection method and system based on improved YOLOv8 side-scan sonar. Background Technology

[0002] Side-scan sonar, a key instrument for underwater detection, generates acoustic images of underwater targets by emitting sound waves and receiving echoes. However, side-scan sonar images are affected by the complex underwater environment, suffering from strong background interference, variable target scale, and significant noise, resulting in poor performance of traditional target detection methods.

[0003] Chinese patent CN117496341A discloses a side-scan sonar image target detection method based on multi-scale feature fusion, including the following steps: S1, collecting underwater side-scan sonar images containing targets, labeling targets such as human bodies, shipwrecks, and aircraft wreckage in the images, and establishing a side-scan sonar image annotation dataset; S2, constructing a multi-scale feature fusion detection model based on improved YOLOv4, and training the model; S3, acquiring the side-scan sonar image to be identified in real time, inputting it into the trained detection model, and obtaining the predicted bounding box and category information of the underwater target. However, the above scheme relies solely on multi-scale feature superposition for target detection, resulting in insufficient ability to detect small targets with weak echoes under complex underwater backgrounds and strong noise conditions, easily leading to missed detections or false detections. Therefore, it is essential to provide a real-time target detection method and system based on improved YOLOv8 for side-scan sonar to improve the accuracy and stability of target detection results. Summary of the Invention

[0004] In view of this, the present invention proposes a real-time target detection method and system based on improved YOLOv8 side-scan sonar.

[0005] This invention provides a real-time target detection method for side-scan sonar based on an improved YOLOv8, the method comprising: Acquire a side-scan sonar image dataset, and perform annotation and segmentation processing on the side-scan sonar image dataset to obtain the training set corresponding to the side-scan sonar image dataset; A target detection model is constructed, wherein the target detection model includes a backbone network, a Neck feature fusion network, and a lightweight detection head connected in sequence. The backbone network includes multiple C2f feature extraction sub-modules, multiple spatial channel decoupling downsampling sub-modules, a spatial pyramid pooling layer, and a focusing linear attention sub-module set between the spatial pyramid pooling layer and the C2f feature extraction sub-modules. The C2f feature extraction sub-modules and the spatial channel decoupling downsampling sub-modules are alternately set. The training set is input into the target detection model for training, and the model parameters of the target detection model are optimized by the bounding box regression loss function to obtain a sonar target detection model; The side-scan sonar image to be tested is input into the sonar target detection model to obtain the target category, bounding box coordinates, and confidence level corresponding to the side-scan sonar image to be tested.

[0006] Based on the above technical solutions, preferably, the step of acquiring the side-scan sonar image dataset, and performing annotation and segmentation processing on the side-scan sonar image dataset to obtain the training set corresponding to the side-scan sonar image dataset, specifically includes: Acquire the original side-scan sonar image, and use the LabelImg tool to annotate the targets in the original side-scan sonar image to generate an annotated side-scan sonar image containing the target category and the coordinates of the four vertices of the bounding box; The labeled side-scan sonar images are randomly divided into a training set and a test set. The training set is used to train the target detection model, and the test set is used to verify the performance of the target detection model.

[0007] Based on the above technical solutions, preferably, the Backbone network comprises, in sequence, a first convolutional layer, a first spatial channel decoupling downsampling submodule, a first C2f feature extraction submodule, a second spatial channel decoupling downsampling submodule, a second C2f feature extraction submodule, a third spatial channel decoupling downsampling submodule, a third C2f feature extraction submodule, a fourth spatial channel decoupling downsampling submodule, a focused linear attention submodule, and a spatial pyramid pooling layer, wherein... The first convolutional layer is used to receive the input side-scan sonar image and perform preliminary feature extraction on the side-scan sonar image through convolution operation to obtain a low-level feature map; The first spatial channel decoupling downsampling submodule is used to receive the low-level feature map and perform downsampling processing on the low-level feature map to obtain the first transition feature map; The first C2f feature extraction submodule is used to receive the first transition feature map and extract features from the first transition feature map through a multi-branch residual structure to obtain a first mid-level feature map containing target local structural information and primary semantic information. The second spatial channel decoupling downsampling submodule is used to receive the first middle layer feature map and further downsample the first middle layer feature map to obtain the second transition feature map; The second C2f feature extraction submodule is used to receive the second transition feature map and extract the middle and high-level semantic features of the second transition feature map through a multi-layer Bottleneck structure and a cross-layer feature fusion mechanism to obtain a second middle-layer feature map containing target shape information and discriminative semantic information. The third spatial channel decoupling downsampling submodule is used to receive the second middle layer feature map and further downsample the second middle layer feature map to obtain the third transition feature map; The third C2f feature extraction submodule is used to receive the third transition feature map and reorganize and fuse the deep features through a multi-branch structure to obtain a third mid-level feature map containing higher-level semantic information. The fourth spatial channel decoupling downsampling submodule is used to downsample the third middle layer feature map to obtain the fourth transition feature map. The focused linear attention submodule is used to receive the fourth transition feature map and, by constructing a local linear attention mechanism, re-weight the key regions related to the target in the third middle layer feature map to obtain an enhanced third middle layer feature map. The spatial pyramid pooling layer is used to receive the enhanced third middle layer feature map, and to fuse the features of the enhanced third middle layer feature map under different receptive fields through multi-scale pooling operations to obtain a high-level semantic feature map, and to use the high-level semantic feature map as the output feature map of the backbone network.

[0008] More preferably, the C2f feature extraction submodule includes, in sequence, an input feature splitting layer, a multi-branch residual feature extraction layer, a cross-level feature fusion layer, an attention enhancement layer, and a feature output layer, wherein, The input feature splitting layer is used to receive the input feature map and divide the input feature map into multiple sub-feature maps along the channel dimension after channel mapping through convolution operation; The multi-branch residual feature extraction layer includes multiple parallel feature extraction branches, each of which is used to extract spatial and semantic features from the corresponding sub-feature map. The cross-level feature fusion layer is used to splice and fuse the multi-path sub-feature maps output by the multi-branch residual feature extraction layer to generate a fused feature map, which is then used as the output feature map of the C2f feature extraction submodule.

[0009] More preferably, the input feature splitting layer uses 1×1 convolution to split the input feature map into four parallel feature branches. Three of these feature branches are designated as main branches, with the number of channels in the three main branches being 1 / 4, 1 / 4, and 1 / 2 of the number of input channels, respectively. The remaining feature branch is designated as a side branch, which retains 1 / 4 of the number of input channels and is used to preserve shallow original feature information.

[0010] More preferably, the lightweight detection head includes a separable convolutional layer, a group normalization layer, a second convolutional layer, a first two-dimensional convolutional layer, a first bounding box regression loss layer, a second two-dimensional convolutional layer, and a second bounding box regression loss layer, wherein, The separable convolutional layer is used to receive the feature map output by the Neck feature fusion network, and to extract features from the feature map by combining depthwise convolution and pointwise convolution to obtain a separable feature map. The group normalization layer is used to normalize the separated feature map; The second convolutional layer is used to receive the separated feature map after the group normalization layer, and further fuse and map the multidimensional features through standard convolution operations to obtain a standardized feature map; The first two-dimensional convolutional layer is used to receive the standardized feature map and perform two-dimensional convolution operation on the standardized feature map to generate a first predicted feature map and a first bounding box regression result; The first bounding box regression loss layer is used to compare and calculate the regression result of the first bounding box with the corresponding true bounding box, and to measure the prediction error through the bounding box regression loss function; The second two-dimensional convolutional layer is set in parallel with the first two-dimensional convolutional layer. The second two-dimensional convolutional layer is used to receive the standardized feature map and generate a second predicted feature map and a second bounding box regression result through two-dimensional convolution operation. The second bounding box regression loss is used to compare the second bounding box regression result with the corresponding true bounding box to constrain the bounding box regression accuracy of the lightweight detection head on different prediction branches.

[0011] More preferably, the expression for the bounding box regression loss function is:

[0012] in, This represents the bounding box regression loss function. Represents the Focal weighting coefficient. Represents the Focal index factor. This represents the intersection-union ratio (IoU) between the predicted bounding box and the ground truth bounding box. This represents the normalized Euclidean distance between the center points of the predicted bounding box and the ground truth bounding box. This indicates the predicted center point location of the bounding box. This indicates the location of the center point of the actual bounding box. c This represents the diagonal length of the minimum bounding rectangle between the predicted bounding box and the true bounding box. v This indicates the aspect ratio similarity term. α This represents the adjustment coefficient.

[0013] A second aspect of this application provides a real-time side-scan sonar target detection system based on an improved YOLOv8, the system comprising a data acquisition module, a model building module, and a target detection module, wherein... The data acquisition module is used to acquire a side-scan sonar image dataset, and to label and divide the side-scan sonar image dataset to obtain the training set corresponding to the side-scan sonar image dataset. The model building module is used to build an object detection model, wherein the object detection model includes a backbone network, a Neck feature fusion network, and a lightweight detection head connected in sequence. The backbone network includes multiple C2f feature extraction sub-modules, multiple spatial channel decoupling downsampling sub-modules, a spatial pyramid pooling layer, and a focusing linear attention sub-module set between the spatial pyramid pooling layer and the C2f feature extraction sub-modules. The C2f feature extraction sub-modules and the spatial channel decoupling downsampling sub-modules are alternately set. The training set is input into the object detection model for training, and the model parameters of the object detection model are optimized by the bounding box regression loss function to obtain a sonar object detection model. The target detection module is used to input the side-scan sonar image to be tested into the sonar target detection model to obtain the target category, bounding box coordinates and confidence level corresponding to the side-scan sonar image to be tested.

[0014] A third aspect of this application provides an electronic device including a processor, a memory, a user interface, and a network interface, wherein the memory is used to store instructions, the user interface and the network interface are used to communicate with other devices, and the processor is used to execute the instructions stored in the memory.

[0015] A fourth aspect of this application provides a non-transitory computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the steps of a side-scan sonar target real-time detection method based on an improved YOLOv8.

[0016] The side-scan sonar target real-time detection method and system based on improved YOLOv8 provided by this invention have the following advantages over the prior art: (1) By alternately stacking the C2f feature extraction submodule and the spatial channel decoupled downsampling submodule, the fine-grained spatial information and channel semantic information of the target are preserved as much as possible while downsampling, which alleviates the problem of small target information loss caused by traditional downsampling. The linear attention submodule is placed between the C2f module and the spatial pyramid pooling layer, so that the network can focus on the significant features related to the target in the complex seabed background, suppress noise and background clutter, improve the ability to distinguish low-contrast and weak echo targets, and the spatial pyramid pooling layer expands the effective receptive field and introduces multi-scale contextual information, which has better adaptability to complex terrain, texture changes and multiple target scales. At the same time, a lightweight detection head is used to reduce the number of parameters and computation while maintaining the multi-scale feature fusion capability, and reduce the model inference time. The model parameters are optimized for the bounding box regression loss function for the characteristics of sonar targets, so that the sonar target detection model pays more attention to the target boundary and shape information during the training process, reduces the position and scale deviation between the predicted box and the real box, effectively reduces the false detection rate, and thus improves the accuracy and stability of the target detection results.

[0017] (2) The multi-level spatial channel decoupling downsampling submodule is applied to the low-level / middle-level / high-level features in sequence, which is conducive to scale compression while maintaining resolution and structural information. The first, second and third C2f feature extraction submodules focus on local texture and primary semantics, target shape and discriminative semantics and higher-level abstract semantics respectively through multi-branch residual structure, multi-layer Bottleneck structure and cross-layer feature fusion mechanism, thereby realizing progressive feature expression from local structure, target shape and high-level semantics, effectively improving the ability to distinguish small targets, weak targets and targets with diverse shapes. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 A flowchart illustrating a real-time target detection method for side-scan sonar based on an improved YOLOv8, provided by this invention; Figure 2 This is a schematic diagram of the network structure of the sonar target detection model provided by the present invention; Figure 3 This is a schematic diagram of the structure of the linear attention submodule provided by the present invention; Figure 4A schematic diagram of the spatial channel decoupling downsampling submodule provided by the present invention; Figure 5 This is a schematic diagram of the lightweight detection head provided by the present invention; Figure 6 A schematic diagram of the structure of the side-scan sonar target real-time detection system provided by the present invention; Figure 7 This is a schematic diagram of the structure of the electronic device provided by the present invention.

[0020] Explanation of reference numerals in the attached figures: 1. Side-scan sonar target real-time detection system; 11. Data acquisition module; 12. Model building module; 13. Target detection module; 2. Electronic equipment; 21. Processor; 22. Communication bus; 23. User interface; 24. Network interface; 25. Memory. Detailed Implementation

[0021] The technical solutions of the present invention will be clearly and completely described below with reference to the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.

[0022] This invention discloses a real-time target detection method based on improved YOLOv8 side-scan sonar, with reference to... Figure 1 and Figure 2 The steps of this method include S1 to S4.

[0023] Step S1: Obtain the side-scan sonar image dataset, and perform annotation and segmentation processing on the side-scan sonar image dataset to obtain the training set corresponding to the side-scan sonar image dataset.

[0024] In this step, side-scan sonar images were collected through two channels: publicly available online resources and those provided by partner organizations. After rigorous screening, valid samples were obtained, totaling 560 valid side-scan sonar images, covering three types of targets: shipwrecks, aircraft wrecks, and drowning victims.

[0025] This step also includes steps S11 to S12.

[0026] Step S11: Obtain the original side-scan sonar image, and use the LabelImg tool to annotate the targets in the original side-scan sonar image to generate an annotated side-scan sonar image containing the target category and the coordinates of the four vertices of the bounding box.

[0027] In this step, the image pixel coordinate system is used as the reference: the top left corner of the image is the origin, the x-axis extends horizontally to the right along the image, and the y-axis extends vertically downward along the image. The coordinate values ​​are the row and column indices of the pixels. For example, the coordinate range of a 640×640 resolution image is x∈[0,639] and y∈[0,639].

[0028] The bounding box generated by the LabelImg tool has four vertex coordinates in the format (x1, y1), (x2, y2), (x3, y3), (x4, y4), corresponding to the top left, top right, bottom right, and bottom left corners of the bounding box. These need to be converted to the "center point + width and height" format commonly used in the YOLO series. The steps and formulas are as follows: First, calculate the minimum bounding rectangle of the bounding box: x min =min(x1,x2,x3,x4), y min =min(y1,y2,y3,y4); x max =max(x1,x2,x3,x4), y max =max(y1,y2,y3,y4).

[0029] Then convert it to normalized coordinates in YOLO format: The x-coordinate of the center point is represented as: x center = (x min +x max ) / 2W; The y-coordinate of the center point is represented as: y center =(y min +y max ) / 2H; The width of the bounding box is expressed as: w = (x max -x min ) / W; The bounding box height is represented as: h = (y max -y min ) / H; Where W is the image width and H is the image height.

[0030] Step S12: The labeled side-scan sonar images are randomly divided into a training set and a test set. The training set is used to train the target detection model, and the test set is used to verify the performance of the target detection model.

[0031] Step S2: Construct an object detection model, which includes a Backbone network, a Neck feature fusion network, and a lightweight detection head connected in sequence. The Backbone network includes multiple C2f feature extraction sub-modules, multiple spatial channel decoupling downsampling sub-modules, a spatial pyramid pooling layer, and a focusing linear attention sub-module set between the spatial pyramid pooling layer and the C2f feature extraction sub-modules. The C2f feature extraction sub-modules and the spatial channel decoupling downsampling sub-modules are set alternately.

[0032] The C2f feature extraction submodule comprises, in sequence, an input feature splitting layer, a multi-branch residual feature extraction layer, a cross-level feature fusion layer, an attention enhancement layer, and a feature output layer. The input feature splitting layer receives the input feature map and divides it into multiple sub-feature maps along the channel dimension after performing channel mapping through convolution operations. The input feature splitting layer uses 1×1 convolution to split the input feature map into four parallel feature branches. Three of these feature branches are designated as main branches, with the number of channels in the three main branches being 1 / 4, 1 / 4, and 1 / 2 of the number of input channels, respectively. The remaining feature branch is designated as a side branch, which retains 1 / 4 of the number of input channels and is used to preserve shallow original feature information.

[0033] The multi-branch residual feature extraction layer includes multiple parallel feature extraction branches, each of which is used to extract spatial and semantic features from the corresponding sub-feature map. The C2f feature extraction submodule references the ELAN architecture of YOLOv7, employing cross-level residual block connections. This means that the Bottleneck output of each sub-branch not only participates in subsequent calculations within its own branch but also merges with intermediate features from other sub-branches, enabling multi-path propagation of gradient information and preventing gradient vanishing. Furthermore, the multi-branch residual feature extraction layer expands the number of residual block layers to 6, dividing them into 3 sub-branches (each sub-branch containing 2 Bottlenecks). This multi-branch layered stacking achieves cross-level feature transfer.

[0034] The cross-level feature fusion layer is used to stitch and fuse the multi-path sub-feature maps output by the multi-branch residual feature extraction layer to generate a fused feature map, which is then used as the output feature map of the C2f feature extraction submodule.

[0035] The C2f feature extraction submodule divides the input feature map into two branches through 1×1 convolution. The main branch stacks multiple residual blocks to extract deep semantic features, while the side branch retains the original shallow features. Finally, intermediate features of different depths are fused through a hierarchical connection strategy. Compared with the traditional C3 structure, the number of parameters is reduced by about 18%, and the computation speed is improved by 22%.

[0036] like Figure 2 and Figure 3 As shown, the linear attention submodule is deployed at the feature output of the linear attention submodule to enhance the feature response of small targets. Figure 3 The diagram shows the structure of the focused linear attention submodule, which includes a feature projection layer, a local attention calculation layer, and a channel space collaborative enhancement layer.

[0037] In the feature projection layer, a 1×1 convolution kernel is used to project the feature map (dimension C×H×W) output by the C2f feature extraction submodule into a dimension-reduced form, with the output dimension being C' / 2×H×W (C'=C). The convolution kernel stride is 1, and the activation function is SiLU, which achieves feature dimension compression and preliminary information filtering.

[0038] In one example, the input feature map is reduced to C / 2×H×W (i.e., C′=C, and the number of output channels is C / 2) by a 1×1 convolution. The reduced feature map is then unfolded along the pixel dimension to construct the basic feature matrix for subsequent attention calculations. The C / 2-dimensional feature vectors corresponding to each pixel of the reduced feature map (number of channels C / 2, height H, width W) are concatenated in row-major order to obtain a two-dimensional feature matrix of shape N×(C / 2). This matrix is ​​the input feature carrier for the local attention calculation layer. Here, the dimension of the input feature map is C×H×W; the number of channels of the reduced feature map is C / 2, the height is H, and the width is W; N=H×W, where N represents the total number of pixels in the feature map.

[0039] In the local attention computation layer, attention weights are calculated based on 3×3 pixel local region constraints, and the attention weight matrix is ​​represented by the following formula. A :

[0040] Where Q represents the query matrix, the query matrix dimension is N×d, N=H×W represents the total number of pixels, and d represents the feature dimension. d It is directly equivalent to the number of channels after dimensionality reduction by 1×1 convolution, i.e., d=C / 2; The optimized bond matrix is ​​generated based on a local 3×3 region, and its dimension is d×N. The dimension of the key vector (value equal to) d This optimizes the computational complexity to linear O(N), avoiding the quadratic complexity of traditional self-attention.

[0041] Furthermore, the query matrix Q is directly derived from the dimensionality-reduced feature matrix, with a shape of N×d (N=H×W, d=C / 2); the key matrix... It is an optimization matrix generated based on 3×3 local region constraints, with a shape of d×N, where each column corresponds to the weighted combination of the 3×3 neighborhood features of a pixel in the feature map; the attention weight matrix A is the final output attention weight matrix, with a shape of N×N.

[0042] First, the dimensionality-reduced feature map is expanded into an N×d query matrix Q; for each pixel in the feature map, the feature vector within its 3×3 neighborhood is extracted, and a key matrix is ​​generated by weighted fusion. (Shape d×N); Calculate Q and transpose matrix The product of and yields an intermediate matrix of shape N×N; the intermediate matrix is ​​then divided by . The square root of, where, = d =C / 2, used to mitigate gradient explosion; perform softmax activation on the result of the previous step to obtain the final attention weight matrix A.

[0043] In the channel-space collaborative enhancement layer, a parallel dual-branch architecture is adopted. The channel branch dynamically adjusts the channel weights through 1×1 lightweight convolutions. The number of convolution kernels in the 1×1 lightweight convolutions is equal to C' / 2. The spatial branch enhances the geometric deformation modeling capability through 3×3 deformable convolutions. The two outputs are adaptively weighted and fused into the final feature map (dimensions C×H×W) to enhance the features of the target region and suppress background noise.

[0044] Furthermore, the adaptive weighted fusion of channel branches and spatial branches is achieved through three steps: feature alignment, weight generation, and weighted summation. The specific process is as follows: Feature alignment: The feature map output by the channel branch with a dimension of C / 2×H×W is kept in the same dimension as the feature map output by the spatial branch with a dimension of C / 2×H×W, since both paths are processed based on the dimension-reduced feature map; Weight generation: A lightweight weight generation submodule is introduced. The lightweight weight generation submodule consists of a 1×1 convolutional layer with a SiLU activation function. The concatenated features of the two outputs are input into this submodule, and the output is a weight matrix that perfectly matches the input dimension. The dimensions of both the concatenated features and the weight matrix are C×H×W. Weighted fusion: The channel branch output and spatial branch output are multiplied element-wise by the weight matrix, and then the two results are added element-wise to obtain a fused feature map with dimensions C×H×W.

[0045] The weights here are local weights jointly defined by channel and spatial location, not global scalars. Each element in the weight matrix corresponds to the feature weight of a specific spatial location (H×W dimension) plus a specific channel (C dimension) in the feature map. It can adaptively allocate weights for the feature response intensity of different regions and different channels in the side-scan sonar image. The weight coefficient ranges from 0.4 to 0.6 and is adaptively learned by the training process based on the data distribution. This achieves both the differentiation of feature importance in the channel dimension and the enhancement of regional features in the spatial dimension.

[0046] In one example, the backbone network comprises, in sequence, a first convolutional layer, a first spatial channel decoupling downsampling submodule, a first C2f feature extraction submodule, a second spatial channel decoupling downsampling submodule, a second C2f feature extraction submodule, a third spatial channel decoupling downsampling submodule, a third C2f feature extraction submodule, a fourth spatial channel decoupling downsampling submodule, a focused linear attention submodule, and a spatial pyramid pooling layer. The first convolutional layer is used to receive the input side-scan sonar image and perform preliminary feature extraction on the side-scan sonar image through convolution operation to obtain a low-level feature map; The first spatial channel decoupling downsampling submodule is used to receive the low-level feature map and perform downsampling processing on the low-level feature map to obtain the first transition feature map; The first C2f feature extraction submodule is used to receive the first transition feature map and extract features from the first transition feature map through a multi-branch residual structure to obtain a first mid-layer feature map containing target local structural information and primary semantic information. The second spatial channel decoupling downsampling submodule is used to receive the first intermediate layer feature map and further downsample the first intermediate layer feature map to obtain the second transition feature map; The second C2f feature extraction submodule is used to receive the second transition feature map and extract the middle and high-level semantic features of the second transition feature map through a multi-layer Bottleneck structure and a cross-layer feature fusion mechanism to obtain a second middle-layer feature map containing target shape information and discriminative semantic information. The third spatial channel decoupling downsampling submodule is used to receive the second middle layer feature map and further downsample the second middle layer feature map to obtain the third transition feature map; The third C2f feature extraction submodule is used to receive the third transition feature map and reorganize and fuse the deep features through a multi-branch structure to obtain the third mid-level feature map containing higher-level semantic information. The fourth spatial channel decoupling downsampling submodule is used to downsample the third middle layer feature map to obtain the fourth transition feature map. The linear attention submodule is used to receive the fourth transition feature map and, by constructing a local linear attention mechanism, reweights the key regions related to the target in the third intermediate feature map to obtain an enhanced third intermediate feature map. The spatial pyramid pooling layer is used to receive the enhanced third mid-layer feature map. Through multi-scale pooling operations, the features of the enhanced third mid-layer feature maps under different receptive fields are fused to obtain the high-level semantic feature map, and the high-level semantic feature map is used as the output feature map of the backbone network.

[0047] like Figure 4 As shown, the spatial channel decoupling downsampling submodule includes a channel modeling submodule, a spatial downsampling submodule, and a feature fusion submodule, wherein... The channel modeling submodule uses 1×1 convolution to model the channel information of the input feature map (dimension C×H×W), and the output feature map has a dimension of C'×H×W (C'=C / 2, downsampling factor s=2). The convolution kernel stride is 1, and the batch normalization (BatchNorm2d) parameters are set to momentum 0.9 and weight decay 0.0005 to achieve feature optimization of the channel dimension. The spatial downsampling submodule uses a 3×3 depthwise separable convolution to spatially downsample the output feature map of the channel modeling submodule. The convolution kernel stride is 2, and spatial convolution is performed independently on only a single channel. The output feature map dimension is C'×H' / 2×W' / 2 (H'=H, W'=W). The activation function is SiLU, which preserves the target detail features while reducing spatial resolution. The feature fusion submodule performs channel fusion on the output feature map of the spatial downsampling submodule through 1×1 pointwise convolution. The number of convolution kernels is equal to C', and the dimension of the output feature map is C'×H' / 2×W' / 2, which completes channel-space decoupled downsampling. Compared with traditional 3×3 convolution downsampling, the feature information loss rate is reduced by 15%-20%.

[0048] like Figure 2 As shown, the Neck feature fusion network constructs multi-layered feature interaction channels through a bidirectional feature fusion path, both top-down and bottom-up. High-level semantic features are fused with low-level high-resolution features through upsampling, while low-level detail features are fused with high-level semantic information through downsampling, effectively improving the feature representation capability of multi-scale targets. Shallow feature fusion uses 3×3 depthwise separable convolutions to reduce computational complexity, while deep feature fusion retains standard convolutions to ensure feature representation capability.

[0049] In this embodiment, the multi-level spatial channel decoupling downsampling submodule is applied sequentially to low-level, mid-level, and high-level features. Compared to ordinary convolutional downsampling, it better distinguishes spatial location information from channel semantic information, reduces detail loss during downsampling, and facilitates scale compression while maintaining resolution and structural information. The first, second, and third C2f feature extraction submodules focus on local texture and primary semantics, target shape and discriminative semantics, and higher-level abstract semantics, respectively, through multi-branch residual structures, multi-layer Bottleneck structures, and cross-layer feature fusion mechanisms. This achieves progressive feature representation from local structure, target shape, and high-level semantics, effectively improving the ability to distinguish small, weak, and morphologically diverse targets. The linear attention submodule constructs a local linear attention mechanism based on the fourth transition feature map, assigning higher weights to key regions related to the target, suppressing background and noise interference, improving the response intensity of the feature map to the target region in complex underwater backgrounds, and enhancing target saliency and feature utilization efficiency. The spatial pyramid pooling layer performs multi-scale pooling and fusion on the enhanced third-layer feature map, incorporating contextual information from different receptive fields. This approach considers the feature representation of targets of different sizes and distances, enhancing the network's robustness to scale changes and complex scenes, and yielding more semantically complete high-level semantic feature maps. In low-contrast, high-noise scenes such as side-scan sonar, it can effectively reduce false negative and false positive rates, improving detection accuracy, recall, and adaptability to complex backgrounds.

[0050] Please see Figure 5 The lightweight detection head includes a separable convolutional layer, a group normalization layer, a second convolutional layer, a first two-dimensional convolutional layer, a first bounding box regression loss layer, a second two-dimensional convolutional layer, and a second bounding box regression loss layer, wherein... Separable convolutional layers are used to receive feature maps output by the Neck feature fusion network, and feature extraction is performed on the feature maps by combining depthwise convolution and pointwise convolution to obtain separable feature maps; The group normalization layer is used to normalize the separated feature maps; The second convolutional layer is used to receive the separated feature map after the group normalization layer, and further fuse and map the multidimensional features through standard convolution operations to obtain a standardized feature map. The first two-dimensional convolutional layer is used to receive the standardized feature map and perform two-dimensional convolution operations on the standardized feature map to generate the first predicted feature map and the first bounding box regression result. The first bounding box regression loss layer is used to compare the regression result of the first bounding box with the corresponding true bounding box and to measure the prediction error through the bounding box regression loss function. The second two-dimensional convolutional layer is set in parallel with the first two-dimensional convolutional layer. The second two-dimensional convolutional layer is used to receive the standardized feature map and generate the second predicted feature map and the second bounding box regression result through two-dimensional convolution operation. The second bounding box regression loss is used to compare the second bounding box regression result with the corresponding true bounding box to constrain the bounding box regression accuracy of the lightweight detector head on different prediction branches.

[0051] In one example, the separable convolutional layer (PConv) decomposes the regular convolution operation into two parts: a 1×1 convolution and a depthwise convolution, as represented by the following formula:

[0052] Here, X represents the input feature map. The depthwise convolution operates independently on each channel, while the 1×1 convolution combines channel information, effectively reducing computational cost and parameter count. This indicates that a depthwise convolution operation is performed on the input feature map. This indicates that a 1×1 convolution operation is performed on the input feature map.

[0053] The group normalization layer (GN) divides the feature map into multiple groups for normalization, as expressed by the following formula:

[0054] in, and These are represented as the mean and variance within the current group, respectively. It represents a small constant that prevents division by zero errors. In small-batch training, it outperforms batch normalization and optimizes training stability.

[0055] A 1×1 convolutional layer is used to compress the number of feature channels, reduce the number of parameters and memory usage in subsequent calculations, and improve computational efficiency.

[0056] Furthermore, in Efficient_Detect, the number of groups G in the Group Normalization (GN) layer is proportional to the number of channels C of the input feature map: G = C ÷ 8, where the number of channels C must be an integer multiple of 8. If C is not an integer multiple of 8, the nearest integer multiple of 8 is rounded down before calculation. This ratio is designed based on a balance between lightweightness and feature representation, avoiding both excessive grouping leading to low feature dimensionality in each group (loss of semantic information) and insufficient grouping failing to leverage the stability advantage of GN in small-batch training. Simultaneously, it ensures that the dimension of each feature group is uniformly 8, stabilizing the normalization effect.

[0057] The number of channels C in feature maps of different scales varies, typically corresponding to the three scales output by the Neck feature fusion network, such as 80×80, 40×40, and 20×20. Therefore, the same number of groups will not be used; instead, it will be adaptively adjusted based on the above rules. If the number of channels in a feature map at a certain scale is C=128, then the number of groups is G=128÷8=16; If the number of channels C=256, then the number of groups is G=256÷8=32; If the number of channels C=512, then the number of groups is G=512÷8=64.

[0058] In this embodiment, separable convolutions are used instead of traditional convolutions, significantly reducing the computational load and parameter size of convolutions. This improves the inference speed of the detection head without significantly sacrificing feature extraction capabilities, facilitating real-time detection of side-scan sonar targets on embedded platforms or devices with limited computing power. Furthermore, a group normalization layer is used to normalize the separable feature maps, reducing the distribution differences of features across different channels and samples. This improves the training stability of the network in scenarios with small batches or fluctuating distributions, helping to accelerate convergence and reduce gradient oscillations. Simultaneously, the second convolutional layer further integrates multi-dimensional information based on the normalized features, mapping the lightweight features into a more discriminative standardized feature map, balancing lightweight design with expressive power. This provides a more compact and effective feature representation for subsequent bounding box regression and class prediction. The first and second two-dimensional convolutional layers operate in parallel, independently convolving the same standardized feature map to generate two predicted feature maps and two sets of bounding box regression results, equivalent to multi-view regression modeling of the same feature. The two bounding box regression loss layers constrain the predicted and ground truth boxes of their respective branches, ensuring that the detection head maintains high regression accuracy across different prediction branches, thereby improving the overall accuracy and stability of bounding box localization.

[0059] Step S3: Input the training set into the target detection model for training, and optimize the model parameters of the target detection model through the bounding box regression loss function to obtain the sonar target detection model.

[0060] The expression for the bounding box regression loss function is:

[0061] in, This represents the bounding box regression loss function. Represents the Focal weighting coefficient. Represents the Focal index factor. This represents the intersection-union ratio (IoU) between the predicted bounding box and the ground truth bounding box. This represents the normalized Euclidean distance between the center points of the predicted bounding box and the ground truth bounding box. This indicates the predicted center point location of the bounding box. This indicates the location of the center point of the actual bounding box. c This represents the diagonal length of the minimum bounding rectangle between the predicted bounding box and the true bounding box. v This indicates the aspect ratio similarity term.α This represents the adjustment coefficient. The bounding box regression loss function dynamically adjusts the gradient weights of difficult samples, guiding the model to prioritize optimizing the discriminative features of key samples and improving the localization accuracy of low-quality samples.

[0062] Step S4: Input the side-scan sonar image to be tested into the sonar target detection model to obtain the target category, bounding box coordinates and confidence level corresponding to the side-scan sonar image to be tested.

[0063] In this embodiment, the C2f feature extraction submodule and the spatial channel decoupled downsampling submodule are stacked alternately. While downsampling, fine-grained spatial information and channel semantic information of the target are preserved as much as possible, which alleviates the problem of small target information loss that is easily caused by traditional downsampling. The linear attention submodule is placed between the C2f module and the spatial pyramid pooling layer, which enables the network to focus on the salient features related to the target in complex seabed backgrounds, suppress noise and background clutter, and improve the ability to distinguish low-contrast and weak echo targets. Furthermore, the spatial pyramid pooling layer expands the effective receptive field and introduces multi-scale contextual information, which has better adaptability to complex terrain, texture changes and multiple target scales. At the same time, a lightweight detection head is used to reduce the number of parameters and computation while maintaining the ability to fuse multi-scale features, thereby reducing the model inference time. The model parameters are optimized based on the bounding box regression loss function for sonar target characteristics, so that the sonar target detection model pays more attention to the target boundary and shape information during training, reduces the position and scale deviation between the predicted box and the ground truth box, effectively reduces the false negative and false positive rates, and thus improves the accuracy and stability of the target detection results.

[0064] Based on the above method, this application discloses a side-scan sonar target real-time detection system based on an improved YOLOv8, with reference to... Figure 6 The side-scan sonar target real-time detection system 1 includes a data acquisition module 11, a model building module 12, and a target detection module 13, wherein... The data acquisition module 11 is used to acquire the side-scan sonar image dataset, and to perform annotation and segmentation processing on the side-scan sonar image dataset to obtain the training set corresponding to the side-scan sonar image dataset. The model building module 12 is used to build an object detection model, which includes a backbone network, a Neck feature fusion network, and a lightweight detection head connected in sequence. The backbone network includes multiple C2f feature extraction sub-modules, multiple spatial channel decoupling downsampling sub-modules, a spatial pyramid pooling layer, and a focusing linear attention sub-module set between the spatial pyramid pooling layer and the C2f feature extraction sub-modules. The C2f feature extraction sub-modules and the spatial channel decoupling downsampling sub-modules are set alternately. The training set is input into the object detection model for training, and the model parameters of the object detection model are optimized by the bounding box regression loss function to obtain the sonar object detection model. The target detection module 13 is used to input the side-scan sonar image to be tested into the sonar target detection model to obtain the target category, bounding box coordinates and confidence level corresponding to the side-scan sonar image to be tested.

[0065] In one example, the data acquisition module 11 is used to acquire the original side-scan sonar image, and to annotate the targets in the original side-scan sonar image using the LabelImg tool to generate an annotated side-scan sonar image containing the target category and the coordinates of the four vertices of the bounding box. The annotated side-scan sonar image is randomly divided into a training set and a test set. The training set is used to train the target detection model, and the test set is used to verify the performance of the target detection model.

[0066] In one example, the backbone network comprises, in sequence, a first convolutional layer, a first spatial channel decoupling downsampling submodule, a first C2f feature extraction submodule, a second spatial channel decoupling downsampling submodule, a second C2f feature extraction submodule, a third spatial channel decoupling downsampling submodule, a third C2f feature extraction submodule, a fourth spatial channel decoupling downsampling submodule, a focused linear attention submodule, and a spatial pyramid pooling layer. The first convolutional layer is used to receive the input side-scan sonar image and perform preliminary feature extraction on the side-scan sonar image through convolution operation to obtain a low-level feature map; The first spatial channel decoupling downsampling submodule is used to receive the low-level feature map and perform downsampling processing on the low-level feature map to obtain the first transition feature map; The first C2f feature extraction submodule is used to receive the first transition feature map and extract features from the first transition feature map through a multi-branch residual structure to obtain a first mid-layer feature map containing target local structural information and primary semantic information. The second spatial channel decoupling downsampling submodule is used to receive the first intermediate layer feature map and further downsample the first intermediate layer feature map to obtain the second transition feature map; The second C2f feature extraction submodule is used to receive the second transition feature map and extract the middle and high-level semantic features of the second transition feature map through a multi-layer Bottleneck structure and a cross-layer feature fusion mechanism to obtain a second middle-layer feature map containing target shape information and discriminative semantic information. The third spatial channel decoupling downsampling submodule is used to receive the second middle layer feature map and further downsample the second middle layer feature map to obtain the third transition feature map; The third C2f feature extraction submodule is used to receive the third transition feature map and reorganize and fuse the deep features through a multi-branch structure to obtain the third mid-level feature map containing higher-level semantic information. The fourth spatial channel decoupling downsampling submodule is used to downsample the third middle layer feature map to obtain the fourth transition feature map. The linear attention submodule is used to receive the fourth transition feature map and, by constructing a local linear attention mechanism, reweights the key regions related to the target in the third intermediate feature map to obtain an enhanced third intermediate feature map. The spatial pyramid pooling layer is used to receive the enhanced third mid-layer feature map. Through multi-scale pooling operations, the features of the enhanced third mid-layer feature maps under different receptive fields are fused to obtain the high-level semantic feature map, and the high-level semantic feature map is used as the output feature map of the backbone network.

[0067] In one example, the C2f feature extraction submodule includes, in sequence, an input feature splitting layer, a multi-branch residual feature extraction layer, a cross-level feature fusion layer, an attention enhancement layer, and a feature output layer, wherein, The input feature splitting layer receives the input feature map and divides it into multiple sub-feature maps along the channel dimension after performing channel mapping through convolution operations. The multi-branch residual feature extraction layer includes multiple parallel feature extraction branches, each of which is used to extract spatial and semantic features from the corresponding sub-feature map. The cross-level feature fusion layer is used to stitch and fuse the multi-path sub-feature maps output by the multi-branch residual feature extraction layer to generate a fused feature map, which is then used as the output feature map of the C2f feature extraction submodule.

[0068] In one example, the input feature splitting layer uses a 1×1 convolution to split the input feature map into four parallel feature branches. Three of these feature branches are designated as main branches, with the number of channels in the three main branches being 1 / 4, 1 / 4, and 1 / 2 of the number of input channels, respectively. The remaining feature branch is designated as a side branch, which retains 1 / 4 of the number of input channels and is used to preserve shallow, original feature information.

[0069] In one example, the lightweight detection head includes a separable convolutional layer, a group normalization layer, a second convolutional layer, a first two-dimensional convolutional layer, a first bounding box regression loss layer, a second two-dimensional convolutional layer, and a second bounding box regression loss layer, wherein... Separable convolutional layers are used to receive feature maps output by the Neck feature fusion network, and feature extraction is performed on the feature maps by combining depthwise convolution and pointwise convolution to obtain separable feature maps; The group normalization layer is used to normalize the separated feature maps; The second convolutional layer is used to receive the separated feature map after the group normalization layer, and further fuse and map the multidimensional features through standard convolution operations to obtain a standardized feature map. The first two-dimensional convolutional layer is used to receive the standardized feature map and perform two-dimensional convolution operations on the standardized feature map to generate the first predicted feature map and the first bounding box regression result. The first bounding box regression loss layer is used to compare the regression result of the first bounding box with the corresponding true bounding box and to measure the prediction error through the bounding box regression loss function. The second two-dimensional convolutional layer is set in parallel with the first two-dimensional convolutional layer. The second two-dimensional convolutional layer is used to receive the standardized feature map and generate the second predicted feature map and the second bounding box regression result through two-dimensional convolution operation. The second bounding box regression loss is used to compare the second bounding box regression result with the corresponding true bounding box to constrain the bounding box regression accuracy of the lightweight detector head on different prediction branches.

[0070] In one example, the expression for the bounding box regression loss function is:

[0071] in, This represents the bounding box regression loss function. Represents the Focal weighting coefficient. Represents the Focal index factor. This represents the intersection-union ratio (IoU) between the predicted bounding box and the ground truth bounding box. This represents the normalized Euclidean distance between the center points of the predicted bounding box and the ground truth bounding box. This indicates the predicted center point location of the bounding box. This indicates the location of the center point of the actual bounding box. c This represents the diagonal length of the minimum bounding rectangle between the predicted bounding box and the true bounding box. v This indicates the aspect ratio similarity term. α This represents the adjustment coefficient.

[0072] Please see Figure 7This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 7 As shown, the electronic device 2 may include: at least one processor 21, at least one network interface 24, user interface 23, memory 25, and at least one communication bus 22.

[0073] The communication bus 22 is used to enable communication between these components.

[0074] The user interface 23 may include a display screen and a camera. Optionally, the user interface 23 may also include a standard wired interface and a wireless interface.

[0075] The network interface 24 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

[0076] The processor 21 may include one or more processing cores. The processor 21 connects to various parts of the server using various interfaces and lines, and performs various server functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 25, and by calling data stored in the memory 25. Optionally, the processor 21 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 21 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also be implemented as a separate chip without being integrated into the processor 21.

[0077] The memory 25 may include random access memory (RAM) or read-only memory. Optionally, the memory 25 may include non-transitory computer-readable storage medium. The memory 25 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 25 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 25 may also be at least one storage device located remotely from the aforementioned processor 21. Figure 7 As shown, the memory 25, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an application program for a real-time side-scan sonar target detection method based on an improved YOLOv8.

[0078] exist Figure 7 In the electronic device 2 shown, the user interface 23 is mainly used to provide an input interface for the user and to obtain the user input data; while the processor 21 can be used to call an application program stored in the memory 25 that is a side-scan sonar target real-time detection method based on improved YOLOv8. When executed by one or more processors, the electronic device performs one or more methods as described in the above embodiments.

[0079] A non-transitory computer-readable storage medium stores instructions that, when executed by one or more processors, cause a computer to perform one or more methods as described in the above embodiments.

[0080] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0081] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0082] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the shown or discussed mutual couplings or direct couplings or communication connections may be through some service interfaces; indirect couplings or communication connections between apparatuses or units may be electrical or other forms.

[0083] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0084] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0085] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, portable hard drives, magnetic disks, or optical disks.

[0086] 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, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A real-time target detection method based on improved YOLOv8 side-scan sonar, characterized in that, The method includes: Acquire a side-scan sonar image dataset, and perform annotation and segmentation processing on the side-scan sonar image dataset to obtain the training set corresponding to the side-scan sonar image dataset; A target detection model is constructed, wherein the target detection model includes a backbone network, a Neck feature fusion network, and a lightweight detection head connected in sequence. The backbone network includes multiple C2f feature extraction sub-modules, multiple spatial channel decoupling downsampling sub-modules, a spatial pyramid pooling layer, and a focusing linear attention sub-module set between the spatial pyramid pooling layer and the C2f feature extraction sub-modules. The C2f feature extraction sub-modules and the spatial channel decoupling downsampling sub-modules are alternately set. The training set is input into the target detection model for training, and the model parameters of the target detection model are optimized by the bounding box regression loss function to obtain a sonar target detection model. The side-scan sonar image to be tested is input into the sonar target detection model to obtain the target category, bounding box coordinates, and confidence level corresponding to the side-scan sonar image to be tested.

2. The method for real-time target detection using side-scan sonar based on improved YOLOv8 as described in claim 1, characterized in that, The process of acquiring the side-scan sonar image dataset, and labeling and segmenting the side-scan sonar image dataset to obtain the corresponding training set, specifically includes: Acquire the original side-scan sonar image, and use the LabelImg tool to annotate the targets in the original side-scan sonar image to generate an annotated side-scan sonar image containing the target category and the coordinates of the four vertices of the bounding box; The labeled side-scan sonar images are randomly divided into a training set and a test set. The training set is used to train the target detection model, and the test set is used to verify the performance of the target detection model.

3. The method for real-time target detection using side-scan sonar based on improved YOLOv8 as described in claim 1, characterized in that, The backbone network comprises, in sequence, a first convolutional layer, a first spatial channel decoupling downsampling submodule, a first C2f feature extraction submodule, a second spatial channel decoupling downsampling submodule, a second C2f feature extraction submodule, a third spatial channel decoupling downsampling submodule, a third C2f feature extraction submodule, a fourth spatial channel decoupling downsampling submodule, a focused linear attention submodule, and a spatial pyramid pooling layer. The first convolutional layer is used to receive the input side-scan sonar image and perform preliminary feature extraction on the side-scan sonar image through convolution operation to obtain a low-level feature map; The first spatial channel decoupling downsampling submodule is used to receive the low-level feature map and perform downsampling processing on the low-level feature map to obtain the first transition feature map; The first C2f feature extraction submodule is used to receive the first transition feature map and extract features from the first transition feature map through a multi-branch residual structure to obtain a first mid-level feature map containing target local structural information and primary semantic information. The second spatial channel decoupling downsampling submodule is used to receive the first middle layer feature map and further downsample the first middle layer feature map to obtain the second transition feature map; The second C2f feature extraction submodule is used to receive the second transition feature map and extract the middle and high-level semantic features of the second transition feature map through a multi-layer Bottleneck structure and a cross-layer feature fusion mechanism to obtain a second middle-layer feature map containing target shape information and discriminative semantic information. The third spatial channel decoupling downsampling submodule is used to receive the second middle layer feature map and further downsample the second middle layer feature map to obtain the third transition feature map; The third C2f feature extraction submodule is used to receive the third transition feature map and reorganize and fuse the deep features through a multi-branch structure to obtain a third mid-level feature map containing higher-level semantic information. The fourth spatial channel decoupling downsampling submodule is used to downsample the third middle layer feature map to obtain the fourth transition feature map. The focused linear attention submodule is used to receive the fourth transition feature map and, by constructing a local linear attention mechanism, re-weight the key regions related to the target in the third middle layer feature map to obtain an enhanced third middle layer feature map. The spatial pyramid pooling layer is used to receive the enhanced third middle layer feature map, and to fuse the features of the enhanced third middle layer feature map under different receptive fields through multi-scale pooling operations to obtain a high-level semantic feature map, and to use the high-level semantic feature map as the output feature map of the backbone network.

4. The method for real-time target detection using side-scan sonar based on improved YOLOv8 as described in claim 1, characterized in that, The C2f feature extraction submodule includes, in sequence, an input feature splitting layer, a multi-branch residual feature extraction layer, a cross-level feature fusion layer, an attention enhancement layer, and a feature output layer. The input feature splitting layer is used to receive the input feature map and divide the input feature map into multiple sub-feature maps along the channel dimension after channel mapping through convolution operation; The multi-branch residual feature extraction layer includes multiple parallel feature extraction branches, each of which is used to extract spatial and semantic features from the corresponding sub-feature map. The cross-level feature fusion layer is used to splice and fuse the multi-path sub-feature maps output by the multi-branch residual feature extraction layer to generate a fused feature map, which is then used as the output feature map of the C2f feature extraction submodule.

5. The method for real-time target detection using side-scan sonar based on improved YOLOv8 as described in claim 4, characterized in that, The input feature splitting layer uses 1×1 convolution to split the input feature map into four parallel feature branches. Three of these feature branches are designated as main branches, with the number of channels in each main branch being 1 / 4, 1 / 4, and 1 / 2 of the number of input channels, respectively. The remaining feature branch is designated as a side branch, which retains 1 / 4 of the number of input channels and is used to preserve shallow, original feature information.

6. The method for real-time target detection using side-scan sonar based on improved YOLOv8 as described in claim 1, characterized in that, The lightweight detection head includes a separable convolutional layer, a group normalization layer, a second convolutional layer, a first two-dimensional convolutional layer, a first bounding box regression loss layer, a second two-dimensional convolutional layer, and a second bounding box regression loss layer, wherein... The separable convolutional layer is used to receive the feature map output by the Neck feature fusion network, and to extract features from the feature map by combining depthwise convolution and pointwise convolution to obtain a separable feature map. The group normalization layer is used to normalize the separated feature map; The second convolutional layer is used to receive the separated feature map after the group normalization layer, and further fuse and map the multidimensional features through standard convolution operations to obtain a standardized feature map; The first two-dimensional convolutional layer is used to receive the standardized feature map and perform two-dimensional convolution operation on the standardized feature map to generate a first predicted feature map and a first bounding box regression result; The first bounding box regression loss layer is used to compare and calculate the regression result of the first bounding box with the corresponding true bounding box, and to measure the prediction error through the bounding box regression loss function; The second two-dimensional convolutional layer is set in parallel with the first two-dimensional convolutional layer. The second two-dimensional convolutional layer is used to receive the standardized feature map and generate a second predicted feature map and a second bounding box regression result through two-dimensional convolution operation. The second bounding box regression loss is used to compare the second bounding box regression result with the corresponding true bounding box to constrain the bounding box regression accuracy of the lightweight detection head on different prediction branches.

7. The method for real-time target detection using side-scan sonar based on improved YOLOv8 as described in claim 1, characterized in that, The expression for the bounding box regression loss function is: in, This represents the bounding box regression loss function. Represents the Focal weighting coefficient. Represents the Focal index factor. This represents the intersection-union ratio (IoU) between the predicted bounding box and the ground truth bounding box. This represents the normalized Euclidean distance between the center points of the predicted bounding box and the ground truth bounding box. This indicates the predicted center point location of the bounding box. This indicates the location of the center point of the actual bounding box. c This represents the diagonal length of the minimum bounding rectangle between the predicted bounding box and the true bounding box. v This indicates the aspect ratio similarity term. α This represents the adjustment coefficient.

8. A real-time target detection system based on improved YOLOv8 side-scan sonar, characterized in that, The side-scan sonar target real-time detection system (1) includes a data acquisition module (11), a model building module (12), and a target detection module (13), wherein, The data acquisition module (11) is used to acquire the side-scan sonar image dataset, and to perform annotation and division processing on the side-scan sonar image dataset to obtain the training set corresponding to the side-scan sonar image dataset. The model building module (12) is used to build an object detection model, wherein the object detection model includes a Backbone network, a Neck feature fusion network and a lightweight detection head connected in sequence. The Backbone network includes multiple C2f feature extraction sub-modules, multiple spatial channel decoupling downsampling sub-modules, a spatial pyramid pooling layer and a focusing linear attention sub-module set between the spatial pyramid pooling layer and the C2f feature extraction sub-modules. The C2f feature extraction sub-modules and the spatial channel decoupling downsampling sub-modules are set alternately. The training set is input into the object detection model for training, and the model parameters of the object detection model are optimized by the bounding box regression loss function to obtain a sonar object detection model. The target detection module (13) is used to input the side-scan sonar image to be tested into the sonar target detection model to obtain the target category, bounding box coordinates and confidence level corresponding to the side-scan sonar image to be tested.

9. An electronic device, characterized in that, The device includes a processor (21), a memory (25), a user interface (23), and a network interface (24), wherein the memory (25) is used to store instructions, the user interface (23) and the network interface (24) are used to communicate with other devices, and the processor (21) is used to execute the instructions stored in the memory (25) to cause the electronic device (2) to perform the method as described in any one of claims 1-7.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Side-scan sonar image target detection method based on multi-scale feature fusion

    CN117496341A

Cited By

  • Lightweight detection method, device and equipment for unmanned aerial vehicle photoelectric small target and medium

    CN122265896A