Sonar image target detection method and system
By using CycleGAN to generate synthetic sonar images and an improved YOLO network structure, combined with a multi-task loss function, the problems of insufficient model generalization ability and low accuracy in small target detection in forward-looking sonar target detection are solved, achieving efficient and robust underwater target detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- THE 726TH RES INST OF CHINA STATE SHIPBUILDING CORP
- Filing Date
- 2026-02-06
- Publication Date
- 2026-06-05
AI Technical Summary
Existing deep learning-based forward-looking sonar target detection methods suffer from insufficient model generalization ability, low accuracy in small target detection, low efficiency in multi-scale feature fusion, imbalance between noise suppression and feature enhancement, and data scarcity in complex underwater environments, making it difficult to meet the real-time processing requirements of underwater unmanned platforms.
CycleGAN technology is used to generate synthetic sonar image augmentation datasets. An improved YOLO target detection network is constructed, and a high-level filtering feature fusion pyramid module and spatial attention mechanism are introduced. The model parameters are optimized by combining multi-task loss function to achieve efficient fusion of multi-scale features and noise suppression.
It significantly improves the accuracy and robustness of target detection in forward-looking sonar images, enhances the model's generalization ability in unknown underwater environments, strengthens the detection performance of small targets, and accelerates the model's convergence speed.
Smart Images

Figure CN122156853A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of underwater target recognition technology, specifically to a method and system for sonar image target detection. More particularly, it relates to a sonar image target detection method that integrates feature selection, cross-domain generation, and multi-task optimization. Background Technology
[0002] With the continuous development and maturation of sonar imaging technology, underwater target detection and identification using forward-looking sonar images has become a key technology in marine exploration, underwater security, resource exploration, and autonomous operations of unmanned underwater vehicles (UUVs). Traditional methods typically rely on manually designed features or statistical models for target extraction and discrimination. While these methods are effective for processing sonar images with simple structures and clean backgrounds, their detection accuracy and generalization ability are significantly limited in complex underwater environments. Forward-looking sonar images are generally affected by the physical characteristics of underwater acoustic propagation and complex underwater environments, resulting in problems such as low resolution, strong noise interference, blurred target edges, and poor contrast. Acoustic signals are prone to attenuation, multipath reflection, and scattering during propagation, leading to numerous ghost images, false targets, and speckled noise in the image. Weak target structural features and lack of texture information further increase the difficulty of detection. Furthermore, underwater platforms such as UUVs typically carry embedded devices with limited computing resources. Traditional detection models have high computational complexity and large memory consumption, making it difficult to meet real-time processing requirements.
[0003] In recent years, deep learning technology has made significant breakthroughs in optical image target detection, and its powerful feature learning and representation capabilities have provided new ideas for sonar image processing. Deep learning-based target detection methods mainly fall into two categories: two-stage detection algorithms (such as Faster R-CNN and Mask R-CNN) and one-stage detection algorithms (such as the YOLO series and SSD). While two-stage methods offer higher detection accuracy, they suffer from complex model structures, large parameter counts, and slow inference speeds. One-stage methods, such as YOLO, have a significant speed advantage and are more suitable for deployment on computationally limited underwater platforms. However, directly applying general detection models like YOLO to forward-looking sonar images still presents many challenges. First, sonar images differ significantly from natural image domains, resulting in insufficient cross-domain generalization ability of the model, making it susceptible to underwater noise and artifacts, leading to false detections and missed detections. Secondly, YOLO's original Feature Pyramid Network (FPN) and Path Aggregation Network (PAN) structures typically employ simple concatenation or element-wise addition operations when performing multi-scale feature fusion. This fails to adequately consider the semantic differences and redundant information between features at different scales, making it difficult to effectively preserve the feature representation of weak targets while suppressing noise, especially resulting in poor performance for small-sized targets. Furthermore, sonar image data is costly to acquire and difficult to annotate, and publicly available datasets are limited in size, leading to overfitting and poor generalization performance in supervised learning methods. Although some studies have attempted to expand the sample size through data augmentation, traditional methods such as rotation and cropping cannot simulate the real physical processes of acoustic imaging, and significant distributional differences still exist between synthetic and real sonar images.
[0004] In summary, existing deep learning-based forward-looking sonar target detection methods still have the following shortcomings: (1) The model is not capable of extracting features from high-noise, low-contrast sonar images, and the detection accuracy of small targets is low; (2) The multi-scale feature fusion mechanism is not efficient and does not fully consider the problems of feature redundancy and semantic conflict; (3) There is a lack of attention modeling mechanism suitable for the characteristics of sonar images, making it difficult to achieve a balance between noise suppression and feature enhancement; (4) The problem of sample scarcity is prominent, and existing data augmentation methods are difficult to truly restore the distribution of sonar images, which restricts the generalization ability of the model.
[0005] Therefore, to address the aforementioned issues, there is an urgent need to develop a lightweight, efficient, and highly generalizable forward-looking sonar image target detection method. By improving the network structure and training strategy, the detection accuracy and robustness in complex underwater acoustic environments can be enhanced, thereby promoting the development of intelligent perception technology for underwater unmanned systems.
[0006] Patent application CN119649103A discloses a small target detection and recognition algorithm for forward-looking sonar images, including the following steps: Step 1: Input sonar beam domain data; Step 2: Detect the position of the small target using a constant false alarm rate (CFAR) algorithm; Step 3: Extract the target HOG features from the sonar image using a HOG algorithm; Step 4: Identify the type of the detected target and perform image classification using an SVM algorithm. However, this patent cannot completely solve the existing technical problems, nor can it meet the needs of this invention. Summary of the Invention
[0007] In view of the deficiencies in the prior art, the purpose of this invention is to provide a sonar image target detection method and system.
[0008] The sonar image target detection method provided by the present invention includes:
[0009] Step 1: Construct a forward-looking sonar image dataset, including acquiring raw forward-looking sonar images and preprocessing the images; generating synthetic sonar images using a cross-domain image transformation model, which is a CycleGAN-based model including two generators and two discriminators, and achieving the transformation from optical images to sonar images through cycle consistency loss; labeling the images to obtain labeled data, and dividing the processed data into training and testing sets; Step 2: Construct an improved YOLO object detection network structure. This network structure includes a backbone network, a neck network, and a detection head connected sequentially. The backbone network receives the input image and outputs a multi-scale feature map to the neck network. The backbone network is composed of a basic convolutional module, a downsampling module, and a residual module connected sequentially. The neck network fuses and enhances the multi-scale feature map by introducing a high-level feature fusion pyramid module. It adaptively weights features at different levels through a spatial attention filtering mechanism to highlight key features and suppress background noise, outputting an enhanced feature map to the detection head. The detection head outputs the object detection result based on the enhanced feature map. Step 3: Train the target detection model based on the training set, including data augmentation of the training set; optimizing model parameters using a multi-task loss function; setting training environment parameters; evaluating model performance using a validation set, including using mean average precision (mAP) as a performance evaluation metric, and saving the optimal model. Step 4: Test the trained model using the test set, load the optimal model weights, perform forward propagation inference to obtain the detection results, and evaluate and visualize the detection results, including comparing the detection results with the real labels, calculating the mean average precision (mAP), and overlaying the detection results onto the original sonar image.
[0010] Preferably, step 1 includes: A cross-domain image conversion model based on CycleGAN is constructed. The model includes two generators and two discriminators. The conversion from optical image to sonar image is achieved through cycle consistency loss. The generator receives the optical image and outputs the synthetic sonar image. The discriminators are used to distinguish between real sonar image and synthetic sonar image. Gaussian denoising is used for noise suppression, adaptive histogram equalization with contrast limitation is applied to improve image contrast and detail, and guided filtering is used for background suppression to enhance target features and optimize image quality. The preprocessing includes noise suppression using Gaussian denoising, enhancing image contrast and detail by applying contrast-limited adaptive histogram equalization, and background suppression using guided filtering.
[0011] Preferably, step 2 includes: The backbone network is composed of a basic convolutional module, a downsampling module, and a residual module connected sequentially. The basic convolutional module includes convolutional layers, batch normalization layers, and activation function layers for feature transformation and nonlinear mapping. The downsampling module uses a convolutional operation with a stride of 2 to reduce the spatial resolution of the feature map and expand the receptive field. The residual module introduces a skip connection structure to alleviate gradient vanishing and extract deep semantic features. The backbone network outputs multi-scale feature maps to the neck network. The neck network receives the multi-scale feature map, first upsamples the deep feature map and concatenates it with the shallow feature map, then downsamples the fused features and merges them with deeper features. Figure 2 The process involves a secondary splicing and fusion, while simultaneously introducing a high-level filtering feature fusion pyramid module. This module uses a spatial attention filtering mechanism to adaptively weight features at different levels, highlighting key features and suppressing background noise, and outputting an enhanced feature map to the detection head. The detection head includes multiple convolutional modules, each containing a convolutional layer, a batch normalization layer, and an activation function layer. Based on the enhanced feature map, it calculates prediction results at three scales in parallel, which are used to output the target class probability, confidence score, and bounding box coordinates.
[0012] Preferably, step 3 includes: The data augmentation includes applying Mosaic data augmentation to randomly arrange the images, combined with random rotation, flipping, random cropping, and contrast transformation operations; The multi-task loss function includes bounding box regression loss, target confidence loss, and class loss, wherein the bounding box regression loss uses XIOU_loss; The PyTorch deep learning framework is used, the batch size and initial learning rate are set, and the learning rate is dynamically adjusted using a cosine annealing strategy. Mosaic data augmentation is applied to randomly arrange images, and combined with random rotation, flipping, random cropping and contrast transformation operations to increase data diversity and improve the model's generalization ability. The multi-task loss function includes bounding box regression loss, target confidence loss, and class loss, wherein the bounding box regression loss uses XIOU_loss, and its calculation formula is as follows:
[0013] in, and These represent the predicted bounding box and the ground truth bounding box, respectively. The distance between the predicted bounding box and the ground truth bounding box is the Euclidean distance. The length of the diagonal of the minimum bounding matrix. For the weight function, The penalty term coefficient is given by the following formula:
[0014] in, , and , These are the width and height of the predicted bounding box and the ground truth bounding box, respectively; The PyTorch deep learning framework was used, with a batch size of 64 and an initial learning rate of 0.001. Cosine annealing was employed to dynamically adjust the learning rate in order to optimize the model training process. Evaluating model performance using a validation set includes using mean precision. As a performance evaluation metric, its calculation formula is as follows:
[0015]
[0016]
[0017]
[0018] in, For accuracy, Recall rate; (True Positive) indicates a true positive instance. (FalsePositive) indicates a false positive. (False Negative) indicates a false negative instance; (Average Precision) represents the integral value of the model's precision at each recall level. For recall rate The accuracy rate is as follows; The number of categories in the dataset. Indicates the first Average precision of the class; This represents the average precision.
[0019] Preferably, step 4 includes: comparing the detection results with the actual labels and calculating the average accuracy. The detection results are then overlaid and rendered onto the original sonar image to generate visualizations.
[0020] The sonar image target detection system provided by the present invention includes: Module M1: Constructs a forward-looking sonar image dataset, including acquiring raw forward-looking sonar images and preprocessing the images; generating synthetic sonar images using a cross-domain image transformation model, which is a CycleGAN-based model including two generators and two discriminators, and achieving the transformation from optical images to sonar images through cycle consistency loss; annotating the images to obtain labeled data, and dividing the processed data into training and testing sets; Module M2: Constructs an improved YOLO object detection network structure, comprising a backbone network, a neck network, and a detection head connected in sequence. The backbone network receives the input image and outputs a multi-scale feature map to the neck network. The backbone network is composed of a basic convolutional module, a downsampling module, and a residual module connected in sequence. The neck network fuses and enhances the multi-scale feature map by introducing a high-level feature fusion pyramid module, which adaptively weights features at different levels through a spatial attention filtering mechanism to highlight key features and suppress background noise, outputting an enhanced feature map to the detection head. The detection head outputs the object detection result based on the enhanced feature map. Module M3: Trains the object detection model based on the training set, including data augmentation of the training set; optimizes model parameters using a multi-task loss function; sets training environment parameters; evaluates model performance using a validation set, including using mean average precision (mAP) as a performance evaluation metric, and saves the optimal model. Module M4: Tests the trained model using the test set, loads the optimal model weights, performs forward propagation inference to obtain the detection results, and evaluates and visualizes the detection results, including comparing the detection results with the true labels, calculating the mean average precision (mAP), and overlaying and rendering the detection results onto the original sonar image.
[0021] Preferably, the module M1 includes: A cross-domain image conversion model based on CycleGAN is constructed. The model includes two generators and two discriminators. The conversion from optical image to sonar image is achieved through cycle consistency loss. The generator receives the optical image and outputs the synthetic sonar image. The discriminators are used to distinguish between real sonar image and synthetic sonar image. Gaussian denoising is used for noise suppression, adaptive histogram equalization with contrast limitation is applied to improve image contrast and detail, and guided filtering is used for background suppression to enhance target features and optimize image quality. The preprocessing includes noise suppression using Gaussian denoising, enhancing image contrast and detail by applying contrast-limited adaptive histogram equalization, and background suppression using guided filtering.
[0022] Preferably, the module M2 includes: The backbone network is composed of a basic convolutional module, a downsampling module, and a residual module connected sequentially. The basic convolutional module includes convolutional layers, batch normalization layers, and activation function layers for feature transformation and nonlinear mapping. The downsampling module uses a convolutional operation with a stride of 2 to reduce the spatial resolution of the feature map and expand the receptive field. The residual module introduces a skip connection structure to alleviate gradient vanishing and extract deep semantic features. The backbone network outputs multi-scale feature maps to the neck network. The neck network receives the multi-scale feature map, first upsamples the deep feature map and concatenates it with the shallow feature map, then downsamples the fused features and merges them with deeper features. Figure 2 The process involves a secondary splicing and fusion, while simultaneously introducing a high-level filtering feature fusion pyramid module. This module uses a spatial attention filtering mechanism to adaptively weight features at different levels, highlighting key features and suppressing background noise, and outputting an enhanced feature map to the detection head. The detection head includes multiple convolutional modules, each containing a convolutional layer, a batch normalization layer, and an activation function layer. Based on the enhanced feature map, it calculates prediction results at three scales in parallel, which are used to output the target class probability, confidence score, and bounding box coordinates.
[0023] Preferably, the module M3 includes: The data augmentation includes applying Mosaic data augmentation to randomly arrange the images, combined with random rotation, flipping, random cropping, and contrast transformation operations; The multi-task loss function includes bounding box regression loss, target confidence loss, and class loss, wherein the bounding box regression loss uses XIOU_loss; The PyTorch deep learning framework is used, the batch size and initial learning rate are set, and the learning rate is dynamically adjusted using a cosine annealing strategy. Mosaic data augmentation is applied to randomly arrange images, and combined with random rotation, flipping, random cropping and contrast transformation operations to increase data diversity and improve the model's generalization ability. The multi-task loss function includes bounding box regression loss, target confidence loss, and class loss, wherein the bounding box regression loss uses XIOU_loss, and its calculation formula is as follows:
[0024] in, and These represent the predicted bounding box and the ground truth bounding box, respectively. The distance between the predicted bounding box and the ground truth bounding box is the Euclidean distance. The length of the diagonal of the minimum bounding matrix. For the weight function, The penalty term coefficient is given by the following formula:
[0025] in, , and , These are the width and height of the predicted bounding box and the ground truth bounding box, respectively; The PyTorch deep learning framework was used, with a batch size of 64 and an initial learning rate of 0.001. Cosine annealing was employed to dynamically adjust the learning rate in order to optimize the model training process. Evaluating model performance using a validation set includes using mean precision. As a performance evaluation metric, its calculation formula is as follows:
[0026]
[0027]
[0028]
[0029] in, For accuracy, Recall rate; (True Positive) indicates a true positive instance. (FalsePositive) indicates a false positive. (False Negative) indicates a false negative instance; (Average Precision) represents the integral value of the model's precision at each recall level. For recall rate The accuracy rate is as follows; The number of categories in the dataset. Indicates the first Average precision of the class; This represents the average precision.
[0030] Preferably, module M4 includes: comparing the detection results with the real labels and calculating the average accuracy. The detection results are then overlaid and rendered onto the original sonar image to generate visualizations.
[0031] Compared with the prior art, the present invention has the following beneficial effects: (1) This invention introduces a spatial attention mechanism into the neck network and constructs a high-level screening feature fusion pyramid module, which can automatically weight features of different layers, effectively highlight important features during the fusion process, and suppress background noise interference to achieve feature screening. This effectively solves the inherent problem of weak target features and a lot of interference in forward-looking sonar images, and significantly improves the target detection effect of forward-looking sonar images. (2) The present invention uses CycleGAN technology to realize the conversion and generation of optical images to acoustic images, realizes the expansion of forward-looking sonar image data, improves data diversity, enables the model to learn more robust feature representations, effectively alleviates the overfitting problem caused by the scarcity of real sonar data, and significantly improves the generalization ability of the model in unknown underwater environments. (3) The present invention designs a multi-task loss function that comprehensively optimizes bounding box regression, target confidence and category prediction, providing a more stable and accurate gradient signal for model training, thereby significantly improving the localization accuracy of the target bounding box, accelerating the model convergence speed, and enhancing the regression robustness of targets of different scales. Attached Figure Description
[0032] Other features, objects, and advantages of the present invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1a and Figure 1b The result of converting an optical image to an acoustic image; Figure 2 This is a structural diagram of a forward-looking sonar image target detection model; Figure 3 A diagram of the pyramid module structure for high-level feature fusion screening; Figures 4a-4d This is a visualization of target detection results from forward-looking sonar images. Detailed Implementation
[0033] The present invention will now be described in detail with reference to specific embodiments. These embodiments will help those skilled in the art to further understand the present invention, but do not limit the invention in any way. It should be noted that those skilled in the art can make several changes and improvements without departing from the concept of the present invention. These all fall within the protection scope of the present invention.
[0034] Example 1 This invention provides a sonar image target detection method that integrates feature selection, cross-domain generation, and multi-task optimization. Addressing the problems of severe noise interference, weak target features, blurred edges, and poor real-time performance of detection models due to limited computing power of underwater unmanned platforms in forward-looking sonar images, this invention utilizes deep learning technology to study a high-precision target detection method. First, an optical-acoustic image conversion model is constructed using CycleGAN to generate a large number of forward-looking sonar images to expand the training dataset. Then, a YOLO neck network structure incorporating an attention mechanism is designed to achieve efficient fusion of multi-scale features and noise suppression. Finally, by optimizing the detection head and loss function, high-precision, real-time detection of underwater targets is achieved. The technical solution of this invention is described below with reference to the accompanying drawings. This embodiment provides a sonar image target detection method that integrates feature selection, cross-domain generation, and multi-task optimization, which includes the following steps: Step 1: Construct a forward-looking sonar image dataset. Obtain raw forward-looking sonar images through sea trials or public channels, perform manual annotation and data cleaning, and divide the dataset. Step 1.1: The data in this implementation case was obtained through sea trials. Data was collected using the 837A forward-looking sonar to obtain forward-looking sonar image data. There are three target categories: ships, buoys, and unmanned aerial vehicles (UUVs). The vast majority of targets are single targets, while some data show dual targets of UUVs and ships.
[0035] Step 1.2: Construct a preprocessing pipeline tailored to the characteristics of forward-looking sonar images to optimize data quality. Gaussian denoising is used to suppress noise, adaptive histogram equalization with contrast limiting is applied to improve image contrast and detail, and guided filtering is used for background suppression to enhance the target. Step 1.3: Construct a CycleGAN-based cross-domain image transformation model to expand the training dataset. Given that deep learning-based object detection models rely on large-scale, high-quality training data, while the amount of actually available, labeled forward-looking sonar image data is severely insufficient, this invention employs generative adversarial network (GAN) technology to construct a Cycle-Consistent Generative Adversarial Network (CycleGAN) model containing two generators and two discriminators. This model, by introducing a Cycle-Consistency Loss, can learn the mapping relationship from the optical image domain to the forward-looking sonar image domain without relying on pixel-level precisely paired optical-sonar image data. Through adversarial training strategies, the generator learns and generates synthetic images highly similar to the distribution of real sonar images, thereby effectively and cost-effectively expanding the training dataset, alleviating the problem of sample scarcity, and providing sufficient data support for the training of subsequent detection models. Figure 1a and Figure 1b The image shown is the result of converting an optical image to an acoustic image.
[0036] Step 1.4: Use the open-source software LabelImg to annotate the sonar images, outlining the bounding boxes of various targets in the images and assigning their categories. The annotation file for each image stores the category information of each target and the coordinates of its top-left and bottom-right corners in a standardized format, providing accurate supervision signals for model training. Step 1.5: Using a stratified sampling strategy, the labeled complete dataset is structurally divided to obtain training and testing sets for model training and testing.
[0037] Step 2: Construct an improved YOLO target detection network structure and introduce an attention mechanism to build a target detection model suitable for the characteristics of forward-looking sonar images; Step 2.1: Construct a forward-looking sonar image target detection model, such as... Figure 2 As shown, the model mainly consists of three core components connected sequentially: the backbone, the neck, and the head. The backbone acts as the encoder, responsible for extracting multi-scale primary and abstract features from the input image layer by layer. The neck receives the multi-scale feature maps output by the backbone and performs deep fusion and enhancement to aggregate semantic and positional information from different levels. The head, based on the enhanced feature maps output by the neck, performs object classification and bounding box regression prediction, ultimately outputting the detection results. Step 2.2: Construct a backbone network for feature extraction. This network mainly consists of a basic convolutional module, a downsampling module, and a residual module connected sequentially. It receives the preprocessed input image and performs feature extraction and transformation through a multi-layered cascaded convolutional module, ultimately outputting a set of multi-scale feature maps. The basic convolutional module consists of a convolutional layer (Conv), a batch normalization layer (BN), and an activation function layer (LeakyReLU) sequentially, used to implement feature transformation and nonlinear mapping. The downsampling module uses a convolutional operation with a stride of 2, gradually reducing the spatial resolution of the feature map while preserving feature information and expanding the receptive field. The residual module introduces a skip connection structure to alleviate the gradient vanishing problem in deep network training, thereby effectively extracting deeper and more discriminative semantic features. After layer-by-layer processing by the above modules, the backbone network finally outputs feature maps at different scales, providing input for the subsequent multi-scale feature fusion of the neck network. Step 2.3: Construct a neck network for multi-scale feature fusion. This network receives multi-scale feature maps output from the backbone network. First, it upsamples the deep feature maps and then concatenates them with shallow feature maps of the corresponding scale to obtain enhanced feature representations containing rich contextual information while reducing feature redundancy. Subsequently, the fused features are downsampled sequentially and then concatenated with deeper feature maps a second time to strengthen the interaction between shallow features at different levels, achieving bidirectional complementarity and efficient fusion of localization details and semantic information. Finally, the multi-scale feature maps after multi-layer enhancement are output to the detection head. Furthermore, considering the characteristics of small target scale, low contrast, and susceptibility to background noise in sonar images, this invention introduces a high-level filtering feature fusion pyramid module in the neck network, the structure of which is as follows: Figure 3 As shown, this module, through a spatial attention filtering mechanism, can adaptively weight features at different levels, highlight key features relevant to the target, and suppress irrelevant background noise interference, thereby achieving more discriminative multi-level feature fusion and effectively improving the detection accuracy of small targets; Step 2.4: Construct the detection head section for generating the final detection results, which receives the multi-scale feature maps enhanced and output by the neck network. Internally, it mainly consists of multiple consecutive convolutional modules, each containing a convolutional layer, a batch normalization layer, and an activation function. Based on the input feature maps at different scales, the detection head computes predictions at three scales in parallel. Each scale's prediction branch works independently, responsible for predicting targets of different sizes, thus achieving multi-scale target detection. Finally, the detection head outputs detection results including target class probabilities, confidence scores, and bounding box coordinates.
[0038] Step 3: Train the forward-looking sonar image target detection model based on the training set to obtain the optimal target detection model; Step 3.1: During training, multiple data augmentation strategies are applied. Mosaic data augmentation is used to randomly arrange four different photos to enrich the background of the target and improve the target detection performance. Furthermore, the dataset is expanded through operations such as random rotation, flipping, random cropping, and contrast transformation, greatly enriching the diversity of training samples. This allows the model to learn more image features during training, improving its generalization and robustness. Step 3.2: Design a multi-task loss function, which includes bounding box regression loss, target confidence loss, and class loss. To address the inaccuracy of traditional intersection-union-ratio (IU) calculations due to offset or scale differences, a new method is used... As the bounding box loss function, its calculation formula is:
[0039] in, and These represent the predicted bounding box and the ground truth bounding box, respectively. The distance between the predicted bounding box and the ground truth bounding box is the Euclidean distance. The length of the diagonal of the minimum bounding matrix. For the weight function, The penalty term coefficient is given by the following formula:
[0040] in, , and , These represent the width and height of the predicted bounding box and the ground truth bounding box, respectively.
[0041] Step 3.3: The training environment is built using the PyTorch deep learning framework. The batch size is set to 64, the initial learning rate is set to 0.001, and the learning rate is dynamically adjusted using a cosine annealing strategy during training. The intelligent object detection network is randomly initialized, and the training dataset is fed into the network. Step 3.4: Use Mean Average Precision (mAP) as a performance evaluation metric to measure the model's overall performance across all classes. This metric integrates precision and recall, and is calculated by averaging the average precision across all classes to obtain a comprehensive performance evaluation. The formula is as follows:
[0042]
[0043]
[0044]
[0045] in, For accuracy, Recall rate; (True Positive) indicates a true positive instance. (FalsePositive) indicates a false positive. (False Negative) indicates a false negative instance; (Average Precision) represents the integral value of the model's precision at each recall level. For recall rate The accuracy rate is as follows; The number of categories in the dataset. Indicates the first Average precision of the class; This represents the average precision.
[0046] Step 3.5: Use the validation set to evaluate the performance of the model during training. When the mean accuracy does not improve significantly over several consecutive periods, automatically terminate training and save the optimal object detection model.
[0047] Step 4: Input the test set data into the trained intelligent target detection model to detect underwater targets in forward-looking sonar images and evaluate the detection results; Step 4.1: Load the optimal object detection model weights obtained during the training phase and set the model to inference mode; Step 4.2: Input the test set data into the model, perform forward propagation calculation, automatically realize underwater target detection of forward-looking sonar images, and obtain detection results including target bounding box coordinates, confidence scores and category labels; Step 4.3: Compare the detection results with the true labels, calculate the average precision, evaluate the detection results, and overlay the detection results onto the original sonar image to obtain the visualization results, such as... Figures 4a-4d As shown.
[0048] Example 2 This invention also provides a sonar image target detection system, comprising: module M1: constructing a forward-looking sonar image dataset, including acquiring raw forward-looking sonar images, preprocessing the images, generating synthetic sonar images using a cross-domain image transformation model, labeling the images to obtain labeled data, and dividing the processed data into training and testing sets; module M2: constructing an improved YOLO target detection network structure, the network structure comprising a sequentially connected backbone network, a neck network, and a detection head, wherein the backbone network receives input images and outputs multi-scale feature maps to the neck network, and the neck network... The network fuses and enhances the multi-scale feature maps and outputs enhanced feature maps to the detection head. The detection head outputs target detection results based on the enhanced feature maps. Module M3: Trains the target detection model based on the training set, including data augmentation of the training set, optimization of model parameters using a multi-task loss function, setting training environment parameters, evaluating model performance using a validation set, and saving the optimal model. Module M4: Tests the trained model using the test set, loads the optimal model weights, performs forward propagation inference to obtain detection results, and evaluates and visualizes the detection results.
[0049] The module M1 includes: constructing a cross-domain image conversion model based on CycleGAN, the model including two generators and two discriminators, realizing the conversion from optical images to sonar images through cycle consistency loss, the generator receiving optical images and outputting synthetic sonar images, the discriminators being used to distinguish between real sonar images and synthetic sonar images; employing Gaussian denoising for noise suppression, applying contrast-limited adaptive histogram equalization to improve image contrast and details, and utilizing guided filtering for background suppression to enhance target features and optimize image quality.
[0050] The module M2 includes: the backbone network is composed of a basic convolutional module, a downsampling module, and a residual module connected sequentially. The basic convolutional module includes convolutional layers, batch normalization layers, and activation function layers for feature transformation and nonlinear mapping. The downsampling module uses a convolutional operation with a stride of 2 to reduce the spatial resolution of the feature map and expand the receptive field. The residual module introduces a skip connection structure to alleviate gradient vanishing and extract deep semantic features. The backbone network outputs multi-scale feature maps to the neck network. The neck network receives the multi-scale feature maps, first upsamples the deep feature maps and concatenates them with the shallow feature maps, then downsamples the fused features and concatenates them with deeper feature maps. Figure 2The process involves multiple concatenation and fusion steps, while simultaneously introducing a high-level feature fusion pyramid module. This module uses a spatial attention filtering mechanism to adaptively weight features at different levels, highlighting key features and suppressing background noise. The resulting enhanced feature map is then output to the detection head. The detection head includes multiple convolutional modules, each containing a convolutional layer, a batch normalization layer, and an activation function layer. Based on the enhanced feature map, it calculates prediction results at three scales in parallel, outputting the target class probability, confidence score, and bounding box coordinates.
[0051] Module M3 includes: applying Mosaic data augmentation to randomly arrange images, combined with random rotation, flipping, random cropping, and contrast transformation operations to increase data diversity and improve model generalization ability; and using multi-task loss functions including bounding box regression loss, target confidence loss, and class loss, wherein the bounding box regression loss uses XIOU_loss, and its calculation formula is:
[0052] in, and These represent the predicted bounding box and the ground truth bounding box, respectively. The distance between the predicted bounding box and the ground truth bounding box is the Euclidean distance. The length of the diagonal of the minimum bounding matrix. For the weight function, The penalty term coefficient is given by the following formula:
[0053] in, , and , These are the width and height of the predicted bounding box and the ground truth bounding box, respectively; The PyTorch deep learning framework was used, with a batch size of 64 and an initial learning rate of 0.001. Cosine annealing was employed to dynamically adjust the learning rate to optimize the model training process. Model performance was evaluated using a validation set, including average precision. As a performance evaluation metric, its calculation formula is as follows:
[0054]
[0055]
[0056]
[0057] in, For accuracy, Recall rate; (True Positive) indicates a true positive instance. (FalsePositive) indicates a false positive. (False Negative) indicates a false negative instance; (Average Precision) represents the integral value of the model's precision at each recall level. For recall rate The accuracy rate is as follows; The number of categories in the dataset. Indicates the first Average precision of the class; This represents the average precision.
[0058] The module M4 includes: comparing the detection results with the real labels and calculating the average accuracy. The detection results are then overlaid and rendered onto the original sonar image to generate visualizations.
[0059] Those skilled in the art will understand that, in addition to implementing the system, apparatus, and their modules provided by this invention in purely computer-readable program code, the same program can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, the system, apparatus, and their modules provided by this invention can be considered a hardware component, and the modules included therein for implementing various programs can also be considered structures within the hardware component; alternatively, modules for implementing various functions can be considered both software programs implementing the method and structures within the hardware component.
[0060] Specific embodiments of the present invention have been described above. It should be understood that the present invention is not limited to the specific embodiments described above, and those skilled in the art can make various changes or modifications within the scope of the claims, which do not affect the essence of the present invention. Unless otherwise specified, the embodiments and features described in this application can be arbitrarily combined with each other.
Claims
1. A method for target detection in sonar images, characterized in that, include: Step 1: Construct a forward-looking sonar image dataset, including acquiring raw forward-looking sonar images and preprocessing the images; generating synthetic sonar images using a cross-domain image transformation model, which is a CycleGAN-based model including two generators and two discriminators, and achieving the transformation from optical images to sonar images through cycle consistency loss; labeling the images to obtain labeled data, and dividing the processed data into training and testing sets; Step 2: Construct an improved YOLO object detection network structure. This network structure includes a backbone network, a neck network, and a detection head connected sequentially. The backbone network receives the input image and outputs a multi-scale feature map to the neck network. The backbone network is composed of a basic convolutional module, a downsampling module, and a residual module connected sequentially. The neck network fuses and enhances the multi-scale feature map by introducing a high-level feature fusion pyramid module. It adaptively weights features at different levels through a spatial attention filtering mechanism to highlight key features and suppress background noise, outputting an enhanced feature map to the detection head. The detection head outputs the object detection result based on the enhanced feature map. Step 3: Train the object detection model based on the training set, including data augmentation of the training set; optimize the model parameters using a multi-task loss function; Set the training environment parameters; evaluate model performance using the validation set, including using mean average precision (mAP) as the performance evaluation metric, and save the optimal model; Step 4: Test the trained model using the test set, load the optimal model weights, perform forward propagation inference to obtain the detection results, and evaluate and visualize the detection results, including comparing the detection results with the real labels, calculating the mean average precision (mAP), and overlaying the detection results onto the original sonar image.
2. The sonar image target detection method according to claim 1, characterized in that, Step 1 includes: A cross-domain image conversion model based on CycleGAN is constructed. The model includes two generators and two discriminators. The conversion from optical image to sonar image is achieved through cycle consistency loss. The generator receives the optical image and outputs the synthetic sonar image. The discriminators are used to distinguish between real sonar image and synthetic sonar image. Gaussian denoising is used for noise suppression, adaptive histogram equalization with contrast limitation is applied to improve image contrast and detail, and guided filtering is used for background suppression to enhance target features and optimize image quality. The preprocessing includes noise suppression using Gaussian denoising, enhancing image contrast and detail by applying contrast-limited adaptive histogram equalization, and background suppression using guided filtering.
3. The sonar image target detection method according to claim 1, characterized in that, Step 2 includes: The backbone network is composed of a basic convolutional module, a downsampling module, and a residual module connected sequentially. The basic convolutional module includes convolutional layers, batch normalization layers, and activation function layers for feature transformation and nonlinear mapping. The downsampling module uses a convolutional operation with a stride of 2 to reduce the spatial resolution of the feature map and expand the receptive field. The residual module introduces a skip connection structure to alleviate gradient vanishing and extract deep semantic features. The backbone network outputs multi-scale feature maps to the neck network. The neck network receives the multi-scale feature map, first upsamples the deep feature map and merges it with the shallow feature map, then downsamples the merged feature map and merges it with the deeper feature map a second time, and introduces a high-level filtering feature fusion pyramid module, which adaptively weights features at different levels through a spatial attention filtering mechanism to highlight key features and suppress background noise, and outputs an enhanced feature map to the detection head. The detection head includes multiple convolutional modules, each containing a convolutional layer, a batch normalization layer, and an activation function layer. Based on the enhanced feature map, it calculates prediction results at three scales in parallel, which are used to output the target class probability, confidence score, and bounding box coordinates.
4. The sonar image target detection method according to claim 1, characterized in that, Step 3 includes: The data augmentation includes applying Mosaic data augmentation to randomly arrange the images, combined with random rotation, flipping, random cropping, and contrast transformation operations; The multi-task loss function includes bounding box regression loss, target confidence loss, and class loss, wherein the bounding box regression loss uses XIOU_loss; The PyTorch deep learning framework is used, the batch size and initial learning rate are set, and the learning rate is dynamically adjusted using a cosine annealing strategy. Mosaic data augmentation is applied to randomly arrange images, and combined with random rotation, flipping, random cropping and contrast transformation operations to increase data diversity and improve the model's generalization ability. The multi-task loss function includes bounding box regression loss, target confidence loss, and class loss, wherein the bounding box regression loss uses XIOU_loss, and its calculation formula is as follows: in, and These represent the predicted bounding box and the ground truth bounding box, respectively. The Euclidean distance between the predicted bounding box and the ground truth bounding box. The length of the diagonal of the minimum bounding matrix. For the weight function, The penalty term coefficient is given by the following formula: in, , and , These are the width and height of the predicted bounding box and the ground truth bounding box, respectively; The PyTorch deep learning framework was used, with a batch size of 64 and an initial learning rate of 0.
001. Cosine annealing was employed to dynamically adjust the learning rate in order to optimize the model training process. Evaluating model performance using a validation set includes using mean precision. As a performance evaluation metric, its calculation formula is as follows: in, For accuracy, Recall rate; (True Positive) indicates a true positive instance. (False Positive) indicates a false positive. (False Negative) indicates a false negative instance; (Average Precision) represents the integral value of the model's precision at each recall level. For recall rate The accuracy rate; The number of categories in the dataset. Indicates the first Average precision of the class; This represents the average precision.
5. The sonar image target detection method according to claim 1, characterized in that, Step 4 includes: comparing the detection results with the actual labels and calculating the average accuracy. The detection results are then overlaid and rendered onto the original sonar image to generate visualizations.
6. A sonar image target detection system, characterized in that, include: Module M1: Constructs a forward-looking sonar image dataset, including acquiring raw forward-looking sonar images and preprocessing the images; generating synthetic sonar images using a cross-domain image transformation model, which is a CycleGAN-based model including two generators and two discriminators, and achieving the transformation from optical images to sonar images through cycle consistency loss; annotating the images to obtain labeled data, and dividing the processed data into training and testing sets; Module M2: Constructs an improved YOLO object detection network structure, comprising a backbone network, a neck network, and a detection head connected in sequence. The backbone network receives the input image and outputs a multi-scale feature map to the neck network. The backbone network is composed of a basic convolutional module, a downsampling module, and a residual module connected in sequence. The neck network fuses and enhances the multi-scale feature map by introducing a high-level feature fusion pyramid module, which adaptively weights features at different levels through a spatial attention filtering mechanism to highlight key features and suppress background noise, outputting an enhanced feature map to the detection head. The detection head outputs the object detection result based on the enhanced feature map. Module M3: Trains the object detection model based on the training set, including data augmentation of the training set; optimizes model parameters using a multi-task loss function; sets training environment parameters; evaluates model performance using a validation set, including using mean average precision (mAP) as a performance evaluation metric, and saves the optimal model. Module M4: Tests the trained model using the test set, loads the optimal model weights, performs forward propagation inference to obtain the detection results, and evaluates and visualizes the detection results, including comparing the detection results with the true labels, calculating the mean average precision (mAP), and overlaying and rendering the detection results onto the original sonar image.
7. The sonar image target detection system according to claim 6, characterized in that, The module M1 includes: A cross-domain image conversion model based on CycleGAN is constructed. The model includes two generators and two discriminators. The conversion from optical image to sonar image is achieved through cycle consistency loss. The generator receives the optical image and outputs the synthetic sonar image. The discriminators are used to distinguish between real sonar image and synthetic sonar image. Gaussian denoising is used for noise suppression, adaptive histogram equalization with contrast limitation is applied to improve image contrast and detail, and guided filtering is used for background suppression to enhance target features and optimize image quality. The preprocessing includes noise suppression using Gaussian denoising, enhancing image contrast and detail by applying contrast-limited adaptive histogram equalization, and background suppression using guided filtering.
8. The sonar image target detection system according to claim 6, characterized in that, The module M2 includes: The backbone network is composed of a basic convolutional module, a downsampling module, and a residual module connected sequentially. The basic convolutional module includes convolutional layers, batch normalization layers, and activation function layers for feature transformation and nonlinear mapping. The downsampling module uses a convolutional operation with a stride of 2 to reduce the spatial resolution of the feature map and expand the receptive field. The residual module introduces a skip connection structure to alleviate gradient vanishing and extract deep semantic features. The backbone network outputs multi-scale feature maps to the neck network. The neck network receives the multi-scale feature map, first upsamples the deep feature map and merges it with the shallow feature map, then downsamples the merged feature map and merges it with the deeper feature map a second time, and introduces a high-level filtering feature fusion pyramid module, which adaptively weights features at different levels through a spatial attention filtering mechanism to highlight key features and suppress background noise, and outputs an enhanced feature map to the detection head. The detection head includes multiple convolutional modules, each containing a convolutional layer, a batch normalization layer, and an activation function layer. Based on the enhanced feature map, it calculates prediction results at three scales in parallel, which are used to output the target class probability, confidence score, and bounding box coordinates.
9. The sonar image target detection system according to claim 6, characterized in that, The module M3 includes: The data augmentation includes applying Mosaic data augmentation to randomly arrange the images, combined with random rotation, flipping, random cropping, and contrast transformation operations; The multi-task loss function includes bounding box regression loss, target confidence loss, and class loss, wherein the bounding box regression loss uses XIOU_loss; The PyTorch deep learning framework is used, the batch size and initial learning rate are set, and the learning rate is dynamically adjusted using a cosine annealing strategy. Mosaic data augmentation is applied to randomly arrange images, and combined with random rotation, flipping, random cropping and contrast transformation operations to increase data diversity and improve the model's generalization ability. The multi-task loss function includes bounding box regression loss, target confidence loss, and class loss, wherein the bounding box regression loss uses XIOU_loss, and its calculation formula is as follows: in, and These represent the predicted bounding box and the ground truth bounding box, respectively. The Euclidean distance between the predicted bounding box and the ground truth bounding box. The length of the diagonal of the minimum bounding matrix. For the weight function, The penalty term coefficient is given by the following formula: in, , and , These are the width and height of the predicted bounding box and the ground truth bounding box, respectively; The PyTorch deep learning framework was used, with a batch size of 64 and an initial learning rate of 0.
001. Cosine annealing was employed to dynamically adjust the learning rate in order to optimize the model training process. Evaluating model performance using a validation set includes using mean precision. As a performance evaluation metric, its calculation formula is as follows: in, For accuracy, Recall rate; (True Positive) indicates a true positive instance. (False Positive) indicates a false positive. (False Negative) indicates a false negative instance; (Average Precision) represents the integral value of the model's precision at each recall level. For recall rate The accuracy rate; The number of categories in the dataset. Indicates the first Average precision of the class; This represents the average precision.
10. The sonar image target detection system according to claim 6, characterized in that, The module M4 includes: comparing the detection results with the real labels and calculating the average accuracy. The detection results are then overlaid and rendered onto the original sonar image to generate visualizations.