Underwater sonar image target detection method and system based on neural network
By improving the YOLOv8 network model to UP-YOLO, combining multiple innovative modules, optimizing the neural network structure and loss function, the problem of unsatisfactory underwater sonar image detection accuracy is solved, and high-precision and efficient underwater target detection is achieved, which is suitable for For marine resource development and underwater target identification.
Patent Information
- Application Number
- CN202410438067.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-12
- Publication Date
- 2024-09-10
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Underwater sonar images are affected by noise, target ambiguity and interference factors in complex ocean environments, resulting in unsatisfactory detection accuracy. It is difficult to achieve efficient and accurate target detection with existing technology.
Based on the YOLOv8 network model, it was improved to UP-YOLO, combined with C2f convolution, SPPF module, C2f-ODConv module and Wise-IOU loss function, to optimize the neural network structure and loss function, and build the UP-YOLO underwater sonar image target detection network model. Improve feature extraction and target detection capabilities.
It achieves high-precision and efficient underwater sonar image target detection, enhances the detection capabilities of small targets and complex backgrounds, improves detection accuracy and efficiency, and provides a convenient solution for marine resource development and underwater target identification.
Smart Images

Figure CN118628898A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of target detection, and in particular to a method and system for underwater sonar image target detection based on a neural network. Background Art
[0002] Underwater target detection is a crucial technology in many fields of the ocean. It not only plays a key role in the military, but is also widely used in the civil field, such as seabed mapping, marine life tracking, oil monitoring, and underwater environmental exploration. These applications not only promote the progress of marine science and technology, but also provide strong technical support for the development and utilization of marine resources.
[0003] As one of the core technologies for underwater target detection, sonar technology can form high-precision images by sending acoustic signals and receiving echo signals reflected by the detected objects. However, the underwater environment is complex and changeable, and there are many interference factors such as waves, currents, and bubbles. These factors lead to low resolution, blurred edge details, and severe speckle noise in sonar images. At the same time, in the underwater environment, sonar images are subject to multiple interferences such as noise, target ambiguity, and irregular shapes, resulting in unsatisfactory accuracy of current underwater target detection methods.
[0004] Therefore, it is extremely important to conduct research on the use of sonar equipment in underwater target detection and explore more efficient and accurate target detection algorithms and technologies. This will not only help improve the efficiency and accuracy of underwater target detection, provide better technical support and services for the fields of marine resource development, marine environmental monitoring, underwater detection, etc., but will also provide strong technical support for the construction of a modern marine safety governance system. Summary of the invention
[0005] The purpose of the present invention is to provide a method and system for underwater sonar image target detection based on a neural network. By constructing a forward-looking sonar image data set, the YOLOv8 algorithm is selected as the basic model, and the enhanced version is named UP-YOLO, and then the UP-YOLO underwater sonar image target detection network model is constructed. By using multiple modules such as C2f convolution, SPPF module, C2f-ODConv module, improved AFPN module and Wise-IOU loss function, high-precision and high-efficiency underwater sonar image target detection is achieved by optimizing the neural network structure and loss function, providing an effective technical solution for the fields of marine resource development, underwater target recognition, etc.
[0006] To achieve the above object, the present invention provides the following technical solution: comprising the following steps:
[0007] S1 builds a forward-looking sonar image dataset;
[0008] S2 performs data preprocessing on the image data set, converts the data into the required data format, and performs data enhancement on the data set;
[0009] S3 improves the YOLOv8 network model to the UP-YOLO network model, and builds the UP-YOLO underwater sonar image target detection network model structure;
[0010] Combining the improved AFPN module, C2f-ODConv module and Wise-IOU loss function, the overall network architecture UP-YOLO is constructed on the basis of the YOLOv8 network model; the YOLOv8 network model is used as the basic architecture, the C2f-ODConv module is used as the feature extraction module, the improved AFPN module is used as the non-neighboring layer feature fusion module, and the Wise-IOU loss function is set;
[0011] S4 performs network training on the UP-YOLO network model based on the training set in the constructed data set;
[0012] S5 performs target detection on the test set and validation set based on the trained UP-YOLO network model, and outputs the target detection results of underwater sonar images.
[0013] Preferably, step S1 specifically includes: acquiring the image to be detected by means of an acoustic detection device, establishing a data set, and dividing the data set into a training set, a validation set, and a test set.
[0014] Preferably, in step S2, the sonar data is first converted into the data format of the UP-YOLO model to reduce the amount of data and speed up the model training time.
[0015] Preferably, the UP-YOLO underwater sonar image target detection network model structure in step S3 is specifically as follows:
[0016] S3.1 input layer, normalizes the acquired image to an image of size 640×640×3;
[0017] S3.2Conv convolution layer, Conv module is a basic convolution module; a Conv module consists of three parts: Conv2d, BatchNormal, and SiLU;
[0018] S3.3C2f feature extraction layer. The C2f module is used in the Backbone network, which mainly includes the Conv module, the Bottleneck module and the Concat operation module. The Bottleneck network is mainly composed of two Conv modules connected in series to form the main line, and finally the input is merged into the main line. By fusing n Bottleneck modules, the feature extraction ability of the network can be enhanced and richer gradient flow information can be obtained.
[0019] S3.4 inputs the feature images of four different resolution sizes of the Backbone network into the Neck network;
[0020] S3.5SPPF feature extraction layer takes the feature map output by the feature extraction layer C2f as input and uses the pyramid pooling structure for feature extraction. To a certain extent, it can reduce the amount of model calculation and improve the reasoning speed.
[0021] S3.6 feature fusion layer, takes the feature maps output by the SPPF feature extraction layer and the C2f feature extraction layer as input, and uses the modified AFPN module to fuse features of different scales. This module fuses four different scales, which is conducive to strengthening the feature extraction capability of small targets and the target detection capability of the overall network;
[0022] S3.7 output layer, takes the features of four different scales of the Head network as input, processes these four features, and obtains the target detection results at different scales. The output result is 4*(5+ncls), where ncls is the number of target categories;
[0023] The classification function of the S3.8 target detection algorithm is generally composed of two parts: the classification loss function and the regression loss function; the intersection over union (IOU) is used to measure the overlap between the predicted bounding box and the true bounding box, and calculates the ratio of the intersection area of the predicted box and the true box to the area of their union area. The closer this ratio is to 1, the higher the overlap between the predicted box and the true box, and the more accurate the prediction result; IOU mathematical expression:
[0024]
[0025] Among them, A is the rectangular area of the predicted box, and B is the rectangular area of the real box;
[0026] The YOLOv8 algorithm adopts the form of CIOU_Loss+DFL:
[0027]
[0028] For the regression loss function, CIOU loss not only considers IOU, but also the consistency of center point distance and aspect ratio, so as to more comprehensively evaluate the similarity between the predicted box and the real box; where α is the weight function, b is the coordinate of the center point of the predicted box, and b gt is the coordinate of the center point of the real box, ρ(,) is the Euclidean distance calculation, c is the diagonal length of the minimum bounding box of the predicted box and the real box; v is used to measure the similarity of the aspect ratio of the box; v can be expressed as:
[0029]
[0030] Among them, w gt 、h gt are the width and height of the prediction box, w and h are the width and height of the target box;
[0031] As an important part of the target detection loss function, the bounding box loss function, with its good definition, will bring significant performance improvements to the target detection model. DFL allows the model to quickly focus and converge to the vicinity of the true value, so that the network can focus on the distribution of the target vicinity more quickly. Its calculation formula is:
[0032] DFL=(S i ,S i+1 )=-((y i+1 -y))log(S i )+(yy i log(S i+1 ));
[0033] y is the label value, y i and i+1 are the two values closest to the label value, and S is the probability output value. It can be seen from the formula that the loss is small only when it is closest to the label value.
[0034] Preferably, the design modules of the Wise-IOU loss function include: Wise-IOU uses "outlier degree" instead of IOU to evaluate the quality of anchor boxes, and provides a gradient gain allocation strategy; this strategy reduces the competitiveness of high-quality anchor boxes while also reducing harmful gradients generated by low-quality examples; so that Wise-IOU can focus on anchor boxes of ordinary quality and improve the overall performance of the detector;
[0035] The Wise-IOU loss formula is set as follows:
[0036]
[0037] Among them, IOU is used to measure the overlap between the predicted box and the real box in the target detection task; W i and H i is the width and height of the intersection of the predicted box and the real box, S u It is the total area of the predicted box and the true box, and the definition can be expressed as:
[0038] S u =wh+w gt h gt -W i H i ;
[0039] Where w is the width of the real box, h is the height of the real box, and w gth is the width of the prediction box, h gt is the height of the prediction box, W i H is the width of the intersection of the real box and the predicted box, WH i is the height of the intersection of the real box and the predicted box, and the S calculated from this u It is the total area of the intersection between the real box and the predicted box;
[0040] To overcome the problem when there is no overlap between bounding boxes (W i =0 and H i =0) Gradient vanishing problem, Wise-IOU assigns a small gradient gain to it, so that the bounding box regression focuses on the anchor box of normal quality;
[0041] In order to improve the accuracy of the network and provide stronger robustness for the bounding box of small objects, Wise-IOU is used as the boundary regression loss function to improve the detection performance of the model; Wise-IOU can be expressed as follows: The final loss function is as follows:
[0042]
[0043] Among them, W g and H g The width and height of the minimum bounding box. Increasing them will prevent the prediction box and the target box from overlapping, which is a necessary factor for bounding box regression. is the gradient gain. Keeping this value at a higher value will solve the problem of slow convergence in the later stage. is the outlier degree. The smaller the value, the higher the quality of the predicted anchor box. By adjusting the value of r, more attention can be paid to the target feature information, thus obtaining satisfactory regression accuracy. is a sliding average with momentum m, which is used to dynamically update the normalization factor to keep the gradient gain r at a high level overall, solving the problem of slow convergence in the later stage of training; δ and α are hyperparameters of Wise-IOU. By adjusting their sizes, they can adapt to different data sets and enhance the generalization ability of the model.
[0044] Preferably, in step S3, the overall network architecture of UP-YOLO consists of a backbone part and a head, wherein the backbone part composed of convolution operations, C2f and SPPF modules performs shallow feature extraction on the input sonar image; the head performs deep feature extraction and cross-layer feature fusion by an improved AFPN module and a C2f-ODConv module.
[0045] Preferably, in the step S3, in order to align the dimensions and prepare for feature fusion, in the improvement of the AFPN module, on the basis of the original AFPN module, the C2f-ODConv module is used to replace the original convolution module in the feature transfer process, and the C2f-ODConv module and the bilinear interpolation method are used to upsample the features; different convolution kernels and strides are used to perform downsampling to improve the feature extraction capability for small target detection;
[0046] The improved AFPN module includes: replacing the PAN-FPN structure in the original model with the AFPN architecture, which can integrate more feature information on the feature map with lower resolution, thereby improving the detection performance of small targets in sonar images; in addition, the improved AFPN module is highly repeatable and can continuously repeat the feature fusion process to improve network performance.
[0047] Preferably, the C2f-ODConv module in step S3 includes:
[0048] Firstly, the C2f module obtains rich gradient flow information with the extraction and diversion concepts and residual ideas while maintaining its lightweight characteristics; secondly, the ODConv module adopts a parallel strategy to introduce four complementary attention mechanisms, which provides sufficient performance guarantee for capturing rich contextual clues; combining the advantages of the two, the constructed C2f-ODConv module is more flexible in acquiring the positions of targets of different scales and with large differences in size and shape, ensuring that important information in the feature map is not lost, and finally obtaining a feature map containing rich semantic information, thereby achieving high-precision detection.
[0049] Preferably, step S4 is specifically as follows:
[0050] S4.1 builds a training set. The training set uses the UATD dataset. The entire dataset includes 9,200 images, including ten types of shapes: cube, sphere, cylinder, human model, airplane model, round cage, square cage, iron barrel, tire, and ROV.
[0051] S4.2 performs data augmentation on the data set;
[0052] In order to improve the detection accuracy and robustness of the model, MixUp and CopyPaste data enhancement are performed on the images during the training process; MixUp randomly selects the vectors of two training samples and their corresponding labels, and uses linear interpolation to generate a new vector and corresponding label as enhanced data; CopyPaste mixes the random contents of the two images together and performs random horizontal flipping under the premise of large-scale jitter.
[0053] S4.3 inputs the training set into the UP-YOLO network model, trains the UP-YOLO network model, and obtains the optimally trained UP-YOLO network model;
[0054] S4.4 inputs the data set into the constructed YOLOv8 network model for training. The data input is an image of size 3×640×640, the number of training rounds is 300, the initial learning rate is 0.01, the training batch size is 16, the momentum is 0.937, and the weight decay is 0.0005; finally, the trained model is tested, and the training parameters are continuously adjusted according to the test results to optimize the YOLOv8 network model so that the YOLOv8 network model finally meets the requirements.
[0055] S5 performs target detection on the test set and validation set based on the trained UP-YOLO network model, and outputs the target detection results of underwater sonar images.
[0056] The present invention also discloses an underwater sonar image target detection system based on a neural network, comprising the following steps:
[0057] S1 data acquisition module: uses sonar equipment to collect underwater sonar image data sets;
[0058] S2 image storage module: stores the collected underwater sonar image data in the image storage and sends it to the local server;
[0059] The S3 local server module consists of the following three parts:
[0060] S3.1 performs preprocessing operations on the collected devices and converts the sonar data into the data format of the UP-YOLO model;
[0061] S3.2 uses the C2f-ODConv module in the UP-YOLO network model structure as the feature extraction module, uses the improved AFPN module as the non-neighboring layer feature fusion module, and finally performs classification and recognition;
[0062] S3.3 Analyze the test results and display the test results to determine whether it is necessary to issue an abnormal warning.
[0063] Beneficial effects of the present invention:
[0064] (1) The neural network-based underwater sonar image target detection method of the present invention first constructs a forward-looking sonar image dataset, which contains a large number of underwater sonar images, covering various underwater environments, target types and postures, and provides rich data support for subsequent model training. Based on the dataset, a UP-YOLO underwater sonar image target detection network model is constructed. The model is based on the YOLO series target detection model, introduces multiple innovative modules, uses C2f convolution as a feature extraction module, extracts feature information of different scales in the object area, and optimizes the structure and parameters of the convolution kernel to improve the accuracy and efficiency of feature extraction. The SPPF module is used to adapt the network output, and the network output is adaptively adjusted according to the different scales and target distribution of the input image, thereby improving the detection accuracy. The C2f-ODConv module is used to extract features of different scales of the target, and the model's detection ability for small targets and targets under complex backgrounds is enhanced through multi-scale feature fusion. The improved AFPN module is used to merge feature maps of different scales of non-adjacent layers, and the model's ability to express target features is improved through cross-layer connection and feature fusion. At the same time, the Wise-IOU loss function is introduced to replace the original CIOU classification loss function. The Wise-IOU loss function can better measure the overlap between the predicted box and the true box, speed up the regression speed of the model, and improve the detection accuracy.
[0065] (2) The neural network-based underwater sonar image target detection system of the present invention can accurately identify targets in sonar images using the model of the present invention, and has a better detection effect on small targets. The model has high detection accuracy. It provides a convenient and efficient solution for the fields of marine resource development, underwater target identification, etc. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Figure 1 This is a flow chart of underwater sonar image target detection in the underwater sonar image target detection method based on neural network proposed in Example 1 of the present invention;
[0067] Figure 2 Schematic diagram of the UP-YOLO network model structure of Example 1 of the present invention;
[0068] Figure 3 Schematic diagram of the structure of the AFPN feature fusion module in the UP-YOLO network model structure of Example 1 of the present invention;
[0069] Figure 4 This is a schematic diagram of a C2f-ODConv module improved for the Neck network part according to Embodiment 1 of the present invention;
[0070] Figure 5 This is a schematic diagram of a sonar image according to Embodiment 1 of the present invention;
[0071] Figure 6 Schematic diagram of the loss curve of training data of Example 1 of the present invention;
[0072] Figure 7 A schematic diagram of a confusion matrix of the test results of Example 1 of the present invention;
[0073] Figure 8 This is a schematic diagram of the detection accuracy results of Example 1 of the present invention;
[0074] Fig. 9 This is a schematic diagram of the neural network-based underwater sonar image target detection system proposed in Example 2 of the present invention. DETAILED DESCRIPTION
[0075] In order to make the technical means, creative features and effects achieved by the present invention easy to understand, the technical solutions in the embodiments of the present invention will be further clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0076] Example 1
[0077] The present invention provides a method for underwater sonar image target detection based on a neural network, such as Figure 1 As shown, the following steps are included:
[0078] S1 builds a forward-looking sonar image dataset;
[0079] The specific steps of step S1 are as follows: obtaining the image to be detected through the acoustic detection equipment, establishing a data set, and dividing it into a training set, a validation set, and a test set.
[0080] S2 performs data preprocessing on the image data set, converts the data into the required data format, and performs data enhancement on the data set;
[0081] Since the sonar data is generally binary data with high precision and high integrity, and this data is large, the sonar data is first converted into the data format of the UP-YOLO model to reduce the amount of data and speed up the model training time.
[0082] S3 improves the network YOLOv8 model to the UP-YOLO network model, and builds the UP-YOLO underwater sonar image target detection network structure;
[0083] Combining the improved AFPN module, C2f_ODConv module and Wise-IOU loss function, the UP-YOLO overall network architecture is constructed on the basis of the YOLOv8 network model; the YOLOv8 network model is used as the basic architecture, the C2f-ODConv module is used as the feature extraction module, the improved AFPN module is used as the non-neighboring layer feature fusion module, and the Wise-IOU loss function is set;
[0084] Among them, the C2f-ODConv feature extraction module and the improved AFPN module are mentioned above. Since the original sonar image is mainly composed of small targets, the C2f-ODConv module is added to enhance the feature extraction capability of the model, while promoting the reuse of deep and shallow features to cope with the challenges of complex feature extraction. The improved AFPN module is used to cross-fuse features of different scales, enhance the information interaction between non-adjacent layers, and prevent the loss of shallow key information.
[0085] In addition, based on the YOLOv8 network model, compared with the original feature fusion structure, the improved AFPN module is used to strengthen the feature fusion of different scales and improve the model detection accuracy; the C2f-ODConv module is used to enhance the feature extraction capability and improve the detection accuracy of small targets; and the Wise-IOU loss function is set to improve the detection accuracy of the model.
[0086] The UP-YOLO network model structure consists of a backbone part and a head. The backbone part composed of convolution operations, C2f and SPPF modules performs shallow feature extraction on the input sonar image; the head consists of an improved AFPN module and C2f-ODConv module for deep feature extraction and cross-layer feature fusion.
[0087] In the process of improving the improved AFPN module, in order to align the dimensions and prepare for feature fusion, based on the original AFPN module, the C2f-ODConv module is used to replace the original convolution module during the feature transfer process, and the C2f-ODConv module and bilinear interpolation method are used to upsample the features; different convolution kernels and strides are used to perform downsampling to improve the feature extraction capability for small target detection;
[0088] The improved AFPN module includes: replacing the PAN-FPN structure in the original model with the AFPN architecture, which can integrate more feature information on the feature map with lower resolution, thereby improving the detection performance of small targets in sonar images; in addition, the improved AFPN module is highly repeatable and can continuously repeat the feature fusion process to improve network performance.
[0089] The C2f-ODConv module includes:
[0090] Firstly, the C2f module obtains rich gradient flow information with the extraction and diversion concepts and residual ideas while maintaining its lightweight characteristics; secondly, the ODConv module adopts a parallel strategy to introduce four complementary attention mechanisms, which provides sufficient performance guarantee for capturing rich contextual clues; combining the advantages of the two, the constructed C2f-ODConv module is more flexible in acquiring the positions of targets of different scales and with large differences in size and shape, ensuring that important information in the feature map is not lost, and finally a feature map containing rich semantic information is obtained, thereby achieving high-precision detection.
[0091] like Figure 2 As shown in the figure, the UP-YOLO underwater sonar image target detection network model structure is as follows:
[0092] S3.1 input layer, normalizes the acquired image to an image of size 640×640×3;
[0093] S3.2Conv convolution layer, Conv module is a basic convolution module; a Conv module consists of three parts: Conv2d, BatchNormal, and SiLU;
[0094] S3.3C2f feature extraction layer. The C2f module is used in the Backbone network, which mainly includes the Conv module, the Bottleneck module and the Concat operation module. The Bottleneck network is mainly composed of two Conv modules connected in series to form the main line, and finally the input is merged into the main line. By fusing n Bottleneck modules, the feature extraction ability of the network can be enhanced and richer gradient flow information can be obtained.
[0095] S3.4 inputs the feature images of four different resolution sizes of the Backbone network into the Neck network;
[0096] S3.5SPPF feature extraction layer takes the feature map output by the feature extraction layer C2f as input and uses the pyramid pooling structure for feature extraction. To a certain extent, it can reduce the amount of model calculation and improve the reasoning speed.
[0097] S3.6 feature fusion layer, takes the feature maps output by the SPPF feature extraction layer and the C2f feature extraction layer as input, and uses the improved AFPN module to fuse features of different scales. This module fuses four different scales, which is conducive to enhancing the feature extraction capability of small targets and the target detection capability of the overall network;
[0098] S3.7 output layer, takes the features of four different scales of the Head network as input, processes these four features, and obtains the target detection results at different scales. The output result is 4*(5+ncls), where ncls is the number of target categories;
[0099] The classification function of the S3.8 target detection algorithm is generally composed of two parts: the classification loss function and the regression loss function; the intersection over union (IOU) is used to measure the overlap between the predicted bounding box and the true bounding box, and calculates the ratio of the area of the intersection of the predicted box and the true box to the area of their union; the closer this ratio is to 1, the higher the overlap between the predicted box and the true box, and the more accurate the prediction result; IOU mathematical expression:
[0100]
[0101] Among them, A is the rectangular area of the predicted box, and B is the rectangular area of the real box;
[0102] The YOLOv8 algorithm adopts the form of CIOU_Loss+DFL:
[0103]
[0104] For the regression loss function, CIOU loss not only considers IOU, but also the consistency of center point distance and aspect ratio, so as to more comprehensively evaluate the similarity between the predicted box and the real box; where α is the weight function, b is the coordinate of the center point of the predicted box, and b gt is the coordinate of the center point of the real box, ρ(,) is the Euclidean distance calculation, c is the diagonal length of the minimum bounding box of the predicted box and the real box; v is used to measure the similarity of the aspect ratio of the box; v can be expressed as:
[0105]
[0106] Among them, w gt 、h gt are the width and height of the prediction box, w and h are the width and height of the target box;
[0107] As an important part of the target detection loss function, the bounding box loss function, with its good definition, will bring significant performance improvements to the target detection model. DFL allows the model to quickly focus and converge to the vicinity of the true value, so that the network can focus on the distribution of the target vicinity more quickly. Its calculation formula is:
[0108] DFL=(S i ,S i+1 )=-((y i+1 -y))log(S i )+(yyi log(S i+1 ));
[0109] y is the label value, y i and i+1 are the two values closest to the label value, and S is the probability output value. It can be seen from the formula that the loss is small only when it is closest to the label value.
[0110] The design modules of its Wise-IOU loss function include: Wise-IOU uses "outlier degree" instead of IOU to evaluate the quality of anchor boxes and provides a gradient gain distribution strategy; this strategy reduces the competitiveness of high-quality anchor boxes while also reducing the harmful gradients generated by low-quality examples; this replacement not only improves the performance of bounding box regression, but also reduces the training time of the model; it allows Wise-IOU to focus on anchor boxes of ordinary quality and improve the overall performance of the detector;
[0111] The Wise-IOU loss formula is set as follows:
[0112]
[0113] Among them, IOU is used to measure the overlap between the predicted box and the real box in the target detection task; W i and H i is the width and height of the intersection of the predicted box and the real box, S u It is the total area of the predicted box and the true box, and the definition can be expressed as:
[0114] S u =wh+w gt h gt -W i H i ;
[0115] Where w is the width of the real box, h is the height of the real box, and w gt h is the width of the prediction box, h gt is the height of the prediction box, -W i H is the width of the intersection of the real box and the predicted box, WH i is the height of the intersection of the real box and the predicted box, and the S calculated from this u It is the total area of the intersection between the real box and the predicted box;
[0116] To overcome the problem when there is no overlap between bounding boxes (W i =0 and H i=0) Gradient vanishing problem, Wise-IOU assigns a small gradient gain to it, so that the bounding box regression focuses on the anchor box of normal quality; assigning a smaller gradient gain to the anchor box with large outliers will effectively prevent low-quality examples from generating large harmful gradients;
[0117] In order to improve the accuracy of the network and provide stronger robustness for the bounding box of small objects, Wise-IOU is used as the boundary regression loss function to improve the detection performance of the model; Wise-IOU can be expressed as follows: The final loss function is as follows:
[0118]
[0119] Among them, W g and H g The width and height of the minimum bounding box. Increasing them will prevent the prediction box and the target box from overlapping, which is a necessary factor for bounding box regression. is the gradient gain. Keeping this value at a higher value will solve the problem of slow convergence in the later stage. is the outlier degree. The smaller the value, the higher the quality of the predicted anchor box. By adjusting the value of r, more attention can be paid to the target feature information, thus obtaining satisfactory regression accuracy. is a sliding average with momentum m, which is used to dynamically update the normalization factor to keep the gradient gain r at a high level as a whole, solving the problem of slow convergence in the later stage of training; δ and α are the hyperparameters of Wise-IOU, and by adjusting their sizes, they can adapt to different data sets and enhance the generalization ability of the model; the test experiments conducted on the forward-looking sonar data set show that this algorithm is superior to other methods in terms of mAPs, params and FLOPs.
[0120] S4 performs network training on the UP-YOLO model network based on the training set in the constructed data set;
[0121] The specific steps of S4 are:
[0122] S4.1 builds a training set. The training set uses the UATD dataset, which is collected and organized by Pengcheng Laboratory. The entire dataset includes 9,200 images, including ten types of shapes: cube, sphere, cylinder, human model, airplane model, round cage, square cage, iron barrel, tire, and ROV.
[0123] S4.2 performs data augmentation on the data set;
[0124] Since the data collected by underwater sonar equipment is inevitably affected by the complex environment, such as natural noise caused by waves and ocean currents, biological noise generated by marine organisms, and environmental noise generated by human activities such as fishing activities and ship engines, the received signal is affected by noise, resulting in low image resolution, blurred edge details and severe speckle noise.
[0125] In view of this, in order to improve the detection accuracy and robustness of the model, MixUp and CopyPaste data enhancement are performed on the images during the training process; MixUp randomly selects the vectors of two training samples and their corresponding labels, and uses linear interpolation to generate a new vector and corresponding label as enhanced data; CopyPaste mixes the random contents of the two images together, and performs random horizontal flipping under the premise of large-scale jitter.
[0126] S4.3 inputs the training set into the UP-YOLO network model, trains the UP-YOLO network model, and obtains a trained UP-YOLO network model;
[0127] S4.4 inputs the data set into the constructed YOLOv8 network model for training. The data input is an image of size 3×640×640, the number of training rounds is 300, the initial learning rate is 0.01, the training batch size is 16, the momentum is 0.937, and the weight decay is 0.0005; finally, the trained model is tested, and the training parameters are continuously adjusted according to the test results to optimize the YOLOv8 network model so that the finally constructed UP-YOLO network model meets the requirements.
[0128] S5 performs target detection on the test set and validation set based on the trained UP-YOLO model, and outputs the target detection results of underwater sonar images. Figure 8 As shown, the present invention has a high accuracy rate in underwater sonar image detection and can effectively detect non-cooperative targets.
[0129] Example 2
[0130] Based on Example 1, the present invention proposes an underwater sonar image target detection system based on a neural network, such as Fig. 9 As shown, the following steps are included:
[0131] S1 data acquisition module: uses sonar equipment to collect underwater sonar image data sets;
[0132] S2 image storage module: stores the collected underwater sonar image data in the image storage and sends it to the local server;
[0133] The S3 local server module consists of the following three parts:
[0134] S3.1 performs preprocessing operations on the collected devices and converts the sonar data into the data format of the UP-YOLO model;
[0135] S3.2 uses the C2f-ODConv module in the UP-YOLO network model structure as the feature extraction module, uses the improved AFPN module as the non-neighboring layer feature fusion module, and finally performs classification and recognition;
[0136] S3.3 Analyze the test results and display the test results to determine whether it is necessary to issue an abnormal warning.
[0137] In summary, the underwater sonar image target detection method and system based on neural network of the present invention selects the algorithm of YOLOv8 network model as the basic model, and the enhanced version is named UP-YOLO network model. The algorithm of UP-YOLO network model is improved on the basis of YOLOv8 network model algorithm, and the C2f-ODConv module, the improved AFPN module, and the Wise-IOU loss function are added to improve the detection accuracy of the model. First, the C2f-ODConv module is used to extract feature information of different scales in the object area, so that no useful information is missed, the structure and parameters of the convolution kernel are optimized, and the accuracy and efficiency of feature extraction are improved. Secondly, the improved AFPN module is used to merge feature maps of different scales to capture local details and global background features. Finally, the Wise-IOU loss is applied to improve the regression of the predicted box to the ground truth box, thereby enhancing the robustness of the network model. The experimental results on the data set based on forward-looking sonar images show that the model improves mAP@.5 from 80.3% to 84.4% with almost no increase in the number of model parameters, showing excellent detection performance. It provides effective technical solutions for the fields of marine resource development, underwater target identification, etc.
[0138] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, it is still possible for a person skilled in the art to modify the technical solutions described in the aforementioned embodiments, or to replace some of the technical features therein by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions claimed to be protected by the present invention.
Claims
1. A method for underwater sonar image target detection based on a neural network, characterized in that: The following steps are involved: S1 builds a forward-looking sonar image dataset; S2 performs data preprocessing on the image data set, converts the data into the required data format, and performs data enhancement on the data set; S3 improves the YOLOv8 network model to the UP-YOLO network model, and builds the UP-YOLO underwater sonar image target detection network model structure; Combining the improved AFPN module, C2f-ODConv module and Wise-IOU loss function, the overall network architecture UP-YOLO is constructed on the basis of the YOLOv8 network model; the YOLOv8 network model is used as the basic architecture, the C2f-ODConv module is used as the feature extraction module, the improved AFPN module is used as the non-neighboring layer feature fusion module, and the Wise-IOU loss function is set; S4 performs network training on the UP-YOLO network model based on the training set in the constructed data set; S5 performs target detection on the test set and validation set based on the trained UP-YOLO network model, and outputs the target detection results of underwater sonar images.
2. The method for underwater sonar image target detection based on neural network according to claim 1, characterized in that: The step S1 specifically includes: acquiring the image to be detected by means of an acoustic detection device, establishing a data set, and dividing the data set into a training set, a verification set, and a test set.
3. The method for underwater sonar image target detection based on neural network according to claim 1, characterized in that: In the step S2, the sonar data is first converted into the data format of the UP-YOLO model to reduce the amount of data and speed up the model training time.
4. The method for underwater sonar image target detection based on neural network according to claim 1, characterized in that: The UP-YOLO underwater sonar image target detection network model structure in step S3 is specifically as follows: S3.1 input layer, normalizes the acquired image to an image of size 640×640×3; S3.2Conv convolution layer, Conv module is a basic convolution module; a Conv module consists of three parts: Conv2d, BatchNormal, and SiLU; S3.3C2f feature extraction layer. The C2f module is used in the Backbone network, which mainly includes the Conv module, the Bottleneck module and the Concat operation module. The Bottleneck network is mainly composed of two Conv modules connected in series to form the main line, and finally the input is merged into the main line. By fusing n Bottleneck modules, the feature extraction ability of the network can be enhanced and richer gradient flow information can be obtained. S3.4 inputs the feature maps of four different resolution sizes of the Backbone network into the Neck network; S3.5SPPF feature extraction layer takes the feature map output by the feature extraction layer C2f as input and uses the pyramid pooling structure for feature extraction. To a certain extent, it can reduce the amount of model calculation and improve the reasoning speed. S3.6 feature fusion layer, takes the feature maps output by the SPPF feature extraction layer and the C2f feature extraction layer as input, and uses the improved AFPN module to fuse features of different scales. This module fuses four different scales to enhance the feature extraction capability of small targets and the target detection capability of the overall network; S3.7 output layer, takes the features of four different scales of the Head network as input, processes these four features, and obtains the target detection results at different scales. The output result is 4*(5+ncls), where ncls is the number of target categories; The classification function of the S3.8 target detection algorithm is generally composed of two parts: the classification loss function and the regression loss function; the intersection over union (IOU) is used to measure the overlap between the predicted bounding box and the true bounding box, and calculates the ratio of the area of the intersection of the predicted box and the true box to the area of their union; the closer this ratio is to 1, the higher the overlap between the predicted box and the true box, and the more accurate the prediction result; IOU mathematical expression: Among them, A is the rectangular area of the predicted box, and B is the rectangular area of the real box; The YOLOv8 algorithm adopts the form of CIOU-Loss+DFL: For the regression loss function, CIOU loss not only considers IOU, but also the consistency of center point distance and aspect ratio, so as to more comprehensively evaluate the similarity between the predicted box and the real box; Among them, α is the weight function, b is the coordinate of the center point of the prediction box, and b gt is the coordinate of the center point of the real box, ρ(,) is the Euclidean distance calculation, c is the diagonal length of the minimum bounding box of the predicted box and the real box; v is used to measure the similarity of the aspect ratio of the box; v can be expressed as: Among them, w gt 、h gt are the width and height of the prediction box, w and h are the width and height of the target box; As an important part of the target detection loss function, the bounding box loss function, with its good definition, will bring significant performance improvements to the target detection model. DFL allows the model to quickly focus and converge to the vicinity of the true value, so that the network can focus on the distribution of the target vicinity more quickly. Its calculation formula is: DFL=(S i ,S i+1 )=-((y i+1 -y))log(S i )+(y-y i log(S i+1 )); y is the label value, y i and i+1 are the two values closest to the label value, and S is the probability output value. It can be seen from the formula that the loss is small only when it is closest to the label value.
5. The method for underwater sonar image target detection based on neural network according to claim 4 is characterized in that: The design modules of the Wise-IOU loss function include: Wise-IOU uses "outlier degree" instead of IOU to evaluate the quality of anchor frames, and provides a gradient gain allocation strategy; this strategy reduces the competitiveness of high-quality anchor frames while also reducing harmful gradients generated by low-quality examples; so that Wise-IOU can focus on anchor frames of ordinary quality and improve the overall performance of the detector; The Wise-IOU loss formula is set as follows: Among them, IOU is used to measure the overlap between the predicted box and the real box in the target detection task; W i and H i is the width and height of the intersection of the predicted box and the real box, S u It is the total area of the predicted box and the true box, and the definition can be expressed as: S u =wh+w gt h gt -W i H i ; Where w is the width of the real box, h is the height of the real box, and w gt h is the width of the prediction box, h gt is the height of the prediction box, W i is the width of the intersection of the real box and the predicted box, H i is the height of the intersection of the real box and the predicted box, and the S calculated from this u It is the total area of the intersection between the real box and the predicted box; To overcome the problem when there is no overlap between bounding boxes (W i =0 and H i =0) Gradient vanishing problem, Wise-IOU assigns a small gradient gain to it, so that the bounding box regression focuses on the anchor box of normal quality; In order to improve the accuracy of the network and provide stronger robustness for the bounding box of small objects, Wise-IOU is used as the boundary regression loss function to improve the detection performance of the model; Wise-IOU can be expressed as follows: The final loss function is as follows: Among them, W g and H g The width and height of the minimum bounding box. Increasing them will prevent the prediction box and the target box from overlapping, which is a necessary factor for bounding box regression. is the gradient gain. Keeping this value at a higher value will solve the problem of slow convergence in the later stage. is the outlier degree. The smaller the value, the higher the quality of the predicted anchor box. By adjusting the value of r, more attention can be paid to the target feature information, thus obtaining satisfactory regression accuracy. is a sliding average with momentum m, which is used to dynamically update the normalization factor to keep the gradient gain r at a high level overall, solving the problem of slow convergence in the later stage of training; δ and α are hyperparameters of Wise-IOU. By adjusting their sizes, they can adapt to different data sets and enhance the generalization ability of the model.
6. The method for underwater sonar image target detection based on neural network according to claim 1, characterized in that: In the S3 step, the overall network architecture of UP-YOLO consists of a backbone part and a head, wherein the backbone part composed of convolution operations, C2f and SPPF modules performs shallow feature extraction on the input sonar image; the head performs deep feature extraction and cross-layer feature fusion by the improved AFPN module and C2f-ODConv module.
7. The method for underwater sonar image target detection based on neural network according to claim 1, characterized in that: In the improvement of the AFPN module in step S3, in order to align the dimensions and prepare for feature fusion, based on the original AFPN module, the C2f-ODConv module is used to replace the original convolution module in the feature transfer process, and the C2f-ODConv module and the bilinear interpolation method are used to upsample the features; Use different convolution kernels and strides to perform downsampling to improve the feature extraction capability for small target detection; The improved AFPN module includes: replacing the PAN-FPN structure in the original model with the AFPN architecture, which can integrate more feature information on the feature map with lower resolution, thereby improving the detection performance of small targets in sonar images; in addition, the improved AFPN module is highly repeatable and can continuously repeat the feature fusion process, thereby improving network performance.
8. The method for underwater sonar image target detection based on neural network according to claim 1, characterized in that: The C2f-ODConv module in step S3 includes: Firstly, the C2f module obtains rich gradient flow information by extracting the diversion concept and residual idea while maintaining the lightweight characteristics; secondly, the ODConv module adopts a parallel strategy to introduce four complementary attention mechanisms, which provides sufficient performance guarantee for capturing rich context clues; combining the advantages of the two, the constructed C2f-ODConv module is more flexible in acquiring the positions of targets of different scales and with large differences in size and shape, ensuring that important information in the feature map is not lost, and finally obtaining a feature map containing rich semantic information, thereby improving the accuracy of detection.
9. The method for underwater sonar image target detection based on neural network according to claim 1, characterized in that: The S4 step is specifically as follows: S4.1 builds a training set. The training set uses the UATD dataset. The entire dataset includes 9,200 images, including ten types of shapes: cube, sphere, cylinder, human model, airplane model, round cage, square cage, iron barrel, tire, and ROV. S4.2 performs data augmentation on the data set; In order to improve the detection accuracy and robustness of the model, MixUp and CopyPaste data enhancement are performed on the images during the training process. MixUp randomly selects the vectors of two training samples and their corresponding labels, and uses linear interpolation to generate a new vector and corresponding label as enhanced data. CopyPaste mixes random content from two images together, performs random horizontal flipping under the premise of large-scale dithering; S4.3 inputs the training set into the UP-YOLO network model, trains the UP-YOLO network model, and obtains a trained UP-YOLO network model; S4.4 inputs the data set into the constructed YOLOv8 network model for training. The data input is an image of size 3×640×640, the number of training rounds is 300, the initial learning rate is 0.01, the training batch size is 16, the momentum is 0.937, and the weight decay is 0.0005; finally, the trained model is tested, and the training parameters are continuously adjusted according to the test results to optimize the YOLOv8 network model so that the finally constructed UP-YOLO network model meets the requirements.
10. The underwater sonar image target detection system based on neural network is characterized by: The method for underwater sonar image target detection based on a neural network according to any one of claims 1 to 9 comprises the following steps: S1 data acquisition module: uses sonar equipment to collect underwater sonar image data sets; S2 image storage module: stores the collected underwater sonar image data in the image storage and sends it to the local server; The S3 local server module consists of the following three parts: S3.1 performs preprocessing operations on the collected devices and converts the sonar data into the data format of the UP-YOLO model; S3.2 uses the C2f-ODConv module in the UP-YOLO network model structure as the feature extraction module, uses the improved AFPN module as the non-neighboring layer feature fusion module, and finally performs classification and recognition; S3.3 Analyze the test results and display the test results to determine whether it is necessary to issue an abnormal warning.
Citation Information
Patent Citations
Forward-looking sonar image target detection method and system based on YOLOv5
CN114677602A
Ship target identification method and system based on improved YOLOv5
CN115471729A
Student classroom concentration degree evaluation method, system and device and storage medium
CN116778584A
Method and apparatus for obstacle detection in complex weather
WO2024051296A1
Cited By
Target real-time detection and classification method based on sonar image, medium and system
CN118865003A
A method, medium and system for real-time target detection and classification based on sonar images
CN118865003B
Low, small and slow target detection method based on improved YOLOv10
CN119169280A
Ground target detection method based on adaptive layered gradient feature fusion strategy
CN119206516A
Sonar image underwater detection method and system based on multi-scale feature fusion and college up-sampling algorithm
CN119832406A
