A target detection method and system for sea surface scenes

By using the YOLOv5s model and the gray value matching algorithm of sea antenna detection in the autonomous driving of unmanned boats, and fusing the detection results, the problem of missed detection and inaccurate recognition of sea surface targets is solved, and the recognition ability of sea surface scenes and targets is improved. .

CN118314331BActive Publication Date: 2024-09-13HUNAN UNIV
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202410729790.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-06
Publication Date
2024-09-13
Estimated Expiration
2044-06-06

AI Technical Summary

Technical Problem

In the autonomous driving of unmanned boats, sea surface target detection is prone to problems such as missed detection and inaccurate recognition. In particular, it is difficult to identify new targets that do not appear in the training set.

Method used

The YOLOv5s model is combined with the gray value matching algorithm based on sea antenna detection. Through the detection frame fusion algorithm, the model output detection frame and the gray level matching algorithm output detection frame are fused to improve the recognition ability of sea surface scenes and targets.

Benefits of technology

It reduces the missed detection rate of sea surface target detection, improves the generalization ability of unknown sea surface scenes and targets, and realizes the combination of traditional image processing technology and deep learning technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118314331B
    Figure CN118314331B
Patent Text Reader

Abstract

The invention discloses a target detection method and system for sea surface scenes. The method comprises the following steps: S1. obtaining a model output detection frame; S2. obtaining a grayscale matching algorithm output detection frame; S3. outputting a final detection frame set; fusing the model output detection frame and the grayscale matching algorithm output detection frame according to their intersection-over-union maximum value and a preset intersection-over-union ratio threshold, and outputting a final detection frame set; the system comprises a model output detection frame acquisition module, a grayscale matching algorithm output detection frame acquisition module, and a final detection frame set output module; the invention detects sea surface targets mainly by using YOLOv5 and supplemented by the grayscale matching algorithm, realizes the fusion of traditional image processing technology and deep learning technology, makes full use of the advantages of both, and achieves a lower missed detection rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of sea surface target detection, and in particular to a target detection method and system for sea surface scenes. Background Art

[0002] Autonomous driving of unmanned boats is one of the hot issues in current research, and sea surface target detection is a key link in autonomous driving of unmanned boats, playing a vital role in the entire unmanned boat perception system. The complex and changeable sea surface environment will affect the performance of target detection methods, such as changes in light, water droplets attached to the camera lens, changes in target posture caused by waves, the appearance of unknown hull types, and even sea fog and water reflections.

[0003] In recent years, with the rapid development of deep learning technology, the field of object detection has made great progress, and a number of excellent object detectors have emerged, such as Transformer-based DETR, anchor-free FCOS, one-stage detector YOLOv1-v5, and two-stage detector Faster RCNN. However, from the perspective of balancing accuracy and speed as well as industrial deployment, YOLOv5 is undoubtedly one of the best choices. YOLOv5 absorbs the advantages of YOLOv1~YOLOv4 and incorporates many advanced deep learning technologies, which makes its network structure simple, robust, and can achieve a good balance between detection speed and accuracy. It has always been favored by academia and industry and is widely used in various fields.

[0004] However, target detection that relies solely on deep learning methods has difficulty identifying categories that do not appear in the training set and is prone to missed detections, which makes it difficult for the unmanned boat to avoid obstacles. Summary of the invention

[0005] In view of this, the present invention provides a target detection method and system for sea surface scenes, which are used to at least solve the problems of missed detection and inaccurate recognition in the prior art of target detection for sea surface scenes.

[0006] In order to achieve the above object, the present invention adopts the following technical solution:

[0007] A target detection method for sea surface scenes comprises the following steps:

[0008] S1. Obtain the model output detection frame; input the sea scene image to be detected into the trained YOLOv5s model, and perform sea surface target detection on the sea scene image to be detected through the trained YOLOv5s model to obtain the model output detection frame;

[0009] S2. Obtain the grayscale matching algorithm output detection frame; when the YOLOv5s model has performed K frames of sea scene image to be detected and still has no detection output or the average confidence of the detected sea surface target is lower than the confidence threshold M, perform the grayscale value matching algorithm based on sea-sky line detection, perform sea-sky line detection on the sea scene image to be detected, obtain the seawater area, use the seawater area as a template, filter the sea scene image to be detected as a whole according to the template grayscale value, and obtain the target segmentation area as the grayscale matching algorithm output detection frame;

[0010] S3. Output the final detection frame set; fuse the model output detection frame and the grayscale matching algorithm output detection frame according to the maximum intersection-over-union ratio of the model output detection frame and the grayscale matching algorithm output detection frame and the preset intersection-over-union ratio threshold, and output the final detection frame set.

[0011] Preferably, the specific contents of the training method of the YOLOv5s model in S1 include:

[0012] (1) The sea scene images are divided into a training set and a test set. The main targets of the sea scene images in the training set and the test set are annotated in the form of matrix boxes, and other secondary targets are segmented and annotated in the form of polygons. The main targets and secondary targets are classified according to their sizes relative to the preset target size threshold;

[0013] (2) Perform data augmentation operations on the sea scene images in the training set, including random rotation, random cropping, random scaling, Mosaic, and improved copy-paste methods;

[0014] (3) Select a training strategy and train the YOLOv5s model.

[0015] Preferably, the improved copy-paste method specifically includes:

[0016] Perform a copy-paste operation on each sea scene image in the training set, select a secondary target from the sea scene image, and paste the secondary target to other positions in the sea scene image. In order to make the pasting position reasonable, the pasting position is selected to be randomly pasted near the bottom line position of the annotation box of the main target in the current sea scene image, and the size of the pasted target is randomly scaled to within the preset size range, so as to increase the number of secondary targets;

[0017] Among them, if the target P is pasted onto the target Q, the occluded part of the target Q does not exceed the area threshold of its own detection frame; the number of new images obtained by the copy-paste operation does not exceed the number of original images, and the number of hulls obtained by data enhancement is not greater than the number of original hulls.

[0018] Preferably, the specific content of S2 includes:

[0019] S21. Perform sea-sky-line detection on the sea scene image to be detected, obtain images of the sea area and other areas, and convert the sea scene image from an RGB image to a grayscale image;

[0020] S22. Use the seawater area as a template and calculate the grayscale mean , subtract the grayscale mean from the grayscale image of the sea scene Get the grayscale difference and take the absolute value of the grayscale difference ;

[0021] S23. According to the preset target detection threshold right Binarization is performed to obtain a binary image , which includes background segmentation area and target segmentation area;

[0022] S24. For binary images The noise caused by reflection, tail waves and sea clutter is filtered out to obtain the filtered image ;

[0023] S25. Convert the filtered target segmentation area into the detection box coordinate form.

[0024] Preferably, the conversion formula for converting the sea surface scene image from an RGB image to a grayscale image is:

[0025] .

[0026] Preferably, the binary processing transformation formula is:

[0027] Among them, the area with a grayscale value of 0 represents the background segmentation area, and the area with a grayscale value of 1 represents the target segmentation area.

[0028] Preferably, the noise caused by reflection, tail waves, and sea clutter in the binary image in S24 is assumed to be Gaussian noise, and a Gaussian filtering algorithm is selected to filter out the noise, using a Gaussian function For images Perform convolution calculation to obtain the filtered image :

[0029] .

[0030] The specific contents of the preferred S3 include:

[0031] S31. The model output detection box set is recorded as A, the grayscale matching algorithm output detection box set is recorded as B, and the final detection box set is recorded as C, where C is initially an empty set;

[0032] S32. Determine whether B is an empty set. If B is an empty set and A is also an empty set, directly output C. Otherwise, add the detection box in A to C and output C.

[0033] S33. If B is not an empty set, take out the detection boxes in B one by one and calculate the intersection and union ratio with all the detection boxes in A. Let the intersection and union ratio calculated between the detection box Bi in B and the detection box Ak in A be the largest, denoted as iou_max, and delete Bi from B;

[0034] S34. If iou_max is greater than or equal to the manually set threshold iou_threshold, it is considered that Bi and Ak represent the same target object, and the detection boxes Bi and Ak are weightedly fused to obtain the detection box D, D is added to C and Ak is deleted from A, and C is output;

[0035] If iou_max is less than the preset intersection-and-union ratio threshold iou_threshold, Bi is added to C;

[0036] S35. Execute S32-S34 in a loop.

[0037] Preferably, the specific contents of the weighted fusion of the detection frames Bi and Ak in S34 to obtain the detection frame D include:

[0038] Assume the coordinates of the upper left corner of the Bi detection box are , the coordinates of the lower right corner are , let the coordinates of the upper left corner of the Ak detection box be , the coordinates of the lower right corner are , the coordinates of the upper left corner of the detection box D are , the coordinates of the lower right corner are ;

[0039] Set the weighting factor to , :

[0040] .

[0041] A target detection system for sea surface scenes, comprising:

[0042] The model output detection frame acquisition module is used to input the sea scene image to be detected into the trained YOLOv5s model, and perform sea surface target detection on the sea scene image to be detected through the trained YOLOv5s model to obtain the model output detection frame;

[0043] Grayscale matching algorithm output detection frame acquisition module, used for performing grayscale value matching algorithm based on sea-sky line detection to perform sea-sky line detection on the sea surface scene image to be detected, and obtaining the seawater area, using the seawater area as a template, filtering the sea surface scene image to be detected as a whole according to the grayscale value of the template, and obtaining the target segmentation area as the grayscale matching algorithm output detection frame when the sea surface scene image to be detected by the YOLOv5s model has no detection output after K frames or the confidence of the detected sea surface target is lower than the confidence threshold M on average;

[0044] The final detection frame set output module is used to fuse the model output detection frame and the grayscale matching algorithm output detection frame according to the maximum intersection-over-union ratio of the model output detection frame and the grayscale matching algorithm output detection frame and the preset intersection-over-union ratio threshold, and output the final detection frame set.

[0045] It can be seen from the above technical solutions that, compared with the prior art, the present invention discloses a target detection method and system for sea surface scenes, which has the following beneficial effects:

[0046] This method mainly uses YOLOv5s target detection and grayscale template matching algorithm as a supplement. The detection results of the two algorithms are fused through the detection frame fusion algorithm, which realizes the combination of traditional image processing technology and deep learning technology, reduces the missed detection rate of sea surface target detection, and improves the generalization ability of unknown sea surface scenes and targets. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0048] Figure 1 A schematic diagram of the overall process of the training and target detection method provided by an embodiment of the present invention;

[0049] Figure 2 is a schematic diagram of copy-paste data enhancement provided by an embodiment of the present invention;

[0050] Figure 3 is a flow chart of a template matching algorithm based on sea-sky-line detection provided by an embodiment of the present invention;

[0051] Figure 4 It is a flow chart of a sea-sky-line detection algorithm based on local Otsu segmentation and Hough transform provided by an embodiment of the present invention;

[0052] Figure 5It is a flow chart of a detection frame fusion algorithm provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0053] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0054] The present invention provides a target detection method for sea surface scenes, comprising the following steps:

[0055] S1. Obtain the model output detection frame; input the sea scene image to be detected into the trained YOLOv5s model, and perform sea surface target detection on the sea scene image to be detected through the trained YOLOv5s model to obtain the model output detection frame;

[0056] S2. Obtain the grayscale matching algorithm output detection frame; when the YOLOv5s model has performed K frames of sea scene image to be detected and still has no detection output or the average confidence of the detected sea surface target is lower than the confidence threshold M, perform the grayscale value matching algorithm based on sea-sky line detection, perform sea-sky line detection on the sea scene image to be detected, obtain the seawater area, use the seawater area as a template, filter the sea scene image to be detected as a whole according to the template grayscale value, and obtain the target segmentation area as the grayscale matching algorithm output detection frame;

[0057] S3. Output the final detection frame set; fuse the model output detection frame and the grayscale matching algorithm output detection frame according to the maximum intersection-over-union ratio of the model output detection frame and the grayscale matching algorithm output detection frame and the preset intersection-over-union ratio threshold, and output the final detection frame set.

[0058] It should be noted that:

[0059] When the YOLOv5s model has no detection output after K frames of sea scene images to be detected or the average confidence of the detected sea surface targets is lower than the confidence threshold M, the detection result of YOLOv5s can be considered unreliable. This may be caused by the appearance of new targets on the sea surface that are not included in the training set. At this time, the algorithm executes the gray value matching algorithm to assist YOLOv5s in detection.

[0060] The target detection method for sea scenes disclosed in the present invention needs to train the YOLOv5s model before actual use, and obtain the grayscale matching algorithm output detection frame through the trained model. The overall process of training and target detection method is as follows: Figure 1 shown.

[0061] In order to further implement the above technical solution, the specific contents of the training method of the YOLOv5s model in S1 include:

[0062] (1) The sea scene images are divided into a training set and a test set. The main targets of the sea scene images in the training set and the test set are annotated in the form of matrix boxes, and other secondary targets are segmented and annotated in the form of polygons. The main targets and secondary targets are classified according to their sizes relative to the preset target size threshold;

[0063] (2) Perform data augmentation operations on the sea scene images in the training set, including random rotation, random cropping, random scaling, Mosaic, and improved copy-paste methods;

[0064] (3) Select a training strategy and train the YOLOv5s model.

[0065] It should be noted that:

[0066] In this embodiment, a high-definition camera on an unmanned boat is used to capture high-resolution images of the sea scene, and labelme annotation software is used to annotate the targets in the training set and the test set in the form of a matrix frame, and some secondary targets in the image are segmented and annotated in the form of polygons. In order to improve the secondary target detection capability, the present invention uses an improved copy-paste data enhancement method to copy and paste the secondary targets in the image according to the secondary target segmentation mask annotated in step 1. In this embodiment, the secondary targets are defined as small targets with a size less than 32×32.

[0067] In order to further implement the above technical solution, the improved copy-paste method specifically includes:

[0068] Perform a copy-paste operation on each sea scene image in the training set, select a secondary target from the sea scene image, and paste the secondary target to other positions in the sea scene image. In order to make the pasting position reasonable, the pasting position is selected to be randomly pasted near the bottom line position of the annotation box of the main target in the current sea scene image, and the size of the pasted target is randomly scaled to within the preset size range, so as to increase the number of secondary targets;

[0069] Among them, if the target P is pasted onto the target Q, the occluded part of the target Q does not exceed the area threshold of its own detection frame; the number of new images obtained by the copy-paste operation does not exceed the number of original images, and the number of hulls obtained by data enhancement is not greater than the number of original hulls.

[0070] It should be noted that:

[0071] like Figure 2 As shown, in order to make the pasting position reasonable, the present invention selects the pasting position as the bottom line position of the annotation box of the main target in the current sea scene image for random pasting, rather than pasting at any position in the image. Pasting at any position may cause the detection network to easily misdetect the sky or the coast, thereby improving the false alarm rate of the unmanned boat perception system. In addition, the sizes of these selected secondary targets are randomly scaled to a preset size range, thereby increasing the number of small targets. In this embodiment, the preset size range is set to 16×16 to 64×64, and the detection box area threshold itself is set to 30%. By increasing the probability of target occlusion in the training set, the detection rate of the network detection for the occluded target is improved; the number of new images and the number of hulls obtained by data enhancement are set because the data distribution obtained by the copy-paste operation does not necessarily conform to the real data distribution, and the original real data distribution should be the main one.

[0072] In this embodiment, the specific method of selecting a training strategy and training the YOLOv5s model is as follows:

[0073] 1) Use K-means clustering algorithm to automatically generate initial anchor boxes and use genetic algorithm to adjust the anchor boxes during training;

[0074] 2) Use the pre-trained weights of the official COCO dataset, use the warm-up strategy in the initial stage of training (the first three rounds), and use the periodic cosine annealing strategy in other rounds;

[0075] 3) Use the commonly used Adam as the optimizer and set the learning rate to 0.001.

[0076] 4) Use Binary Cross Entropy Loss (BCELoss) as the loss function for target category and confidence, and use CIoU loss function as the loss function for target bounding box. The mathematical expression of CIoU loss function is as follows:

[0077] in, Represents the prediction box and real frame The intersection ratio of Represents the prediction box and real frame The Euclidean distance between the centers of the two boxes divided by the diagonal distance between the closures of the two boxes, Represents the penalty factor, which makes the aspect ratio of the real box and the predicted box tend to be consistent in the positive direction. is a trade-off parameter, and its expression is as follows:

[0078] in It is a measure of the consistency of aspect ratio, and its expression is as follows:

[0079] in and Represent the width and height of the real frame respectively, and Represent the width and height of the prediction box respectively.

[0080] In order to further implement the above technical solution, the specific contents of S2 include:

[0081] S21. Perform sea-sky-line detection on the sea scene image to be detected, obtain images of the sea area and other areas, and convert the sea scene image from an RGB image to a grayscale image;

[0082] S22. Use the seawater area as a template and calculate the grayscale mean , subtract the grayscale mean from the grayscale image of the sea scene Get the grayscale difference and take the absolute value of the grayscale difference ;

[0083] S23. According to the preset target detection threshold right Binarization is performed to obtain a binary image , which includes background segmentation area and target segmentation area;

[0084] S24. For binary images The noise caused by reflection, tail waves and sea clutter is filtered out to obtain the filtered image ;

[0085] S25. Convert the filtered target segmentation area into the detection box coordinate form.

[0086] It should be noted that:

[0087] like Figure 3 As shown in the figure, the grayscale matching algorithm selected in the present invention is based on the sea-sky line detection algorithm, which segments the seawater area and uses the grayscale value of the seawater as a template for matching, which can effectively distinguish seawater from unknown foreign objects. The sea-sky line detection algorithm selected in the grayscale matching algorithm is a sea-sky line detection based on local Otsu segmentation and Hough transform, such as Figure 4 As shown, the principles of the algorithm include the following:

[0088] 1) Perform longitudinal median filtering on the image. Compared with non-edge-preserving filters such as Gaussian filtering and mean filtering, median filtering can better preserve edge information, reduce the blurring of the sea-sky line edge, and at the same time filter out the influence of light spots, waves and other noise to a certain extent;

[0089] 2) Divide the image into a series of image blocks by column. The image is evenly divided along the column direction The grayscale levels of the same type of pixels in a single image block are fewer and the grayscale consistency is stronger, and various existing noises are dispersed to each image block. This can largely ensure that a single image block is mainly composed of two types of pixels and the grayscale distribution of these two types of pixels has obvious differences, thereby improving the accuracy of the later threshold segmentation.

[0090] 3) Perform Otsu algorithm segmentation on each image block to extract edge information. The principle of Otsu algorithm is: An image of size L has L gray levels, Indicates the gray level is The number of pixels, the value of the normalized histogram ordinate is , set the threshold , the gray value is less than or equal to Pixels with grayscale values ​​greater than The pixels are classified as class B, so that the between-class variance The largest The value is the optimal threshold. The mathematical expression is as follows:

[0091] in, and Respectively represent the proportion of class A pixels and class B pixels, and Respectively represent the grayscale mean of class A pixels and the grayscale mean of class B pixels, is the grayscale mean of the image, and their calculation formulas are:

[0092]

[0093] 4) Extract the edges of the entire image. Use the Otsu threshold segmentation method in step 3) to binarize each image block to obtain a binary image. . Check the binary image along the vertical direction The position where the pixel value suddenly changes. If the value of a pixel is different from that of the adjacent row pixel, the pixel is marked as 1, indicating an edge pixel, otherwise it is set to 0. The mathematical expression is:

[0094] in Represents the "XOR" operation. Traverse the image Get binary edge image .

[0095] 5) Perform Hough transform on the entire image to extract the sea-sky line in the image. The principle of Hough transform is: transform a point in the image coordinate system to a curve in the parameter space, that is, a point in the image coordinate system Corresponding to the curve in parameter space , the curve is parameterized by Determine; if there is a series of points in the image coordinate system , , …, Located on line L: On, the straight line L corresponds to the point on the parameter space Will be voted The most voted The straight line corresponding to the image coordinate system is the sea-sky line. The formula for calculating the number of votes is:

[0096] in, For point The number of votes, is the impulse function.

[0097] In this embodiment, the connected component processing algorithm connectedComponentsWithStats provided in OpenCV is selected to convert the target segmentation area in the image into the detection frame coordinate form.

[0098] In order to further implement the above technical solution, the conversion formula for converting the sea scene image from RGB image to grayscale image is:

[0099] .

[0100] In order to further implement the above technical solution, the binary processing transformation formula is:

[0101] Among them, the area with a grayscale value of 0 represents the background segmentation area, and the area with a grayscale value of 1 represents the target segmentation area.

[0102] In order to further implement the above technical solution, the noise caused by reflection, tail waves and sea clutter in the binary image of S24 is assumed to be Gaussian noise, and the Gaussian filtering algorithm is selected to filter out the noise. For images Perform convolution calculation to obtain the filtered image :

[0103] .

[0104] In order to further implement the above technical solution, Figure 5 As shown, the specific contents of S3 include:

[0105] S31. The model output detection box set is recorded as A, the grayscale matching algorithm output detection box set is recorded as B, and the final detection box set is recorded as C, where C is initially an empty set;

[0106] S32. Determine whether B is an empty set. If B is an empty set and A is also an empty set, directly output C. Otherwise, add the detection box in A to C and output C.

[0107] S33. If B is not an empty set, take out the detection boxes in B one by one and calculate the intersection and union ratio with all the detection boxes in A. Let the intersection and union ratio calculated between the detection box Bi in B and the detection box Ak in A be the largest, denoted as iou_max, and delete Bi from B;

[0108] S34. If iou_max is greater than or equal to the manually set threshold iou_threshold, it is considered that Bi and Ak represent the same target object, and the detection boxes Bi and Ak are weightedly fused to obtain the detection box D, D is added to C and Ak is deleted from A, and C is output;

[0109] If iou_max is less than the preset intersection-and-union ratio threshold iou_threshold, Bi is added to C;

[0110] S35. Execute S32-S34 in a loop.

[0111] In order to further implement the above technical solution, the specific contents of the weighted fusion of the detection frames Bi and Ak in S34 to obtain the detection frame D include:

[0112] Assume the coordinates of the upper left corner of the Bi detection box are , the coordinates of the lower right corner are , let the coordinates of the upper left corner of the Ak detection box be , the coordinates of the lower right corner are , the coordinates of the upper left corner of the detection box D are , the coordinates of the lower right corner are ;

[0113] Set the weighting factor to , :

[0114] .

[0115] A target detection system for sea surface scenes, comprising:

[0116] The model output detection frame acquisition module is used to input the sea scene image to be detected into the trained YOLOv5s model, and perform sea surface target detection on the sea scene image to be detected through the trained YOLOv5s model to obtain the model output detection frame;

[0117] Grayscale matching algorithm output detection frame acquisition module, used for performing grayscale value matching algorithm based on sea-sky line detection to perform sea-sky line detection on the sea surface scene image to be detected, and obtaining the seawater area, using the seawater area as a template, filtering the sea surface scene image to be detected as a whole according to the grayscale value of the template, and obtaining the target segmentation area as the grayscale matching algorithm output detection frame when the sea surface scene image to be detected by the YOLOv5s model has no detection output after K frames or the confidence of the detected sea surface target is lower than the confidence threshold M on average;

[0118] The final detection frame set output module is used to fuse the model output detection frame and the grayscale matching algorithm output detection frame according to the maximum intersection-over-union ratio of the model output detection frame and the grayscale matching algorithm output detection frame and the preset intersection-over-union ratio threshold, and output the final detection frame set.

[0119] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A target detection method for sea surface scenes, characterized in that: The following steps are involved: S1. Obtain the model output detection frame; input the sea scene image to be detected into the trained YOLOv5s model, and perform sea surface target detection on the sea scene image to be detected through the trained YOLOv5s model to obtain the model output detection frame; S2. Obtain the grayscale matching algorithm output detection frame; when the YOLOv5s model performs K frames of sea surface target detection on the sea surface scene image to be detected and still has no detection output or the average confidence of the detected sea surface target is lower than the confidence threshold M, a grayscale value matching algorithm based on sea-sky line detection is performed to perform sea-sky line detection on the sea surface scene image to be detected to obtain the seawater area, and the seawater area is used as a template. The sea surface scene image to be detected is filtered as a whole according to the grayscale value of the template to obtain the target segmentation area as the grayscale matching algorithm output detection frame; the specific contents of S2 include: S21. Perform sea-sky-line detection on the sea scene image to be detected, obtain images of the sea area and other areas, and convert the sea scene image from an RGB image to a grayscale image; S22. Use the seawater area as a template and calculate the grayscale mean T , subtract the grayscale mean from the grayscale image of the sea scene T Get the grayscale difference and take the absolute value of the grayscale difference ; S23. According to the preset target detection threshold right Binarization is performed to obtain a binary image , which includes background segmentation area and target segmentation area; S24. For binary images The noise caused by reflection, tail waves and sea clutter is filtered out to obtain the filtered image ; S25. Convert the filtered target segmentation area into a detection frame coordinate form; S3. Output the final detection frame set; fuse the model output detection frame and the grayscale matching algorithm output detection frame according to the maximum intersection-over-union ratio of the model output detection frame and the grayscale matching algorithm output detection frame and the preset intersection-over-union ratio threshold, and output the final detection frame set; the specific content of S3 includes: S31. The model output detection box set is recorded as A, the grayscale matching algorithm output detection box set is recorded as B, and the final detection box set is recorded as C, where C is initially an empty set; S32. Determine whether B is an empty set. If B is an empty set and A is also an empty set, directly output C. Otherwise, add the detection box in A to C and output C. S33. If B is not an empty set, take out the detection boxes in B one by one and calculate the intersection and union ratio with all the detection boxes in A. Let the intersection and union ratio calculated between the detection box Bi in B and the detection box Ak in A be the largest, denoted as iou_max, and delete Bi from B; S34. If iou_max is greater than or equal to the manually set threshold iou_threshold, it is considered that Bi and Ak represent the same target object, and the detection boxes Bi and Ak are weightedly fused to obtain the detection box D, D is added to C and Ak is deleted from A, and C is output; If iou_max is less than the preset intersection-and-union ratio threshold iou_threshold, Bi is added to C; S35. Execute S32-S34 in a loop.

2. The target detection method for sea surface scenes according to claim 1, characterized in that: The specific contents of the training method of the YOLOv5s model in S1 include: (1) The sea scene images are divided into a training set and a test set. The main targets of the sea scene images in the training set and the test set are annotated in the form of matrix boxes, and other secondary targets are segmented and annotated in the form of polygons. The main targets and secondary targets are classified according to their sizes relative to the preset target size threshold; (2) Perform data augmentation operations on the sea scene images in the training set, including random rotation, random cropping, random scaling, Mosaic, and improved copy-paste methods; (3) Select a training strategy and train the YOLOv5s model.

3. The target detection method for sea surface scenes according to claim 2, characterized in that: The specific contents of the improved copy-paste method include: Perform a copy-paste operation on each sea scene image in the training set, select a secondary target from the sea scene image, and paste the secondary target to other positions in the sea scene image. In order to make the pasting position reasonable, the pasting position is selected to be randomly pasted near the bottom line position of the annotation box of the main target in the current sea scene image, and the size of the pasted target is randomly scaled to within the preset size range, so as to increase the number of secondary targets; Among them, if the target P is pasted onto the target Q, the occluded part of the target Q does not exceed the area threshold of its own detection frame; the number of new images obtained by the copy-paste operation does not exceed the number of original images, and the number of hulls obtained by data enhancement is not greater than the number of original hulls.

4. The target detection method for sea surface scenes according to claim 1, characterized in that: The conversion formula for converting the sea scene image from RGB image to grayscale image is: 。 5. The target detection method for sea surface scenes according to claim 1, characterized in that: The binary transformation formula is: ; Among them, the area with a grayscale value of 0 represents the background segmentation area, and the area with a grayscale value of 1 represents the target segmentation area.

6. The target detection method for sea surface scenes according to claim 1, characterized in that: The noise caused by reflection, tail waves and sea clutter in the binary image of S24 is Gaussian noise. The Gaussian filter algorithm is selected to filter out the noise. The Gaussian function is used For images Perform convolution calculation to obtain the filtered image : , 。 7. The target detection method for sea surface scenes according to claim 1, characterized in that: The specific contents of the detection frame D obtained by weighted fusion of the detection frames Bi and Ak in S34 include: Assume the coordinates of the upper left corner of the Bi detection box are , the coordinates of the lower right corner are , let the coordinates of the upper left corner of the Ak detection box be , the coordinates of the lower right corner are , the coordinates of the upper left corner of the detection box D are , the coordinates of the lower right corner are ; Set the weighting factor to , : 。 8. A target detection system for sea surface scenes, based on a target detection method for sea surface scenes according to any one of claims 1 to 7, characterized in that: include: The model output detection frame acquisition module is used to input the sea scene image to be detected into the trained YOLOv5s model, and perform sea surface target detection on the sea scene image to be detected through the trained YOLOv5s model to obtain the model output detection frame; A grayscale matching algorithm output detection frame acquisition module is used to perform a grayscale value matching algorithm based on sea-sky-line detection to perform sea-sky-line detection on the sea scene image to be detected when the YOLOv5s model performs K frames of sea surface target detection on the sea scene image to be detected and still has no detection output or the average confidence of the detected sea surface target is lower than the confidence threshold M. The sea scene image to be detected is subjected to sea-sky-line detection to obtain the seawater area, and the seawater area is used as a template. The sea scene image to be detected is filtered as a whole according to the grayscale value of the template to obtain the target segmentation area as the grayscale matching algorithm output detection frame; The final detection frame set output module is used to fuse the model output detection frame and the grayscale matching algorithm output detection frame according to the maximum intersection-over-union ratio of the model output detection frame and the grayscale matching algorithm output detection frame and the preset intersection-over-union ratio threshold, and output the final detection frame set.

Citation Information

Patent Citations

  • Sea surface target detection method based on sea-sky line

    CN108846844A

  • Marine ship target identification device and method

    CN113822297A

  • Method for detecting small target based on view angle conversion in sea-sky-line scene

    CN114863258A

  • Unmanned ship platform sea surface ship detection method, system and equipment

    CN116452977A

  • Sea surface target identification method based on visual saliency

    CN117079097A