A sonar target detection method and device for complex marine environment
By combining the C3k2_SFD, MSDA, and C2DYT modules, the accuracy and adaptability issues of sonar target detection in complex marine environments were resolved, achieving more accurate and stable target detection.
Patent Information
- Application Number
- CN202511427116.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-30
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2045-09-30
AI Technical Summary
Existing sonar target detection methods face problems such as sparse texture, blurred edges, drastic changes in target shape, large scale span, and strong echo interference in complex marine environments, resulting in insufficient detection accuracy and adaptability.
The C3k2_SFD module constructs global and local attention branches through frequency weight decomposition and spatial modulation, the MSDA module modulates features through multi-scale dynamic attention, and the C2DYT module improves feature extraction and detection capabilities through dynamic activation layer compression and affine adjustment.
It enhances the ability to distinguish between target and background frequency differences in complex marine environments, improves the detection capability of targets of different scales and attitudes, suppresses strong echo noise interference, and improves detection accuracy and robustness.
Smart Images

Figure CN120891503B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of sonar target detection, and in particular to a sonar target detection method and device for complex marine environments. BACKGROUND
[0002] Sonar target detection is a key technology for improving the intelligent level of underwater detection. Because the sonar system on which it relies has a long propagation distance in water and strong anti-interference ability, it can still work stably in complex underwater environments such as turbid water or darkness, and has an irreplaceable role in underwater rescue, environmental perception, marine resource exploration, and the like, and can provide important support for positioning, identification, and parameter extraction of underwater targets. Therefore, it is of great theoretical and practical significance to carry out research on sonar target detection.
[0003] At present, sonar target detection methods have developed from traditional techniques to deep learning. In the early stage, feature engineering designed by artificial means, such as traditional image processing algorithms such as SIFT and HOG, combined with machine learning methods such as support vector machines and Bayesian classifiers, were relied on. With the development of deep learning, various new methods have emerged, including two-stage detection strategies based on Faster R-CNN, end-to-end one-stage detection based on YOLO series models, detection models based on Vision Transformer architecture, and detectors based on the RT-DETR framework, among others. Among them, the YOLO series model has become a research hotspot in the sonar scene due to its real-time advantage, and various ways such as feature sparsification and combination with multi-scale attention mechanisms have been used to improve it. However, current detection methods still face many challenges: sonar images have problems such as sparse texture and blurred edges, which limit the extraction of key features by convolutional neural networks; the target morphology changes dramatically and the scale span is large, requiring higher multi-scale modeling capabilities of the model; attention bias caused by strong echoes can interfere with the model learning process; at the same time, sonar systems are often deployed on resource-constrained platforms, and a balance needs to be struck between detection accuracy and lightweight.
[0004] Therefore, there is an urgent need for a method to improve the accuracy and adaptability of sonar target detection in complex marine environments. SUMMARY
[0005] In view of this, the present application provides a sonar target detection method and device for complex marine environments to improve the accuracy and adaptability of sonar target detection in complex marine environments.
[0006] Specifically, the present application is implemented by the following technical solutions:
[0007] The first aspect of the present application provides a sonar target detection method for complex marine environments, which comprises:
[0008] constructing a sonar image dataset;
[0009] training the detection model by using the sonar image dataset to obtain a trained detection model;
[0010] The detection model comprises a C3k2_SFD module, an MSDA module and a C2DYT module. The C3k2_SFD module maps the convolution kernel weight to the frequency domain through frequency weight decomposition, divides the frequency set according to the frequency module length, maps each frequency set back to the spatial domain, and reorganizes the convolution weight. Based on the convolution weight, a global attention branch and a first local branch are constructed through spatial modulation, and a dynamic convolution weight after modulation is generated by fusion. Based on the dynamic convolution weight, a frequency spectrum representation is obtained through frequency band modulation, the frequency spectrum subband is divided by using a preset frequency band mask, and the spatial attention map generated by the input feature map is used to adjust the frequency band response of different positions and fuse all subband features.
[0011] The MSDA module splits the input feature into a first feature and a second feature after normalization and channel expansion, extracts the spatial attention feature of the first feature through deep convolution of different directions and sizes, modulates and fuses the convolution features of multiple receptive fields, and multiplies the fused feature and the second feature element by element.
[0012] The C2DYT module performs nonlinear compression on the feature through a first dynamic activation layer at the input end of the attention path, and performs dynamic range compression and channel-level affine adjustment on the feature through a second dynamic activation layer before feedforward convolution.
[0013] The sonar image to be detected is input into the trained detection model, and a target detection result is output.
[0014] The second aspect of the present application provides a sonar target detection device for complex marine environments, which comprises a construction module, a training module and an output module.
[0015] The construction module is configured to construct a sonar image dataset.
[0016] The training module is configured to train a detection model by using the sonar image dataset to obtain a trained detection model.
[0017] The detection model comprises a C3k2_SFD module, an MSDA module and a C2DYT module; the C3k2_SFD module maps the convolution kernel weight to the frequency domain through frequency weight decomposition, divides the frequency set according to the frequency mode length, maps each frequency set back to the spatial domain, and reorganizes the convolution weight; based on the convolution weight, a global attention branch and a local branch are constructed through spatial modulation, and a dynamic convolution weight after modulation is generated through fusion; based on the dynamic convolution weight, a frequency spectrum representation is obtained through band modulation, the frequency spectrum subband is divided by using a preset band mask, the band response of different positions is adjusted by using a spatial attention map generated by the input feature map, and all subband features are fused;
[0018] The MSDA module splits the normalized and channel-extended input feature to obtain a first feature and a second feature, extracts spatial attention features of the first feature through deep convolution of different directions and sizes, modulates and fuses the convolution features of multiple receptive fields, and elementwisely multiplies the fused features and the second feature;
[0019] The C2DYT module nonlinearly compresses the features through a first dynamic activation layer at the input end of the attention path, and dynamically ranges and compresses the features and adjusts the channel level affine through a second dynamic activation layer before feedforward convolution;
[0020] The output module is configured to input the sonar image to be detected into the trained detection model and output a target detection result.
[0021] The sonar target detection method and apparatus provided in this application for complex marine environments utilize the C3k2_SFD module. This module maps convolutional kernel weights to the frequency domain through frequency weight decomposition, divides the data into sets according to frequency modulus, and reassembles them into convolutional weights. It then combines spatial modulation to construct a global attention branch and a first local branch to generate dynamic convolutional weights. Further adjustments to sub-band features via frequency band modulation and spatial attention maps enable more accurate capture of features from different frequency components in sonar images, enhancing the ability to distinguish between target and background frequency differences in complex marine environments and improving the targeting of feature extraction. MSDA The module normalizes and expands the input features before splitting them. It extracts spatial attention features through depthwise convolutions of different directions and sizes and fuses multiple receptive field features. Then, it multiplies these features with another feature, which can effectively capture target features of different scales and directions. This enhances the adaptability of the detection model to changes in target morphology in sonar images and improves the detection capability for targets of different sizes and postures. The C2DYT module uses a first dynamic activation layer to nonlinearly compress and control extreme echo features, and a second dynamic activation layer to perform dynamic range compression and channel-level affine adjustment. Finally, combined with residual connections, it can suppress extreme noise interference, optimize feature distribution, and balance channel importance. This reduces the impact of strong echoes and other noise on detection in complex marine environments. The three working together make the detection model more accurate and stable in detecting sonar targets in complex marine environments, effectively improving the accuracy and robustness of target detection. Attached Figure Description
[0022] Figure 1 A flowchart of a sonar target detection method for complex marine environments provided in Embodiment 1 of this application;
[0023] Figure 2 This is a schematic diagram of the structure of the detection model provided in this application;
[0024] Figure 3 This is a schematic diagram of the structure of the C3k2_SFD module provided in this application;
[0025] Figure 4 This is a schematic diagram of the MSDA module provided in this application;
[0026] Figure 5 This is a schematic diagram of the structure of the C2DYT module provided in this application;
[0027] Figure 6 This is a schematic diagram of the structure of the sonar target detection device for complex marine environments provided in Embodiment 2 of this application. Detailed Implementation
[0028] The exemplary embodiments will be described in detail herein with reference to several drawings. Descriptions of well-known functions and structures are omitted so as not to obscure the concept of the exemplary embodiments of the present application.
[0029] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the present application. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and / or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0030] It is to be understood that the singular forms "a", "an", and "the" include plural referents unless the context clearly dictates otherwise. It will be further understood that the terms "comprises" and / or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0031] The following specific embodiments are given to introduce the technical solutions of the present application in detail.
[0032] Figure 1 The flow chart of the sonar target detection method for complex marine environment provided by Embodiment One of the present application is shown in FIG. 1. Please refer to Figure 1 The method provided by the present embodiment can include:
[0033] S101, constructing a sonar image dataset.
[0034] Specifically, the sonar image is a two-dimensional gray image generated by the sonar system after receiving the echo signals of underwater targets and environment, and then converted by digital signal processing and image reconstruction algorithm. The sonar image reflects the echo intensity distribution of underwater targets and environment, contains rich information such as the spatial structure and contour of the target, and is the direct processing object of the sonar target detection. The sonar image dataset is a collection containing a large number of sonar images constructed for training and evaluating the detection model. It usually covers various complex scenes and interference factors in real marine environment, contains multiple underwater targets such as spheres, cubes, underwater robots, and is preprocessed (such as image resolution adjustment, target annotation, etc.), and is divided into training set, validation set and test set, which are used to support the training, validation and performance evaluation of the detection model.
[0035] In a specific implementation, the constructing the sonar image dataset comprises: collecting sonar images in a real marine environment; the sonar images cover various scenes, interference factors and underwater targets; pre-processing the collected sonar images; dividing the pre-processed sonar images into a training set, a validation set and a test set according to a preset ratio to obtain the sonar image dataset.
[0036] Specifically, echo data is collected in an actual marine scene by a sonar device, and is converted into sonar images after processing. The collected sonar images cover different marine scenes (such as shallow sea, deep sea, near shore, far sea, etc.), contain various interference factors (such as water flow interference, noise interference, sea bottom clutter, etc.), and various typical underwater targets (such as spheres, cubes, underwater robots, tires, metal barrels, etc.). Further, the resolution of the collected sonar images is adjusted, and the image size is unified to adapt to subsequent model training. At the same time, the targets in the sonar images are labeled using a professional labeling tool to clearly indicate the position, category and other information of the targets. The pre-processed sonar images are divided into a training set, a validation set and a test set according to a preset ratio: for example, the ratio is 7:2:1 or 8:1:1, wherein the training set is used for parameter learning of the detection model, the validation set is used for evaluation of the performance of the detection model during the training process and adjustment of hyperparameters, and the test set is used for final evaluation of the generalization ability of the detection model. After the division is completed, the sonar image dataset is obtained.
[0037] S102, training the detection model using the sonar image dataset to obtain a trained detection model.
[0038] The detection model comprises a C3k2_SFD module, an MSDA module and a C2DYT module. The C3k2_SFD module maps the convolution kernel weight to the frequency domain through frequency weight decomposition, divides the frequency set according to the frequency module length, maps each frequency set back to the spatial domain, and reorganizes it into a convolution weight. Based on the convolution weight, a global attention branch and a first local branch are constructed through spatial modulation to generate a modulated dynamic convolution weight. Based on the dynamic convolution weight, a frequency spectrum representation is obtained through frequency band modulation, the frequency spectrum subbands are divided by using a preset frequency band mask, and the spatial attention map generated by the input feature map is used to adjust the frequency band response at different positions and fuse all subband features.
[0039] The MSDA module normalizes and expands the channels of the input feature to obtain a first feature and a second feature, extracts spatial attention features of the first feature through depth convolution of different directions and sizes, modulates and fuses the convolution features of multiple receptive fields, and multiplies the fused features and the second feature element by element.
[0040] The C2DYT module performs nonlinear compression on the features through a first dynamic activation layer at the input end of the attention path, and performs dynamic range compression and channel-level affine adjustment on the features through a second dynamic activation layer before the feedforward convolution.
[0041] Specifically, Figure 2 The structural diagram of the detection model provided in the present application is shown in FIG. 1. Please refer to Figure 2 The detection model includes a C3k2_SFD module, an MSDA module, and a C2DYT module. The C3k2_SFD module is generally used in the feature extraction stage of the detection model and is a key component in the backbone network. The C3k2_SFD module is based on an improved C3 module, combines a convolution kernel design with k = 2 and a spatial difference mechanism, enhances the extraction capability of low-contrast regions and detailed features in the sonar image, and provides more abundant basic features for subsequent feature processing. The MSDA module (also called a multi-scale spatial decomposition attention module) is commonly used in the feature fusion stage and is often integrated in a feature pyramid network or a similar multi-scale feature processing structure. As a multi-scale dynamic attention module, the MSDA module dynamically adjusts the attention weights of features of different scales, strengthens the feature representation of multi-scale targets (especially small targets and targets with dramatic scale changes), and suppresses the attention bias caused by background interference and strong echoes. The C2DYT module is generally used in the feature refinement stage of the detection head and further processes the fused features. The C2DYT module is based on lightweight design, combines dynamic context perception and efficient channel attention mechanisms, reduces the complexity of model parameters, improves the ability to capture deep semantic features of targets, balances the detection accuracy and the lightweight demand of the model, and adapts to resource-constrained sonar deployment platforms.
[0042] The various modules of the detection module will be introduced in turn below.
[0043] Figure 3 The structural diagram of the C3k2_SFD module provided in the present application is shown in FIG. 2. Please refer to Figure 3 The C3k2_SFD module includes a partial frequency dynamic convolution unit, a first point-by-point convolution unit, and a second point-by-point convolution unit connected in sequence.
[0044] After receiving the input feature map, the partial frequency dynamic convolution unit performs frequency dynamic modeling on the target channel, maps the convolution kernel weight to the frequency domain, divides the frequency set, reorganizes the convolution weight through inverse discrete Fourier transform, establishes a first global feature and a first local feature in combination with spatial modulation, and outputs the preliminary processing feature through frequency band modulation.
[0045] The first point-by-point convolution unit receives the preliminary processing feature output by the partial frequency dynamic convolution unit, expands the feature channel using a double-channel expansion strategy, and enhances the nonlinear expression capability of the feature in combination with batch normalization and an activation function.
[0046] The second point-by-point convolution unit receives the expanded features output by the first point-by-point convolution unit, compresses the channel number back to the original scale, adds the initial input feature map of the C3k2_SFD module through a residual connection, and outputs the final processing features.
[0047] Specifically, after the partial frequency dynamic convolution unit receives the input feature map, it starts the frequency dynamic modeling process for the preset target channel (the remaining channels remain in the original state). First, the convolution kernel weight is mapped to the frequency domain space, and a plurality of frequency sets are divided according to the frequency characteristics. The inverse discrete Fourier transform is performed on each frequency set to map it from the frequency domain back to the spatial domain, and the convolution weight with specific frequency response is reorganized. Based on the reorganized convolution weight, the first global feature (establishing global dependence across channels and spaces) and the first local feature (capturing high-frequency detail information in local regions) are extracted through the spatial modulation mechanism respectively. The global and local features are subjected to frequency band modulation processing, and the integrated preliminary processing features are output. The first point-by-point convolution unit receives the preliminary processing features output by the partial frequency dynamic convolution unit. A double-channel expansion strategy is used to expand the number of feature channels (such as doubling the number of channels). During the channel expansion process, the batch normalization operation is combined to stabilize the feature distribution, and the activation function (such as SiLU) is introduced to introduce non-linear transformation and enhance the non-linear expression ability of the features. The second point-by-point convolution unit receives the expanded features output by the first point-by-point convolution unit. The expanded channel number is compressed back to the original scale of the initial input feature map of the C3k2_SFD module through convolution operation. The compressed features are added to the initial input feature map of the C3k2_SFD module through a residual connection. The added features are output as the final processing features of the module. Figure 1
[0048] For example, the input-output relationship of the C3k2_SFD module can be represented as:
[0049] ;
[0050] Among them, the output feature is the output feature; the input feature is the input feature.
[0051] The method provided by the embodiment, the C3k2_SFD module performs frequency dynamic modeling on the target channel through a partial frequency dynamic convolution unit, first maps the convolution kernel weight to the frequency domain and divides the frequency set, reorganizes the convolution weight through inverse discrete Fourier transform, and then combines spatial modulation to establish a first global feature and a first local feature, and finally outputs a preliminary processing feature through frequency band modulation. This process can accurately capture feature information of different frequency components for the common problems of sparse texture and blurred edges in the sonar image, not only grasps the overall structure of the target through the global feature, but also captures the detailed profile with the help of the local feature, and enhances the feature resolution capability for low-contrast regions and complex morphological targets. After receiving the preliminary processing feature, the first point-by-point convolution unit expands the feature channel through a double-channel expansion strategy, and combines batch normalization and an activation function, which not only increases the dimension and richness of the feature, but also enhances the expression ability of the feature through nonlinear transformation, so that the module can better learn the complex differences between the target and the background in the sonar image and adapt to feature changes in different scenes. The second point-by-point convolution unit compresses the expanded channel number back to the original size, and adds the initial input feature map of the C3k2_SFD module through residual connection, which not only ensures the feature processing efficiency and controls the model complexity, but also effectively preserves the original feature information, avoids the loss of features in the processing process, ensures the stability of gradient propagation, and enables the model to more efficiently learn useful features during the training process. In summary, the C3k2_SFD module improves the feature extraction and representation capability of various targets (including disturbed, large-scale change, and low-definition targets) in the sonar image through the synergistic effect of each unit, thereby providing a more accurate and rich feature basis for the subsequent detection process, and ultimately improving the precision, robustness, and adaptability to complex marine environments of sonar target detection.
[0052] Optionally, the partial frequency dynamic convolution unit comprises a frequency weight decomposition subunit, a spatial modulation subunit, and a frequency band modulation subunit connected in sequence.
[0053] (1) The frequency weight decomposition subunit maps the convolution kernel weight to the frequency domain to obtain a learnable frequency spectrum matrix, divides the frequency index set according to the frequency modulus, and applies inverse discrete Fourier transform to map back to the spatial domain and reorganize the convolution weight for each set.
[0054] Specifically, the frequency weight decomposition subunit (FDW, Fourier Disjoint Weight) is a key subunit in the partial frequency dynamic convolution unit, which mainly functions to decompose and reorganize the convolution kernel weight in the frequency domain, realize fine processing of the convolution weight, provide a more targeted weight basis for subsequent spatial modulation and frequency band modulation, thereby enhancing the detection model's ability to capture different frequency features, especially for processing complex frequency component distribution in the sonar image.
[0055] Optionally, the applying inverse discrete Fourier transform to each set to map back to spatial domain and reorganize into convolution weights comprises: for each frequency index set divided, applying two-dimensional inverse discrete Fourier transform to map the spectral coefficients in frequency domain back to spatial domain to obtain corresponding spatial domain parameters; reorganizing the spatial domain parameters to form first convolution weights; performing global average pooling processing on the input feature map to generate a set of dynamic attention coefficients through a fully connected layer and an activation function; and performing weighted operation on the dynamic attention coefficients and the first convolution weights to obtain final convolution weights used for feature extraction.
[0056] In a specific implementation, for each frequency index set divided by the frequency weight decomposition subunit according to frequency modulus length, two-dimensional inverse discrete Fourier transform is respectively applied to convert the spectral coefficients of each set in the frequency domain into parameters in the spatial domain to obtain spatial domain parameters corresponding to each set; the spatial domain parameters obtained by inverse discrete Fourier transform of all sets are integrated and reorganized to form first convolution weights having a basic feature extraction capability; a global average pooling operation is performed on the input feature map to compress the spatial dimension to extract global feature information, the pooling result is input into a fully connected layer for feature conversion, and then a set of dynamic attention coefficients reflecting the importance of features is generated through an activation function (such as sigmoid); the generated dynamic attention coefficients and the first convolution weights are weighted item by item according to corresponding positions, so that the convolution weights are adaptively adjusted according to the dynamic changes of the input features, and finally the convolution weights that can be used for feature extraction are obtained.
[0057] For example, in an embodiment, the frequency weight decomposition subunit groups parameters in the Fourier domain to learn and generates a plurality of convolution kernels with different frequency responses. Specifically, the frequency weight decomposition subunit first maps the standard convolution kernel to the frequency domain to obtain a learnable spectral matrix composed of complex spectral coefficients. Then, the spectral coefficients are sorted according to the frequency modulus length and divided into n non-overlapping frequency index sets , where i = 1, 2, …, n. Each set corresponds to a frequency band region, and a set of convolution kernels with different frequency feature distributions are generated. Each frequency subset only retains learning ability in the corresponding frequency band and is zeroed at other frequency points. Then, two-dimensional inverse discrete Fourier transform (IDFT) is applied to each frequency subset to map back to the spatial domain to obtain , which is further reorganized into a standard-shaped convolution weight . The iDFT expression can be expressed as:
[0058] ;
[0059] where k is the size of the convolution kernel, C mThis refers to the number of channels set in the partial convolution. It is a parameter with a two-dimensional frequency index of (x, y). is the parameter at position (t, h) in the spatial domain; n is the number of frequency index sets.
[0060] In generating standard convolution weights During the process, the input feature map X is processed through global average pooling, a fully connected (FC) layer, and a sigmoid activation function to obtain a set of dynamically generated attention coefficients {α1, …, α}. n This set of attention coefficients and The weighted operation can be expressed as:
[0061] ;
[0062] Among them, the The first convolution weight; The dynamic attention coefficient; These are the convolution weights.
[0063] The method provided in this embodiment involves a frequency weight decomposition subunit that maps convolutional kernel weights to the frequency domain to obtain a learnable spectrum matrix. It then divides the frequency index set according to frequency magnitude, applies a two-dimensional inverse discrete Fourier transform to each set to map it back to the spatial domain, obtains spatial domain parameters, and reassembles them into the first convolutional weights. Simultaneously, after global average pooling of the input feature map, dynamic attention coefficients are generated through a fully connected layer and activation function. These coefficients are then weighted with the first convolutional weights to obtain the final convolutional weights. This series of methods enables refined decomposition of the frequency components of the convolutional kernel at the frequency domain level, allowing the detection model to target specific frequency components. This method captures features of different frequencies in sonar images (such as high-frequency information of target contours and low-frequency information of the background), and achieves accurate conversion from the frequency domain to the spatial domain through inverse discrete Fourier transform, preserving the spatial distribution characteristics of key frequency features. The introduction of dynamic attention coefficients allows the convolution weights to be dynamically adjusted according to the input features, enhancing the adaptability to complex interference in sonar images (such as strong echoes and noise), reducing invalid feature interference, and ultimately enabling the detection model to extract target features more accurately in sonar target detection, improving the ability to identify blurry and low-contrast targets, and improving detection accuracy and robustness.
[0064] (2) The spatial modulation subunit establishes the first global features across channels and across space through the global attention branch based on the convolution weights, captures the first local features through the first local branch, and fuses them to generate the modulated dynamic convolution weights.
[0065] Specifically, the spatial modulation subunit (KSM, Kernel Spatial Modulation) is a key subunit in the partial frequency dynamic convolution unit, which mainly functions to dynamically modulate the convolution weight by fusing global dependency and local detail features, so that the convolution weight can take into account both global context information and local feature details, thereby enhancing the detection model's ability to capture the overall structure and local details of the target in the sonar image and improving the comprehensiveness and accuracy of feature extraction.
[0066] Optionally, the spatial modulation subunit, based on the aforementioned convolution weight, establishes a first global feature across channels and spaces through a global attention branch, captures a first local feature through a first local branch, and fuses to generate a modulated dynamic convolution weight, including: performing global average pooling on the input feature map to generate an embedding tensor; based on the embedding tensor, generating a first attention weight based on the input channel, a second attention weight based on the output channel, and a third attention weight facing the spatial position through three independent two-dimensional convolution and activation functions, and uniformly converting the attention weights into a form consistent with the dimension of the dynamic convolution kernel weight tensor; using one-dimensional convolution and activation function to model the channel features of the input feature map across channels to generate local attention weight; and multiplying the first attention weight, the second attention weight, the third attention weight, and the local attention weight with the convolution weight element by element to obtain the modulated dynamic convolution weight.
[0067] In specific implementation, a global average pooling operation is performed on the input feature map to compress the spatial dimension to extract global statistical information and generate an embedding tensor containing global feature information; based on the embedding tensor, three independently set two-dimensional convolution layers and activation functions are used for processing: the first combination generates a first attention weight for emphasizing input channel features, the second combination generates a second attention weight for emphasizing output channel features, and the third combination generates a third attention weight for highlighting key spatial positions; the three attention weights are uniformly converted into the same dimension form as the dynamic convolution kernel weight tensor to ensure the compatibility of subsequent operations; further, a one-dimensional convolution layer and an activation function are used to model the channel features of the input feature map across channels to capture the correlation between channels and generate a local attention weight for focusing on local area details; the four types of weights, i.e., the first attention weight, the second attention weight, the third attention weight, and the local attention weight, are multiplied with the convolution weight according to corresponding elements to obtain the final modulated dynamic convolution weight through the synergistic modulation of multi-dimensional attention.
[0068] For example, in one embodiment, the spatial modulation subunit introduces a learnable dense modulation matrix to modulate the spatial location of each k×k filter point-by-point, enabling independent adjustment of the convolution weights in the spatial domain. Specifically, the spatial modulation subunit includes a global attention branch and a local high-resolution branch. The former is used to establish global structural dependencies across channels and across space, while the latter focuses on capturing high-frequency detail features in local regions. The two branches are fused at the output stage to generate the final modulation matrix used to modulate the dynamic convolution weights. In a specific implementation, the input feature map X generates a global feature embedding tensor through global average pooling, which can be represented as:
[0069] ;
[0070] Among them, the For embedding tensors; the This is the input feature map.
[0071] The dimension of the embedding tensor is This tensor contains a compressed representation of the input image at the global semantic level. Based on this tensor, the global attention branch is designed as an adaptive weight generator oriented towards input features, aiming to capture attention from three key dimensions: input channel, output channel, and spatial location, within the global context. This branch extracts the global semantic features of Xembend through an FC layer and a sigmoid function, and then generates attention in different dimensional spaces using three independent 2D convolutions. The generation method and dimensions of each attention are as follows:
[0072] ;
[0073] Among them, the and These are the first attention weight and the second attention weight, respectively. It is the third attention weight. It is the kernel size. = = .
[0074] Furthermore, to compensate for the shortcomings of global attention in high-frequency detail modeling, the local high-resolution branch uses Conv1d and Sigmoid to perform cross-channel modeling of channel features, generating attention weights with higher resolution. Finally, the weights output by the three types of global attention, local attention, and frequency weight decomposition subunits are used to generate attention weights with higher resolution. Multi-level fusion weights are generated through element-wise multiplication. The fusion formula can be expressed as:
[0075] ;
[0076] wherein the is a modulated dynamic convolution weight; the is a first attention weight, a second attention weight, is a third attention weight; the is a local attention weight; the is a convolution weight.
[0077] The method provided by the embodiment generates an embedding tensor by performing global average pooling on the input feature map, generates channel and spatial attention weights based on the embedding tensor through three independent two-dimensional convolutions and activation functions, and converts them into a form consistent with the dimension of the dynamic convolution kernel weight tensor, simultaneously performs cross-channel modeling on the channel features of the input feature map through one-dimensional convolution and an activation function to generate a local attention weight, and then element-wise multiplies the three types of attention weights and the convolution weight to obtain a modulated dynamic convolution weight. This series of means can effectively capture the cross-channel and cross-space global dependency relationship of the target in the sonar image through the global attention branch, highlight the features of the key channel and important spatial position, accurately capture the local detail features through the first local branch, enhance the perception of local information such as the edges and textures of the target, and through the fusion and modulation of the multi-dimensional attention weight and the convolution weight, the convolution weight can be dynamically adjusted according to the complex distribution of the target and the background in the sonar image, which not only strengthens the extraction of effective target features, but also suppresses the influence of interference factors such as strong echoes and noise, and finally improves the recognition accuracy and detection robustness of the model for various targets (especially fuzzy and low-contrast targets) in the sonar image.
[0078] (3) The frequency band modulation subunit performs Fourier transform on the modulated dynamic convolution weight to obtain a frequency spectrum representation, divides the frequency spectrum subbands by using a preset frequency band mask, adjusts the frequency band responses at different positions through the spatial attention map after completing the convolution calculation in the frequency domain, and fuses all subband features to output preliminary processing features.
[0079] Specifically, the frequency band modulation subunit (FBM, Frequency Band Modulation) is a key subunit in the partial frequency dynamic convolution unit, which mainly functions to divide and process the features in the frequency domain through subband division, adjust the frequency band responses at different positions through the spatial attention, realize fine capture and integration of different frequency component features in the sonar image, enhance the resolution capability of the detection model for complex frequency distribution features, and especially highlight the key features of the target in a specific frequency band while suppressing the influence of noise and other interference frequency bands.
[0080] Optionally, the frequency band modulation subunit performs a Fourier transform on the modulated dynamic convolution weights to obtain a spectral representation, divides the spectral sub-bands using a preset frequency band mask, and after completing the convolution calculation in the frequency domain, adjusts the frequency band response at different positions through a spatial attention map and fuses all sub-band features to output preliminary processed features. This includes: performing a discrete Fourier transform on the dynamic convolution weights to obtain the corresponding spectral representation; dividing the spectral representation using a preset frequency band mask to obtain multiple non-overlapping frequency sub-bands; each frequency band mask takes a value of 1 only when the corresponding frequency falls within a preset threshold range, and takes a value of 0 when it does not fall within the preset threshold range, and the preset threshold is divided in a logarithmic proportional manner; performing convolution calculations on each frequency sub-band with the input feature map in the frequency domain to obtain the preliminary convolution results corresponding to each frequency sub-band; generating a spatial attention map from the input feature map through two-dimensional convolution and an activation function; weighting the preliminary convolution results of each frequency sub-band with the corresponding spatial attention map position by position; and fusing all spatially modulated frequency band features to obtain preliminary processed features.
[0081] In specific implementation, the modulated dynamic convolution weights output by the spatial modulation subunit are subjected to a Discrete Fourier Transform (DFT) to transform them from the spatial domain to the frequency domain, obtaining the corresponding spectral representation. The spectral representation is then divided using a preset frequency band mask: each frequency band mask uses binary values, taking a value of 1 when the corresponding frequency is within a preset threshold range, and 0 otherwise. The preset threshold is divided in a logarithmic proportional manner to adapt to the frequency distribution characteristics of the sonar image, resulting in multiple non-overlapping frequency sub-bands. In the frequency domain, each sub-band is convolved with the input feature map, processing different frequency components independently to obtain preliminary convolution results for each sub-band. Spatial features are extracted from the input feature map using a two-dimensional convolutional layer, and after activation function processing, a spatial attention map is generated. Subsequently, the preliminary convolution results of each sub-band are weighted point-by-point with the spatial attention map according to their corresponding positions, enhancing the frequency band features at important spatial locations. All spatially modulated frequency band features are integrated and fused, summarizing the effective information of each sub-band, and finally outputting the preliminary processed features.
[0082] For example, in one embodiment, the band modulation subunit first adjusts the output weights of the spatial modulation subunit. Perform a discrete Fourier transform to obtain the spectral representation, and then use a set of predefined frequency band masks. The spectrum is divided into multiple non-overlapping frequency sub-bands. The weight of each frequency band is determined by the following formula:
[0083] ;
[0084] Among them, the and Representing DFT and iDFT respectively, Only 1 when the current frequency belongs to the threshold range, indicating that it belongs to the bth frequency band, and the rest of the positions are 0. The frequency threshold is divided into {0, 1 / 16, 1 / 8, 1 / 4, 1 / 2} by logarithmic equal ratio.
[0085] Since there is a problem of infinite support domain in realizing the ideal filter in the spatial domain, the frequency band modulation subunit performs convolution calculation in the frequency domain. The calculation expression is:
[0086]
[0087] Subsequently, the input feature map X is generated by two-dimensional convolution and Sigmoid activation to generate a spatial attention map , which is used to adjust the frequency band response at different spatial positions. Each frequency band output is weighted with the corresponding at each position. The fusion formula of all frequency band modulations can be expressed as:
[0088]
[0089] , the output feature map; the , the number of frequency bands; the , the spatial attention map; the , each frequency band output.
[0090] The method provided by the embodiment, the frequency band modulation subunit obtains a frequency spectrum representation by performing discrete Fourier transform on the modulated dynamic convolution weight, divides a plurality of non-overlapping frequency subbands by using a preset frequency band mask (the mask takes 1 within the preset threshold range divided by logarithmic equal ratio and 0 outside the range), and performs convolution on the input feature map in the frequency domain to obtain a preliminary result. Each subband is weighted at each position by the spatial attention map generated by the input feature map through two-dimensional convolution and an activation function, and finally, all subband features are fused to output a preliminary processing feature, so that the detection model can finely capture the features of different frequency components in the sonar image at the frequency domain level. The frequency band mask divided by logarithmic equal ratio adapts to the frequency distribution characteristics of the sonar signal, can extract key information of the target in a specific frequency band, and suppress the influence of noise and other interference frequency bands. The spatial attention map can adjust the frequency band response according to the importance of the features at different spatial positions, strengthen the effective frequency band features of the target region, and weaken the redundant information of the background region. Ultimately, the model recognition ability for the target with complex frequency distribution in the sonar image is improved, especially in the scene where the frequency characteristics of the target and the background are mixed, the target can be more accurately positioned and recognized, and the accuracy and robustness of the sonar target detection are improved.
[0091] Specifically, Figure 4 The structural diagram of the MSDA module provided in the present application is shown in FIG. 1. Please refer to Figure 4 , the MSDA module normalizes and channel-expands the input feature to obtain a first feature and a second feature, extracts spatial attention features of the first feature through deep convolution of different directions and sizes, modulates and fuses the convolution features of multiple receptive fields, and element-wise multiplies the fused features and the second feature, including: normalizing the input feature, expanding the feature channel number through point-by-point convolution, splitting the expanded feature along the channel dimension into the first feature and the second feature, splitting the second feature along the channel dimension into multiple sub-branches; performing convolution operations of different directions and sizes on the multiple sub-branches respectively, concatenating and fusing the processed sub-branches in the channel dimension to generate spatial attention features; setting multiple-scale parallel branches containing corresponding numbers of receptive fields based on the multiple sub-branches, element-wise multiplying the input feature map and the spatial attention features on each scale branch, and concatenating and fusing the modulation results of each scale branch to obtain a multi-scale spatial attention feature map; element-wise multiplying the multi-scale spatial attention feature map and the first feature, and performing residual connection (element-wise addition) between the multiplication result and the original input feature map of the MSDA module to output the final processed feature.
[0092] In specific implementation, first, the input feature is normalized to eliminate the influence of different feature scales; then, the feature channel number is expanded through point-by-point convolution (1x1 convolution) to increase the feature dimension to accommodate more information; subsequently, the expanded feature is split along the channel dimension into two parts as the first feature and the second feature, and the second feature is further split along the channel dimension into several sub-branches. For each sub-branch, deep convolution of different directions (such as horizontal, vertical, and diagonal directions) and different sizes (such as 1x3, 3x1, 3x3, 5x5, etc.) is performed to make each sub-branch focus on capturing features of specific directions and scales; then, the features of all sub-branches after convolution are concatenated in the channel dimension to integrate into spatial attention features containing multi-direction and multi-scale information. According to the number of sub-branches, a corresponding number of multi-scale parallel branches are set, each branch corresponding to a different receptive field (controlled by the convolution kernel size or the hole rate) to adapt to different sizes of targets; in each scale branch, the input feature map and the spatial attention features are element-wise multiplied to modulate the input feature with the attention features and highlight important information; then, the modulation results of all scale branches are concatenated and fused in the channel dimension to obtain a multi-scale spatial attention feature map that fuses multiple receptive field information. The multi-scale spatial attention feature map is element-wise multiplied with the first feature to combine the attention information with the basic feature deeply; finally, the multiplication result is residual connected (element-wise added) with the original input feature map of the MSDA module to retain the original feature information while incorporating the newly extracted features, and the final processed feature is output.
[0093] For example, in an embodiment, first, input features Layer Normalization is applied, and then channel expansion is performed by PWConv to expand the number of feature channels from C to 2C, and the expanded features are divided into two parts along the channel dimension, denoted as and The processing process is as follows:
[0094] ;
[0095] wherein the first feature and the second feature are respectively and The input feature is .
[0096] Subsequently, are further divided into four sub-branches along the channel dimension to perform spatial attention calculation and multi-scale feature extraction tasks in parallel. The spatial attention is composed of InceptionDWConv and PWConv. InceptionDWConv first divides A k( ) into four branches along the channel dimension to obtain , and then different depth convolution operations are applied to each sub-branch. Branch applies a 3x3 size depth convolution to focus on capturing spatial features of local neighborhoods, branch uses a 1x11 size depth convolution to extract spatial features of long-distance dependencies along the width direction, and branch uses an 11x1 size depth convolution to extract spatial features of long-distance dependencies along the height direction. The processed , , and branch are fused by concatenation along the channel dimension, and finally PWConv is used to realize channel mixing and feature enhancement. The processing process of the spatial attention branch is as follows:
[0097] ;
[0098] wherein the second feature is ; the four branches are ; and the multi-scale spatial attention feature map is .
[0099] The multi-scale parallel branch includes convolution operations of 3*3, 5*5, 7*7 and 9*9 receptive fields to capture spatial information at different scales. On each scale branch, the input feature map is multiplied element by element with the spatial attention map to achieve attention modulation, and the finally fused output feature map is obtained by the following operation expression:
[0100] ;
[0101] wherein the is the finally fused output feature map; the is the first feature; the is the multi-scale spatial attention feature map. When k' corresponds to 3*3, 5*5, 7*7 and 9*9 convolution kernels when 1, 2, 3 and 4 are taken.
[0102] After the multi-scale spatial attention feature map obtained by fusion is spliced, it is multiplied element by element with the , and channel mixing and feature enhancement are realized through PWConv. Finally, the enhanced feature map is connected in residual with the original input feature map to obtain the final output feature map of the module, which is obtained by the following operation expression:
[0103] ;
[0104] wherein the is the finally processed feature; the is the first feature; the is the original input feature map; and the is the finally fused output feature map.
[0105] The method provided in the embodiment stabilizes the feature distribution by normalizing the input features through the MSDA module, splits the features into first features and second features after expanding the channel number through point-by-point convolution, splits the second features into multiple sub-branches and extracts features through convolution operations with different directions and sizes, generates spatial attention features through splicing and fusion, sets a corresponding number of receptive fields for the multi-scale parallel branches based on the sub-branches, modulates the input features with the spatial attention features in each branch and fuses to obtain multi-scale spatial attention feature maps, and finally multiplies the first features and connects the residual with the original input features to output the final features. The MSDA module can capture the directional characteristics and detailed information of the target in the sonar image through multi-directional and multi-sized convolution, enhance the feature perception of different morphological targets, and adapt the scale change of the sonar target through the multi-scale parallel branches. The effective target features at each scale are highlighted through attention modulation, and the background interference in the complex marine environment is suppressed. The residual connection retains the original feature information and alleviates the gradient disappearance problem, thereby improving the detection capability of the model for multi-scale and multi-morphology targets in the sonar image as a whole, especially in the scene where the target is disturbed by noise and echo, and more accurately identifying and positioning the target to improve the accuracy and robustness of detection.
[0106] Specifically, Figure 5 The structure diagram of the C2DYT module provided in the application is shown in Figure 5 The C2DYT module compresses the features through the first dynamic activation layer at the input end of the attention path, and compresses the features through the second dynamic activation layer before the feedforward convolution, including: at the input end of the attention path, the first dynamic activation layer compresses the input features through a dynamic activation function, and controls the compression degree through a globally learnable scalar; the feature value corresponding to the extreme echo signal is in the saturation interval; after attention calculation and before feedforward convolution, the second dynamic activation layer compresses the features through a dynamic activation function, and adjusts the dynamic range and channel level of the features through a globally learnable scalar, adjusts the amplitude difference between channels through the scaling parameters of each channel, and calibrates the channel mean through the offset parameter; after the two-layer dynamic activation processing, the processed features are added to the original input features through residual connection, and the final processed features are output.
[0107] In a specific implementation, first, a first dynamic activation layer is deployed at the input end of the attention path: the first dynamic activation layer calls a dynamic activation function to perform nonlinear compression processing on the input features. In this process, a globally learnable scalar is set, which is used as a parameter in model training, and the value of the scalar directly determines the compression degree of the features. By adjusting the learnable scalar, the feature values corresponding to extreme echo signals in the input features are compressed into a preset saturation interval, ensuring that extreme signal features do not excessively affect subsequent processing. After completing the attention calculation step, before performing the feedforward convolution operation, a second dynamic activation layer is enabled: the second dynamic activation layer also uses a dynamic activation function to process the features. First, a globally learnable scalar is introduced to compress the dynamic range of the features as a whole, reducing the fluctuation amplitude of the feature values. Then, a scaling parameter is configured for each channel to adjust the amplitude difference between different channels and balance the importance of the features of each channel. Finally, an offset parameter is set for each channel to calibrate the mean value of each channel and optimize the feature distribution of the channel. These three operations together realize dynamic range compression and channel-level affine adjustment of the features. After the continuous processing of the first dynamic activation layer and the second dynamic activation layer, a residual connection mechanism is used to add the features obtained after the processing of the two layers to the original input features received by the C2DYT module element by element, integrate the original feature information and the processed feature information, and finally output the final processed features of the module.
[0108] For example, in an embodiment, the first dynamic activation layer and the second dynamic activation layer can be represented as:
[0109] ;
[0110] wherein, are learnable scaling and offset parameters for each channel; is a globally learnable scalar; , are input and output.
[0111] The method provided in this embodiment effectively suppresses the interference of extreme echoes (such as strong reflection noise) in the sonar image on feature extraction through the first dynamic activation layer, avoiding the dominance of extreme signals in feature learning. The second dynamic activation layer optimizes the feature distribution and balances the importance of the features of each channel through dynamic range compression and channel-level affine adjustment, enhances the ability to capture effective target features, the residual connection retains the original feature information and ensures the integrity of feature transmission, and overall improves the recognition ability of the detection model for targets disturbed by strong echoes in a complex marine environment, reduces the influence of noise on the detection result, and improves the accuracy and stability of sonar target detection.
[0112] S103, input the sonar image to be detected into the trained detection model, and output a target detection result.
[0113] Specifically, the target detection result contains specific information of the detected target in the sonar image, mainly including the position of the target (generally in the form of coordinates of a bounding box, such as the pixel coordinates of the upper left corner and the lower right corner), the category of the target (i.e., what type of target it belongs to, such as fish, reef, wreck, etc.), and the confidence of the corresponding target (reflecting the reliability of the detection model for the target detection result, usually represented by a value between 0 and 1). These information collectively constitute the recognition and positioning result of the detection model for the target in the input sonar image, and intuitively present the target and its related attributes existing in the sonar image.
[0114] In specific implementation, the pre-processed sonar image data is converted into a tensor form readable by the detection model (such as converted into an array conforming to the input dimension of the model) according to the input specification of the detection model; the converted sonar image tensor is input into the trained detection model as input; after receiving the input, the detection model sequentially performs internal feature extraction (such as feature processing through the aforementioned C3k2_SFD module, MSDA module, and C2DYT module, etc.), feature fusion, target positioning and classification, etc. calculation process; after the detection model completes the calculation, the target detection result is output. The working principle of the detection model can be referred to the description in the above embodiments and the prior art, which will not be repeated here.
[0115] The method provided by the embodiment, in the first aspect, three modules cooperate in innovation from different dimensions, the C3k2_SFD module focuses on fine processing of frequency and spatial features, the MSDA module focuses on capturing of multi-scale and directional features, and the C2DYT module focuses on noise suppression and feature distribution optimization, the combination of the three comprehensively improves the detection capability of the detection model on the sonar target in a complex marine environment, enhances the pertinence and richness of feature extraction, improves the adaptability to target morphological changes, reduces noise interference, and realizes overall improvement of detection accuracy and robustness. In the second aspect, the C3k2_SFD module maps the convolution kernel weight to the frequency domain through frequency weight decomposition and divides the set according to the frequency module length, reorganizes the convolution weight through inverse discrete Fourier transform, generates dynamic convolution weight in combination with spatial modulation, and adjusts the sub-band feature through frequency band modulation and spatial attention map adjustment. This method can accurately capture features of different frequency components, adapt to the frequency distribution of the sonar signal, highlight the key frequency band information of the target and suppress interference, and enhance the ability to distinguish the frequency difference between the target and the background. In the third aspect, the MSDA module splits the features after normalization and channel expansion of the input features, extracts spatial attention features through deep convolution of different directions and sizes, combines multi-scale parallel branches to fuse multiple receptive field features and multiply them with another feature. This method can effectively capture target features of different scales and directions, adapt to the morphological changes of the target, strengthen effective features and suppress background interference, and improve the detection capability of multi-scale and multi-morphology targets. In the fourth aspect, the C2DYT module controls the extreme value echo feature through nonlinear compression of the feature by the first dynamic activation layer, performs dynamic range compression and channel-level affine adjustment by the second dynamic activation layer, and combines residual connection. This method can suppress extreme noise interference, optimize feature distribution and balance channel importance, avoid strong echo dominant feature learning, retain original feature information, reduce the influence of noise on the detection result, and improve the accuracy and stability of detection.
[0116] Corresponding to the foregoing embodiment of the sonar target detection method for a complex marine environment, the present application also provides an embodiment of a sonar target detection device for a complex marine environment.
[0117] Figure 6 The structure diagram of the sonar target detection device for a complex marine environment provided by Embodiment Two of the present application is shown in FIG. 2. Please refer to Figure 6 The device provided by the embodiment includes a construction module 210, a training module 220 and an output module 230.
[0118] The construction module 210 is configured to construct a sonar image dataset.
[0119] The training module 220 is configured to train the detection model using the sonar image dataset to obtain a trained detection model.
[0120] The detection model comprises a C3k2_SFD module, an MSDA module and a C2DYT module; the C3k2_SFD module maps the convolution kernel weight to the frequency domain through frequency weight decomposition, divides the frequency set according to the frequency module length, maps each frequency set back to the spatial domain, and reorganizes the convolution weight; based on the convolution weight, a global attention branch and a local branch are constructed through spatial modulation, and a dynamic convolution weight after modulation is generated by fusion; based on the dynamic convolution weight, a frequency spectrum representation is obtained through frequency band modulation, the frequency spectrum subband is divided by using a preset frequency band mask, and the frequency band response of different positions is adjusted by using a spatial attention map generated by the input feature map, and all subband features are fused;
[0121] The MSDA module normalizes and expands the channels of the input feature, splits the first feature and the second feature, extracts the spatial attention feature of the first feature through deep convolution of different directions and sizes, modulates and fuses the convolution features of multiple receptive fields, and multiplies the fused features and the second features element by element;
[0122] The C2DYT module performs nonlinear compression on the feature through the first dynamic activation layer at the input end of the attention path, and performs dynamic range compression and channel-level affine adjustment on the feature through the second dynamic activation layer before feedforward convolution.
[0123] The output module 230 is configured to input the sonar image to be detected into the trained detection model, and output a target detection result.
[0124] The device of the embodiment can be used to execute the steps of the method embodiment, and the specific implementation principles and implementation processes are similar, which will not be described here. Figure 1 The functions and roles of the units in the device are implemented in the implementation process of the corresponding steps in the above method, which will not be described here.
[0125] The functions and roles of the units in the device are implemented in the implementation process of the corresponding steps in the above method, which will not be described here.
[0126] For the device embodiment, since it basically corresponds to the method embodiment, the related parts can be referred to the part of the method embodiment. The device embodiment described above is only illustrative, and the units described as separate components can be or can not be physically separated, and the components displayed as units can be or can not be physical units, that is, they can be located in one place or distributed on multiple network units. According to actual needs, part or all of the modules can be selected to achieve the purpose of the scheme of the present application. Those skilled in the art can understand and implement without creative labor.
[0127] The above only is the preferred embodiment of the present application, and is not used to limit the present application, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.
Claims
1. A sonar target detection method for complex marine environments, characterized in that, The method comprises: constructing a sonar image dataset; training a detection model using the sonar image dataset to obtain a trained detection model; The detection model comprises a C3k2_SFD module, an MSDA module, and a C2DYT module; the C3k2_SFD module maps the convolution kernel weight to the frequency domain through frequency weight decomposition, divides the frequency set according to the frequency module length, maps each frequency set back to the spatial domain, and reorganizes it into a convolution weight; based on the convolution weight, a global attention branch and a first local branch are constructed through spatial modulation, and a modulated dynamic convolution weight is generated by fusion; based on the dynamic convolution weight, a frequency spectrum representation is obtained through band modulation, the frequency spectrum subband is divided by using a preset band mask, and the spatial attention map generated by the input feature map is used to adjust the band response of different positions and fuse all subband features; The MSDA module splits the input feature into a first feature and a second feature after normalization and channel expansion, extracts spatial attention features of the first feature through deep convolution of different directions and sizes, modulates and fuses the convolution features of multiple receptive fields, and multiplies the fused features and the second feature element by element; The C2DYT module performs nonlinear compression on the feature through a first dynamic activation layer at the input end of the attention path, and performs dynamic range compression and channel-level affine adjustment on the feature through a second dynamic activation layer before feedforward convolution; input the sonar image to be detected into the trained detection model, and output a target detection result.
2. The method of claim 1, wherein, The C3k2_SFD module comprises a partial frequency dynamic convolution unit, a first point-by-point convolution unit, and a second point-by-point convolution unit connected in sequence; The partial frequency dynamic convolution unit receives the input feature map, performs frequency dynamic modeling on the target channel, maps the convolution kernel weight to the frequency domain and divides the frequency set, reorganizes the convolution weight through inverse discrete Fourier transform, establishes a first global feature and a first local feature through spatial modulation, and outputs a preliminary processing feature through band modulation; The first point-by-point convolution unit receives the preliminary processing feature output by the partial frequency dynamic convolution unit, expands the feature channel through a double-channel expansion strategy, and enhances the nonlinear expression ability of the feature through batch normalization and an activation function; The second point-by-point convolution unit receives the expanded feature output by the first point-by-point convolution unit, compresses the channel number back to the original scale, adds the initial input feature map of the C3k2_SFD module through a residual connection, and outputs a final processing feature.
3. The method of claim 2, wherein, The partial frequency dynamic convolution unit comprises a frequency weight decomposition subunit, a spatial modulation subunit, and a band modulation subunit connected in sequence; The frequency weight decomposition subunit maps the convolution kernel weight to the frequency domain to obtain a learnable frequency spectrum matrix, sorts and divides the frequency index set according to the frequency module length, applies inverse discrete Fourier transform to each set to map it back to the spatial domain, and reorganizes it into a convolution weight; The spatial modulation subunit, based on the convolution weight, establishes a first global feature through a global attention branch and a first local feature through a first local branch, and generates a modulated dynamic convolution weight by fusion; The frequency band modulation subunit performs Fourier transform on the modulated dynamic convolution weight to obtain a frequency spectrum representation, divides the frequency spectrum subbands by using a preset frequency band mask, adjusts the frequency band responses at different positions by a spatial attention map after completing the convolution calculation in the frequency domain, and fuses all subband features to output preliminary processing features.
4. The method of claim 3, wherein, The applying of the inverse discrete Fourier transform to each set of frequency indexes includes: For each set of divided frequency indexes, a two-dimensional inverse discrete Fourier transform is applied to map the frequency spectrum coefficients in the frequency domain back to the spatial domain to obtain corresponding spatial domain parameters; The spatial domain parameters are reorganized to form first convolution weights; The input feature map is subjected to global average pooling processing, and a set of dynamic attention coefficients is generated through a fully connected layer and an activation function; The dynamic attention coefficients and the first convolution weights are subjected to weighted operation to obtain final convolution weights used for feature extraction.
5. The method of claim 3, wherein, The spatial modulation subunit establishes first global features across channels and across spaces through a global attention branch based on the foregoing convolution weights, captures first local features through a first local branch, and fuses to generate modulated dynamic convolution weights, including: The input feature map is subjected to global average pooling to generate an embedding tensor; Based on the embedding tensor, three independent two-dimensional convolutions and activation functions are used to respectively generate first attention weights based on input channels, second attention weights based on output channels, and third attention weights facing spatial positions, and the attention weights are uniformly converted into a form consistent with the dimension of the dynamic convolution kernel weight tensor; A one-dimensional convolution and an activation function are used to model the channel features of the input feature map across channels to generate local attention weights; The first attention weights, the second attention weights, the third attention weights, the local attention weights, and the convolution weights are subjected to element-by-element multiplication to obtain modulated dynamic convolution weights.
6. The method of claim 3, wherein, The frequency band modulation subunit performs Fourier transform on the modulated dynamic convolution weight to obtain a frequency spectrum representation, divides the frequency spectrum subbands by using a preset frequency band mask, adjusts the frequency band responses at different positions by a spatial attention map after completing the convolution calculation in the frequency domain, and fuses all subband features to output preliminary processing features, including: The dynamic convolution weights are subjected to discrete Fourier transform to obtain corresponding frequency spectrum representations; The frequency spectrum representations are divided by using preset frequency band masks to obtain a plurality of non-overlapping frequency subbands; each frequency band mask takes a value of 1 only when the corresponding frequency belongs to a preset threshold range, and takes a value of 0 when it does not belong to the preset threshold range, and the preset threshold is divided in a logarithmic equal ratio manner; Each frequency subband is respectively subjected to convolution calculation with the input feature map in the frequency domain to obtain preliminary convolution results corresponding to each frequency subband; A spatial attention map is generated by two-dimensional convolution and activation function on the input feature map, each frequency subband preliminary convolution result is weighted with the corresponding spatial attention map by position, and all spatially modulated frequency band features are fused to obtain preliminary processing features.
7. The method of claim 1, wherein, The MSDA module splits the input feature into a first feature and a second feature after normalization and channel expansion, extracts spatial attention features of the first feature through deep convolution of different directions and sizes, modulates and fuses the convolution features of multiple receptive fields, and multiplies the fused features and the second feature element by element, including: normalizing the input feature, expanding the feature channel number through point-by-point convolution, splitting the expanded feature into a first feature and a second feature along the channel dimension, and splitting the second feature into multiple sub-branches along the channel dimension; performing convolution operations of different directions and sizes on the multiple sub-branches, and fusing the processed sub-branches in the channel dimension to generate spatial attention features; based on the multiple sub-branches, a plurality of parallel branches with corresponding receptive fields are set, the input feature map and the spatial attention feature are multiplied element by element on each scale branch, and the modulation results of each scale branch are spliced and fused to obtain a multi-scale spatial attention feature map; multiply the multi-scale spatial attention feature map and the first feature element by element, and connect the multiplication result and the original input feature map in residual, output the final processing feature.
8. The method of claim 1, wherein, The C2DYT module performs nonlinear compression on the feature through the first dynamic activation layer at the input end of the attention path, and performs dynamic range compression and channel-level affine adjustment on the feature through the second dynamic activation layer before feedforward convolution, including: At the input end of the attention path, the first dynamic activation layer performs nonlinear compression on the input feature through a dynamic activation function, and controls the compression degree through a globally learnable scalar; the feature value corresponding to the extreme echo signal is in the saturation interval; After attention calculation and before feedforward convolution, the second dynamic activation layer performs dynamic range compression and channel-level affine adjustment on the feature through a dynamic activation function, compresses the overall dynamic range of the feature through a globally learnable scalar, adjusts the amplitude difference between channels through scaling parameters of each channel, and calibrates the channel mean through an offset parameter; After two layers of dynamic activation processing, the processed feature is added to the original input feature through residual connection, and the final processed feature is output.
9. The method of claim 1, wherein, The sonar image dataset is constructed, including: collecting sonar images in a real marine environment; the sonar images cover multiple scenes, interference factors and underwater targets; preprocessing the collected sonar images; dividing the preprocessed sonar images into a training set, a validation set and a test set according to a preset proportion to obtain a sonar image dataset.
10. A sonar target detection device for complex marine environments, characterized by, The device includes a construction module, a training module and an output module; wherein the construction module is configured to construct a sonar image dataset; the training module is configured to train the detection model using the sonar image dataset to obtain a trained detection model; The detection model comprises a C3k2_SFD module, an MSDA module and a C2DYT module; the C3k2_SFD module maps the convolution kernel weight to the frequency domain through frequency weight decomposition, divides the frequency set according to the frequency mode length, maps each frequency set back to the spatial domain, and reorganizes the convolution weight; based on the convolution weight, a global attention branch and a local branch are constructed through spatial modulation, and a dynamic convolution weight after modulation is generated by fusion; based on the dynamic convolution weight, a frequency spectrum representation is obtained through band modulation, the frequency spectrum subband is divided by using a preset band mask, the band response of different positions is adjusted by using a spatial attention map generated by the input feature map, and all subband features are fused; The MSDA module splits the input feature into a first feature and a second feature after normalization and channel expansion, extracts spatial attention features of the first feature through deep convolution of different directions and sizes, modulates and fuses the convolution features of multiple receptive fields, and multiplies the fused features and the second feature element by element; The C2DYT module performs nonlinear compression on the feature through a first dynamic activation layer at the input end of the attention path, and performs dynamic range compression and channel-level affine adjustment on the feature through a second dynamic activation layer before feedforward convolution; The output module is configured to input the sonar image to be detected into the trained detection model and output a target detection result.
Citation Information
Patent Citations
Sonar target identification system based on residual network
CN120428212A
Lightweight remote sensing target detection method and system
CN120708092A