Marine ship target detection method based on improved YOLOv5

By improving the YOLOV5S network model, the introduction of dynamic snake -shaped convolution and AIFI modules, combining the scale sequence characteristics fusion module, solve the problem of poor robustness in the marine environment and excessive calculation burden. Test.

CN118411606BActive Publication Date: 2025-01-28QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES) +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410544481.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-06
Publication Date
2025-01-28
Estimated Expiration
2044-05-06

AI Technical Summary

Technical Problem

The prior art has poor robustness and long time consuming when detecting targets in marine environments, which can easily cause redundancy in detection windows. The combination of multi-scale features leads to excessive computing burden and insufficient real-time performance.

Method used

Using improved YOLOV5S network models, through the introduction of dynamic snake -shaped convolution (DysnakeConv) and the AIFI module of the mixed encoder in the Backbone's main network, combine the scale sequence characteristics fusion (SSFF) module, improve characteristics extraction and fusion capabilities, and use SHAPE -IOU boundary box loss function is trained.

Benefits of technology

It improves the adaptability and detection performance of the model in different size input, reduce the calculation redundancy, enhance the robustness and real -time nature of the model, and can efficiently detect and identify the ship targets in the marine images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118411606B_ABST
    Figure CN118411606B_ABST
Patent Text Reader

Abstract

A marine ship target detection method based on improved YOLOv5 relates to the field of image recognition technology. Dynamic snake convolution is integrated into the feature extraction network to adapt to input images of different sizes, thereby improving its adaptability to inputs of different sizes, thereby performing feature sequence fusion. An AIFI module is introduced, which is used to perform feature interaction within each scale, reduce computational redundancy and improve detection performance, and enhance the model's understanding of local details. The SSFF module is used to improve the model's sensitivity to spatial context information, can combine feature maps at different levels, fuse spatial and scale features, and aggregate important information at different scales, thereby improving the performance and robustness of the model, focusing on marine target features, and promoting multi-scale feature fusion, thereby efficiently detecting and identifying objects in images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image recognition, and in particular to a method for detecting marine ship targets based on improved YOLOv5. Background Art

[0002] Target detection and recognition are fundamental issues in the field of computer vision. With the increasing number and types of ships, the sea surface ship traffic is becoming increasingly prosperous, which puts forward higher requirements for marine ship warning. At present, my country's technical capabilities in marine information monitoring and early warning are still relatively weak, especially the lack of ability of marine buoys in obtaining visual information, which restricts the diversity and accuracy of marine information monitoring. The complexity and uncertainty of the marine environment make the identification and monitoring of marine targets extremely challenging. There may be many different kinds of breaking waves and large waves on the sea surface at the same time. The movement of these large waves and breaking waves will form many complex textures and shapes, making the marine image appear very chaotic and complex. Traditional target detection algorithms generally use the method of feature plus classifier, which has poor robustness for complex and changeable marine environments with high noise, and is time-consuming and easy to cause detection window redundancy, which is not suitable for current ship detection. Therefore, it is necessary to develop a marine target detection algorithm model based on deep learning.

[0003] At present, although the deformable attention mechanism reduces the computational cost to a certain extent, the combination of multi-scale features will cause a sharp increase in the length of the input sequence, which still leads to a high computational burden on the encoder. At the same time, the existing deep learning-based algorithms extract less target feature information, have a slow detection speed, a large amount of calculation, and are not real-time enough to meet actual needs. Summary of the invention

[0004] In order to overcome the shortcomings of the above technologies, the present invention provides a marine ship target detection method based on improved YOLOv5, which can efficiently detect and identify objects in images.

[0005] The technical solution adopted by the present invention to overcome the technical problems is:

[0006] A method for detecting marine ship targets based on improved YOLOv5 includes the following steps:

[0007] a) Obtain n ocean images and obtain the original ocean target image set B0, where B0 = {B1, B2, ..., B i ,...,B n}, B i is the i-th ocean image, i∈{1,...,n};

[0008] b) For the original sample B of the i-th ocean image iPerform data enhancement operations to obtain the preprocessed ocean image B i ′, n preprocessed ocean images constitute the preprocessed ocean target image set B0′, B0′={B1′,B2′,...,B i ′,...,B n '};

[0009] c) dividing the preprocessed ocean target image set B0′ into a training set, a test set, and a validation set;

[0010] d) Establish an improved YoloV5s network model, which consists of a Backbone network, a Neck network, and an output end;

[0011] e) The i-th preprocessed ocean image B in the training set i ′ is input into the Backbone network of the improved YoloV5s network model, and the output is the feature map B″ Q2-1 ;

[0012] f) The feature map B″ Q2-1 Input into the Neck network of the improved YoloV5s network model, and output the feature map B′ Q4-R-1 ;

[0013] g) The feature map B′ Q4-R-1 Input it into the output end of the improved YoloV5s network model, and output the detection box of the ship in the ocean image.

[0014] Furthermore, in step a), n ocean images are obtained from the Infrared Maritime Ship image dataset.

[0015] Further, step b) comprises the following steps:

[0016] b-1) Take the original sample B of the i-th ocean image i Use the flip function in the OpenCV library in Python to flip horizontally at axis 1;

[0017] b-2) Crop the horizontally flipped image using the getRectSubPix function in the OpenCV library in Python;

[0018] b-3) The cropped image is adjusted for contrast using the convertScaleAbs function in the OpenCV library in Python to obtain the preprocessed ocean image B i ′.

[0019] Furthermore, in step c), the preprocessed ocean target image set B0′ is divided into a training set, a test set, and a validation set in a ratio of 6:3:1.

[0020] Further, step e) comprises the following steps:

[0021] e-1) The Backbone network of the improved YoloV5s network model is composed of a first convolution Conv module, a second convolution Conv module, a first feature extraction layer C3_DySnake module, a third convolution Conv module, a second feature extraction layer C3_DySnake module, a fourth convolution Conv module, a third feature extraction layer C3_DySnake module, a fifth convolution Conv module, a fourth feature extraction layer C3_DySnake module, a sixth convolution Conv module, and an AIFI module of a hybrid encoder. The first convolution Conv module, the second convolution Conv module, the third convolution Conv module, the fourth convolution Conv module, the fifth convolution Conv module, and the sixth convolution Conv module of the Backbone network are sequentially composed of a convolution layer, a Batch Normalization layer, SiLU activation function, the first feature extraction layer C3_DySnake module, the second feature extraction layer C3_DySnake module, the third feature extraction layer C3_DySnake module, and the fourth feature extraction layer C3_DySnake module of the Backbone network are respectively composed of the first convolutional layer, the first Batch Normalization layer, the first SiLU activation function, the second convolutional layer, the second BatchNormalization layer, the second SiLU activation function, and the dynamic snake convolution DySnakeConv;

[0022] e-2) Read the i-th preprocessed ocean image B from the training set using the imread function in the OpenCV library in Python i ′, the i-th preprocessed ocean image B i ′ is input into the first convolution Conv module of the Backbone network, and the output is the feature map B Q1 ;

[0023] e-3) The feature map B Q1 Input into the second convolution Conv module of the Backbone network, and output the feature map B Q1-1 ;

[0024] e-4) The feature map B Q1-1 Input into the first feature extraction layer C3_DySnake module of the Backbone network, and output the feature map B Q1-R ;

[0025] e-5) The feature map B Q1-R Input into the third convolution Conv module of the Backbone network, and output the feature map B′ Q1-R ;

[0026] e-6) The feature map B′ Q1-R Input into the second feature extraction layer C3_DySnake module of the Backbone network, and output the feature map B″ Q1-R ;

[0027] e-7) The feature map B″ Q1-R Input into the fourth convolution Conv module of the Backbone network, and output the feature map B″′ Q1-R ;

[0028] e-8) The feature map B″′ Q1-R Input into the third feature extraction layer C3_DySnake module of the Backbone network, and output the feature map B Q2 ;

[0029] e-9) The feature map B Q2 Input into the fifth convolution Conv module of the Backbone network, and output the feature map B′ Q2 ;

[0030] e-10) The feature map B′ Q2 Input into the fourth feature extraction layer C3_DySnake module of the Backbone network, and output the feature map B″ Q2 ;

[0031] e-11) The feature map B″ Q2 Input into the sixth convolution Conv module of the Backbone network, and output the feature map B″′ Q2 ;

[0032] e-12) The feature map B″′ Q2 Input into the AIFI module of the hybrid encoder of the Backbone network, and output the feature map B″ Q2-1 .

[0033] Preferably, in step e-1), the convolution kernel size of the convolution layer of the first convolution Conv module, the second convolution Conv module, the third convolution Conv module, the fourth convolution Conv module, the fifth convolution Conv module, and the sixth convolution Conv module of the Backbone backbone network are all 3×3, the padding is 1, and the step size is 1; the convolution kernel size of the first convolution layer and the second convolution layer of the first feature extraction layer C3_DySnake module, the second feature extraction layer C3_DySnake module, the third feature extraction layer C3_DySnake module, and the fourth feature extraction layer C3_DySnake module of the Backbone backbone network are all 3×3, the padding is 1, and the step size is 1.

[0034] Further, step f) comprises the following steps:

[0035] f-1) The Neck network of the improved YoloV5s network model consists of the first convolution Conv module, the first feature extraction layer C3_DySnake module, the second convolution Conv module, the third convolution Conv module, the second feature extraction layer C3_DySnake module, the fourth convolution Conv module, the first dynamic snake convolution DySnakeConv, the third feature extraction layer C3_DySnake module, the fifth convolution Conv module, the second dynamic snake convolution DySnakeConv, the fourth feature extraction layer C3_DySnake module, and the scale sequence feature fusion S The first convolution Conv module, the second convolution Conv module, the third convolution Conv module, the fourth convolution Conv module, and the fifth convolution Conv module of the Neck network are sequentially composed of a convolution layer, a BatchNormalization layer, and a SiLU activation function. The first feature extraction layer C3_DySnake module, the second feature extraction layer C3_DySnake module, the third feature extraction layer C3_DySnake module, and the fourth feature extraction layer C3_DySnake module of the Neck network are sequentially composed of a first convolution layer, a first Batch Normalization layer, a first SiLU activation function, a second convolution layer, a second Batch Normalization layer, a second SiLU activation function, and a dynamic snake convolution DySnakeConv;

[0036] f-2) The feature map B″ Q2-1 Input into the first convolution Conv module of the Neck network, and output the feature map B″′ Q2-1-R , the feature map B″ Q2-1-R With feature map B Q2 Perform concatenation operation to obtain feature map B″′ Q2-1-R ;

[0037] f-3) The feature map B″′ Q2-1-R Input to the first feature extraction layer C3_DySnake module of the Neck network, and output the feature map B Q3 ;

[0038] f-4) The feature map B Q3 Input into the second convolution Conv module of the Neck network, and output the feature map B Q3-1 ;

[0039] f-5) The feature map B Q1-R Input into the third convolution Conv module of the Neck network, and output the feature map B Q3-1-R , the feature map B Q3-1-R With the characteristic graph B″ Q1-R Perform concatenation operation to obtain feature map B′ Q3-1-R ;

[0040] f-6) The feature map B′ Q3-1-R Input into the second feature extraction layer C3_DySnake module of the Neck network, and output the feature map B″ Q3-1-R ;

[0041] f-7) The feature map B″ Q3-1-R Input into the fourth convolution Conv module of the Neck network, and output the feature map B″′ Q3-1-R ;

[0042] f-8) The feature map B″′ Q3-1-R Input into the first dynamic snake convolution DySnakeConv of the Neck network, and output the feature map B Q4 , the feature map B Q4 With feature map B Q3-1 Perform concatenation operation to obtain feature map B′ Q4 ;

[0043] f-9) The feature map B′ Q4 Input into the third feature extraction layer C3_DySnake module of the Neck network, and output the feature map B″ Q4 ;

[0044] f-10) The feature map B″ Q4 Input into the fifth convolution Conv module of the Neck network, and output the feature map B″′ Q4 ;

[0045] f-11) The feature map B″′ Q4Input into the second dynamic snake convolution DySnakeConv of the Neck network, and output the feature map B Q4-1 , the feature map B Q4-1 With the characteristic graph B″ Q2-1 Perform concatenation operation to obtain feature map B′ Q4-1 ;

[0046] f-12) The feature map B′ Q4-1 Input into the fourth feature extraction layer C3_DySnake module of the Neck network, and output the feature map B″ Q4-1 ;

[0047] f-13) The feature map B″ Q4-1 Input into the scale sequence feature fusion SSFF module of the Neck network, and output the feature map B′ Q4-R-1 .

[0048] Preferably, in step f-1), the convolution kernel size of the convolution layer of the first convolution Conv module, the second convolution Conv module, the third convolution Conv module, the fourth convolution Conv module, and the fifth convolution Conv module of the Neck network are all 3×3, the padding is 1, and the step size is 1; the convolution kernel size of the first convolution layer and the second convolution layer of the first feature extraction layer C3_DySnake module, the second feature extraction layer C3_DySnake module, the third feature extraction layer C3_DySnake module, and the fourth feature extraction layer C3_DySnake module are all 3×3, the padding is 1, and the step size is 1.

[0049] Furthermore, the output end of the improved YoloV5s network model is the Head output end of the YoloV5s network model.

[0050] Furthermore, it also includes using the Adam optimizer to train the improved YoloV5s network model through the bounding box regression loss Shape-IOU to obtain the optimized improved YoloV5s network model.

[0051] The beneficial effects of the present invention are as follows: first, a dynamic snake convolution (DySnakeConv) is integrated into the feature extraction network, and the C3 module is improved according to the dynamic snake convolution to adapt to input images of different sizes, thereby improving its adaptability to inputs of different sizes, thereby performing feature sequence fusion. Secondly, an AIFI module is introduced, which is used to perform feature interaction within each scale, reduce computational redundancy and improve detection performance, and enhance the model's understanding of local details. The SSFF module is used to improve the model's sensitivity to spatial context information, and can combine feature maps of different levels, integrate spatial and scale features, and aggregate important information at different scales, thereby improving the performance and robustness of the model, focusing on marine target features, and promoting multi-scale feature fusion, thereby efficiently detecting and identifying objects in images, while reducing the number of model parameters. Afterwards, the Shape-IoU bounding box loss function is used, combined with dynamic IoU-aware query selection, by limiting the model to produce high classification scores for features with high IoU scores during training, and to produce low classification scores for features with low IoU scores. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Figure 1 The figure is a flow chart of the method of the present invention. DETAILED DESCRIPTION

[0053] The following is combined with Figure 1 The present invention is further described.

[0054] A method for detecting marine ship targets based on improved YOLOv5 includes the following steps:

[0055] a) Obtain n ocean images and obtain the original ocean target image set B0, where B0 = {B1, B2, ..., B i ,...,B n}, B i is the i-th ocean image, i∈{1,...,n}.

[0056] b) For the original sample B of the i-th ocean image i Perform data enhancement operations to obtain the preprocessed ocean image B i ′, n preprocessed ocean images constitute the preprocessed ocean target image set B0′, B0′={B1′,B2′,...,B i ′,...,B n ′}.

[0057] c) Divide the preprocessed ocean target image set B0′ into a training set, a test set, and a validation set.

[0058] d) Establish an improved YoloV5s network model. The improved YoloV5s network model consists of a Backbone network, a Neck network, and an output end.

[0059] e) The i-th preprocessed ocean image B in the training set i ′ is input into the Backbone network of the improved YoloV5s network model, and the output is the feature map B″ Q2-1 .

[0060] f) The feature map B″ Q2-1 Input into the Neck network of the improved YoloV5s network model, and output the feature map B′ Q4-R-1 .

[0061] g) The feature map B′ Q4-R-1 Input it into the output end of the improved YoloV5s network model, and output the detection box of the ship in the ocean image.

[0062] In order to verify the reliability of this patented method, the final recognition results were systematically evaluated and compared using different methods. The accuracy, recall, average precision mAP@50, and mAP@50:0.95 values ​​were used as evaluation criteria, as shown in Table 1:

[0063] Table 1 Comparison of different detection algorithms

[0064]

[0065] As can be seen from Table 1, the experimental method compares a variety of classic target recognition methods, namely YOLOv5s, YOLOv8s, and TPH-YOLOv5. The evaluation indicators adopt the four most commonly used evaluation indicators for image denoising methods, namely Precision, Recall, mAP@50, and mAP@50:0.95. The higher the Precision value, the better the image recognition effect and the more accurate the recognition. The higher the Recall, the more targets the model can recognize. The higher the mAP50 value, the better the overall performance of the model. The higher the mAP50:0.95, the higher the precision and recall rate can be maintained under a wider range of IOU thresholds. From the data in the table, it can be seen that the Precision evaluation index of the method of the present invention is improved by 0.7% compared with the previous optimal method, the Recall evaluation index is improved by 0.4% compared with the previous optimal method, the mAP50 evaluation index is improved by 2.6% compared with the previous optimal method, and the mAP50:0.95 evaluation index is improved by 1.3% compared with the previous optimal method, all of which are better than the previous methods. This shows that the method of the present invention has certain advantages, and the target recognition effect is relatively ideal, especially the improvement of map50 makes the recognition effect more significant.

[0066] In one embodiment of the present invention, in step a), n ocean images are obtained from an Infrared Maritime Ship image dataset. The publicly available Infrared Maritime Ship dataset includes 7 common object categories and 21,638 instances, and provides 8,402 ship images under different water environments, climate conditions, and shooting times.

[0067] In one embodiment of the present invention, step b) comprises the following steps:

[0068] b-1) Take the original sample B of the i-th ocean image i Use the flip function in the OpenCV library in Python to flip horizontally with axis 1.

[0069] b-2) The horizontally flipped image is cropped using the getRectSubPix function in the OpenCV library in Python.

[0070] b-3) The cropped image is adjusted for contrast using the convertScaleAbs function in the OpenCV library in Python to obtain the preprocessed ocean image B i ′.

[0071] In one embodiment of the present invention, in step c), the preprocessed ocean target image set B0′ is divided into a training set, a test set, and a validation set in a ratio of 6:3:1.

[0072] In one embodiment of the present invention, step e) comprises the following steps:

[0073] e-1) The Backbone network of the improved YoloV5s network model is composed of a first convolution Conv module, a second convolution Conv module, a first feature extraction layer C3_DySnake module, a third convolution Conv module, a second feature extraction layer C3_DySnake module, a fourth convolution Conv module, a third feature extraction layer C3_DySnake module, a fifth convolution Conv module, a fourth feature extraction layer C3_DySnake module, a sixth convolution Conv module, and an AIFI module of a hybrid encoder. The first convolution Conv module, the second convolution Conv module, the third convolution Conv module, the fourth convolution Conv module, the fifth convolution Conv module, and the sixth convolution Conv module of the Backbone network are sequentially composed of a convolution layer, a Batch Normalization layer, SiLU activation function, the first feature extraction layer C3_DySnake module, the second feature extraction layer C3_DySnake module, the third feature extraction layer C3_DySnake module, and the fourth feature extraction layer C3_DySnake module of the Backbone network are respectively composed of the first convolutional layer, the first Batch Normalization layer, the first SiLU activation function, the second convolutional layer, the second BatchNormalization layer, the second SiLU activation function, and the dynamic snake convolution DySnakeConv. The AIFI module of the hybrid encoder is an existing network unit. For details, see the paper entitled "DETRs Beat YOLOs on Real-time Object Detection" published by (Wenyu Lv, Yian Zhao, Shangliang Xu, Jinman Wei, Guanzhong Wang, Cheng Cui Yuning Du, Qingqing Dang, Yi Liu) on December 11, 2023. This is a prior art and will not be repeated here.

[0074] e-2) Read the i-th preprocessed ocean image B from the training set using the imread function in the OpenCV library in Python i ′, the i-th preprocessed ocean image B i ′ is input into the first convolution Conv module of the Backbone network, and the output is the feature map B Q1 .

[0075] e-3) The feature map BQ1 Input into the second convolution Conv module of the Backbone network, and output the feature map B Q1-1 .

[0076] e-4) The feature map B Q1-1 Input into the first feature extraction layer C3_DySnake module of the Backbone network, and output the feature map B Q1-R .

[0077] e-5) The feature map B Q1-R Input into the third convolution Conv module of the Backbone network, and output the feature map B′ Q1-R .

[0078] e-6) The feature map B′ Q1-R Input into the second feature extraction layer C3_DySnake module of the Backbone network, and output the feature map B″ Q1-R .

[0079] e-7) The feature map B″ Q1-R Input into the fourth convolution Conv module of the Backbone network, and output the feature map B″′ Q1-R .

[0080] e-8) The feature map B″′ Q1-R Input into the third feature extraction layer C3_DySnake module of the Backbone network, and output the feature map B Q2 .

[0081] e-9) The feature map B Q2 Input into the fifth convolution Conv module of the Backbone network, and output the feature map B′ Q2 .

[0082] e-10) The feature map B′ Q2 Input into the fourth feature extraction layer C3_DySnake module of the Backbone network, and output the feature map B″ Q2 .

[0083] e-11) The feature map B″ Q2 Input into the sixth convolution Conv module of the Backbone network, and output the feature map B″′ Q2 .

[0084] e-12) The feature map B″′ Q2 Input into the AIFI module of the hybrid encoder of the Backbone network, and output the feature map B″ Q2-1 .

[0085] In this embodiment, in step e-1), the convolution kernel size of the convolution layer of the first convolution Conv module, the second convolution Conv module, the third convolution Conv module, the fourth convolution Conv module, the fifth convolution Conv module, and the sixth convolution Conv module of the Backbone backbone network are all 3×3, the padding is 1, and the step size is 1; the convolution kernel size of the first convolution layer and the second convolution layer of the first feature extraction layer C3_DySnake module, the second feature extraction layer C3_DySnake module, the third feature extraction layer C3_DySnake module, and the fourth feature extraction layer C3_DySnake module of the Backbone backbone network are all 3×3, the padding is 1, and the step size is 1.

[0086] In one embodiment of the present invention, step f) comprises the following steps:

[0087] f-1) The Neck network of the improved YoloV5s network model consists of the first convolution Conv module, the first feature extraction layer C3_DySnake module, the second convolution Conv module, the third convolution Conv module, the second feature extraction layer C3_DySnake module, the fourth convolution Conv module, the first dynamic snake convolution DySnakeConv, the third feature extraction layer C3_DySnake module, the fifth convolution Conv module, the second dynamic snake convolution DySnakeConv, the fourth feature extraction layer C3_DySnake module, and the scale sequence feature fusion S The first convolution Conv module, the second convolution Conv module, the third convolution Conv module, the fourth convolution Conv module and the fifth convolution Conv module of the Neck network are respectively composed of a convolution layer, a BatchNormalization layer and a SiLU activation function. The first feature extraction layer C3_DySnake module, the second feature extraction layer C3_DySnake module, the third feature extraction layer C3_DySnake module and the fourth feature extraction layer C3_DySnake module of the Neck network are respectively composed of a first convolution layer, a first Batch Normalization layer, a first SiLU activation function, a second convolution layer, a second Batch Normalization layer, a second SiLU activation function and a dynamic snake convolution DySnakeConv. The scale sequence feature fusion SSFF module is an existing network unit. For details, see the paper entitled "ASF-YOLO: Anovel YOLO model with attentional scale sequence fusion for cell instances segmentation" published by (Ming Kang, Chee-Ming Ting*, Fung Fung Ting, Rapha¨el C.-W. Phan) on July 6, 2023. This is a prior art and will not be repeated here.

[0088] f-2) The feature map B″ Q2-1 Input into the first convolution Conv module of the Neck network, and output the feature map B″ Q2-1-R , the feature map B″ Q2-1-R With feature map B Q2 Perform concatenation operation to obtain feature map B″′ Q2-1-R .

[0089] f-3) The feature map B″′ Q2-1-R Input to the first feature extraction layer C3_DySnake module of the Neck network, and output the feature map B Q3 .

[0090] f-4) The feature map B Q3 Input into the second convolution Conv module of the Neck network, and output the feature map B Q3-1 .

[0091] f-5) The feature map B Q1-R Input into the third convolution Conv module of the Neck network, and output the feature map B Q3-1-R , the feature map B Q3-1-R With the characteristic graph B″ Q1-R Perform concatenation operation to obtain feature map B′ Q3-1-R .

[0092] f-6) The feature map B′ Q3-1-R Input into the second feature extraction layer C3_DySnake module of the Neck network, and output the feature map B″ Q3-1-R .

[0093] f-7) The feature map B″ Q3-1-R Input into the fourth convolution Conv module of the Neck network, and output the feature map B″′ Q3-1-R .

[0094] f-8) The feature map B″′ Q3-1-R Input into the first dynamic snake convolution DySnakeConv of the Neck network, and output the feature map B Q4 , the feature map B Q4 With feature map B Q3-1 Perform concatenation operation to obtain feature map B′ Q4 .

[0095] f-9) The feature map B′ Q4 Input into the third feature extraction layer C3_DySnake module of the Neck network, and output the feature map B″ Q4 .

[0096] f-10) The feature map B″ Q4 Input into the fifth convolution Conv module of the Neck network, and output the feature map B″′ Q4 .

[0097] f-11) The feature map B″′ Q4 Input into the second dynamic snake convolution DySnakeConv of the Neck network, and output the feature map B Q4-1 , the feature map B Q4-1 With the characteristic graph B″ Q2-1 Perform concatenation operation to obtain feature map B′ Q4-1 .

[0098] f-12) The feature map B′ Q4-1 Input into the fourth feature extraction layer C3_DySnake module of the Neck network, and output the feature map B″ Q4-1 .

[0099] f-13) The feature map B″ Q4-1 Input into the scale sequence feature fusion SSFF module of the Neck network, and output the feature map B′ Q4-R-1 .

[0100] In this embodiment, in step f-1), the convolution kernel size of the convolution layer of the first convolution Conv module, the second convolution Conv module, the third convolution Conv module, the fourth convolution Conv module, and the fifth convolution Conv module of the Neck network are all 3×3, the padding is 1, and the step size is 1; the convolution kernel size of the first convolution layer and the second convolution layer of the first feature extraction layer C3_DySnake module, the second feature extraction layer C3_DySnake module, the third feature extraction layer C3_DySnake module, and the fourth feature extraction layer C3_DySnake module are all 3×3, the padding is 1, and the step size is 1.

[0101] In one embodiment of the present invention, the output end of the improved YoloV5s network model is the Head output end of the YoloV5s network model.

[0102] In one embodiment of the present invention, it also includes using the Adam optimizer to train the improved YoloV5s network model through the bounding box regression loss Shape-IOU to obtain the optimized improved YoloV5s network model. Further, preferably, the number of iterations when training the ocean image denoising network model is 300, the learning rate is set to 0.0001, the learning speed is set to decay to half of the original speed every 20 iterations, and the initial learning rate is set to 1×10 -4 , the batch size is set to 16.

[0103] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A marine ship target detection method based on improved YOLOv5, characterized in that: The steps include: a) Obtain n ocean images and obtain the original ocean target image set B0, where B0 = {B1, B2, ..., B i ,...,B n }, B i is the i-th ocean image, i∈{1,...,n}; b) For the original sample B of the i-th ocean image i Perform data enhancement operations to obtain the preprocessed ocean image B i ′, n preprocessed ocean images constitute the preprocessed ocean target image set B0′, B0′={B1′,B2′,...,B i ′,...,B n '}; c) dividing the preprocessed ocean target image set B0′ into a training set, a test set, and a validation set; d) Establish an improved YoloV5s network model, which consists of a Backbone network, a Neck network, and an output end; e) The i-th preprocessed ocean image B in the training set i ′ is input into the Backbone network of the improved YoloV5s network model, and the feature map B″ is output Q2-1 ; f) The feature map B″ Q2-1 Input into the Neck network of the improved YoloV5s network model, and output the feature map B′ Q4-R-1 ; g) The feature map B′ Q4-R-1 Input it into the output end of the improved YoloV5s network model, and output the detection frame of the ship in the ocean image; Step e) comprises the following steps: e-1) The Backbone network of the improved YoloV5s network model is composed of a first convolution Conv module, a second convolution Conv module, a first feature extraction layer C3_DySnake module, a third convolution Conv module, a second feature extraction layer C3_DySnake module, a fourth convolution Conv module, a third feature extraction layer C3_DySnake module, a fifth convolution Conv module, a fourth feature extraction layer C3_DySnake module, a sixth convolution Conv module, and an AIFI module of a hybrid encoder. The first convolution Conv module, the second convolution Conv module, the third convolution Conv module, the fourth convolution Conv module, the fifth convolution Conv module, and the sixth convolution Conv module of the Backbone network are sequentially composed of a convolution layer, a Batch Normalization layer, SiLU activation function, the first feature extraction layer C3_DySnake module, the second feature extraction layer C3_DySnake module, the third feature extraction layer C3_DySnake module, and the fourth feature extraction layer C3_DySnake module of the Backbone network are respectively composed of the first convolutional layer, the first Batch Normalization layer, the first SiLU activation function, the second convolutional layer, the second BatchNormalization layer, the second SiLU activation function, and the dynamic snake convolution DySnakeConv; e-2) Read the i-th preprocessed ocean image B from the training set using the imread function in the OpenCV library in Python i ′, the i-th preprocessed ocean image B i ′ is input into the first convolution Conv module of the Backbone network, and the output is the feature map B Q1 ; e-3) The feature map B Q1 Input into the second convolution Conv module of the Backbone network, and output the feature map B Q1-1 ; e-4) The feature map B Q1-1 Input into the first feature extraction layer C3_DySnake module of the Backbone network, and output the feature map B Q1-R ; e-5) The feature map B Q1-R Input into the third convolution Conv module of the Backbone network, and output the feature map B′ Q1-R ; e-6) The feature map B′ Q1-R Input into the second feature extraction layer C3_DySnake module of the Backbone network, and output the feature map B′ Q ' 1-R ; e-7) The feature map B′ Q ' 1-R Input into the fourth convolution Conv module of the Backbone network, and output the feature map B′ Q ″ 1-R ; e-8) The feature map B′ Q ″ 1-R Input into the third feature extraction layer C3_DySnake module of the Backbone network, and output the feature map B Q2 ; e-9) The feature map B Q2 Input into the fifth convolution Conv module of the Backbone network, and output the feature map B′ Q2 ; e-10) The feature map B′ Q2 Input into the fourth feature extraction layer C3_DySnake module of the Backbone network, and output the feature map B′ Q ′2; e-11) The feature map B′ Q ′2 is input into the sixth convolution Conv module of the Backbone network, and the output is the feature map B′ Q ″2; e-12) The feature map B′ Q ″2 is input into the AIFI module of the hybrid encoder of the Backbone network, and the output is the feature map B′ Q ' 2-1 .

2. The method for detecting marine vessels based on improved YOLOv5 according to claim 1, characterized in that: In step a), n ocean images are obtained from the Infrared Maritime Ship image dataset.

3. The method for detecting marine vessels based on improved YOLOv5 according to claim 1, characterized in that: Step b) comprises the following steps: b-1) Take the original sample B of the i-th ocean image i Use the flip function in the OpenCV library in Python to flip horizontally at axis 1; b-2) Crop the horizontally flipped image using the getRectSubPix function in the OpenCV library in Python; b-3) The cropped image is adjusted for contrast using the convertScaleAbs function in the OpenCV library in Python to obtain the preprocessed ocean image B i ′.

4. The method for detecting marine vessels based on improved YOLOv5 according to claim 1, characterized in that: In step c), the preprocessed ocean target image set B0′ is divided into a training set, a test set, and a validation set in a ratio of 6:3:

1.

5. The method for detecting marine vessels based on improved YOLOv5 according to claim 1, characterized in that: In step e-1), the convolution kernel size of the convolution layer of the first convolution Conv module, the second convolution Conv module, the third convolution Conv module, the fourth convolution Conv module, the fifth convolution Conv module, and the sixth convolution Conv module of the Backbone backbone network are all 3×3, the padding is 1, and the step size is 1; the convolution kernel size of the first convolution layer and the second convolution layer of the first feature extraction layer C3_DySnake module, the second feature extraction layer C3_DySnake module, the third feature extraction layer C3_DySnake module, and the fourth feature extraction layer C3_DySnake module of the Backbone backbone network are all 3×3, the padding is 1, and the step size is 1.

6. The method for detecting marine vessels based on improved YOLOv5 according to claim 1, characterized in that: Step f) comprises the following steps: f-1) The Neck network of the improved YoloV5s network model is composed of a first convolution Conv module, a first feature extraction layer C3_DySnake module, a second convolution Conv module, a third convolution Conv module, a second feature extraction layer C3_DySnake module, a fourth convolution Conv module, a first dynamic snake convolution DySnakeConv, a third feature extraction layer C3_DySnake module, a fifth convolution Conv module, a second dynamic snake convolution DySnakeConv, a fourth feature extraction layer C3_DySnake module, and a scale sequence feature fusion SSFF module. The first convolution Conv module, the second convolution Conv module, the third convolution Conv module, the fourth convolution Conv module, and the fifth convolution Conv module of the Neck network are each composed of a convolution layer, a Batch layer, and a batch layer. Normalization layer, SiLU activation function, the first feature extraction layer C3_DySnake module, the second feature extraction layer C3_DySnake module, the third feature extraction layer C3_DySnake module, and the fourth feature extraction layer C3_DySnake module of the Neck network are sequentially composed of the first convolutional layer, the first Batch Normalization layer, the first SiLU activation function, the second convolutional layer, the second BatchNormalization layer, the second SiLU activation function, and the dynamic snake convolution DySnakeConv; f-2) The feature map B′ Q ' 2-1 Input into the first convolution Conv module of the Neck network, and output the feature map B′ Q ' 2-1-R , the feature map B′ Q ' 2-1-R With feature map B Q2 Perform concatenation operation to obtain feature map B′ Q ″ 2-1-R ; f-3) The feature map B′ Q ″ 2-1-R Input to the first feature extraction layer C3_DySnake module of the Neck network, and output the feature map B Q3 ; f-4) The feature map B Q3 Input into the second convolution Conv module of the Neck network, and output the feature map B Q3-1 ; f-5) The feature map B Q1-R Input into the third convolution Conv module of the Neck network, and output the feature map B Q3-1-R , the feature map B Q3-1-R With the feature map B′ Q ' 1-R Perform concatenation operation to obtain feature map B′ Q3-1-R ; f-6) The feature map B′ Q3-1-R Input into the second feature extraction layer C3_DySnake module of the Neck network, and output the feature map B′ Q ' 3-1-R ; f-7) The feature map B′ Q ' 3-1-R Input into the fourth convolution Conv module of the Neck network, and output the feature map B′ Q ″ 3-1-R ; f-8) The feature map B′ Q ″ 3-1-R Input into the first dynamic snake convolution DySnakeConv of the Neck network, and output the feature map B Q4 , the feature map B Q4 With feature map B Q3-1 Perform concatenation operation to obtain feature map B′ Q4 ; f-9) The feature map B′ Q4 Input into the third feature extraction layer C3_DySnake module of the Neck network, and output the feature map B′ Q '4; f-10) The feature map B′ Q '4 is input into the fifth convolution Conv module of the Neck network, and the output is the feature map B' Q ″4; f-11) The feature map B′ Q ″4 is input into the second dynamic snake convolution DySnakeConv of the Neck network, and the output is the feature map B Q4-1 , the feature map B Q4-1 With the feature map B′ Q ' 2-1 Perform concatenation operation to obtain feature map B′ Q4-1 ; f-12) The feature map B′ Q4-1 Input into the fourth feature extraction layer C3_DySnake module of the Neck network, and output the feature map B′ Q ' 4-1 ; f-13) The feature map B′ Q ' 4-1 Input into the scale sequence feature fusion SSFF module of the Neck network, and output the feature map B′ Q4-R-1 .

7. The method for detecting marine ship targets based on improved YOLOv5 according to claim 6, characterized in that: In step f-1), the convolution kernel size of the convolution layer of the first convolution Conv module, the second convolution Conv module, the third convolution Conv module, the fourth convolution Conv module, and the fifth convolution Conv module of the Neck network are all 3×3, the padding is 1, and the step size is 1; the convolution kernel size of the first convolution layer and the second convolution layer of the first feature extraction layer C3_DySnake module, the second feature extraction layer C3_DySnake module, the third feature extraction layer C3_DySnake module, and the fourth feature extraction layer C3_DySnake module are all 3×3, the padding is 1, and the step size is 1.

8. The method for detecting marine vessels based on improved YOLOv5 according to claim 1, characterized in that: The output end of the improved YoloV5s network model is the Head output end of the YoloV5s network model.

9. The method for detecting marine vessels based on improved YOLOv5 according to claim 1, characterized in that: It also includes using the Adam optimizer to train the improved YoloV5s network model through the bounding box regression loss Shape-IOU to obtain the optimized improved YoloV5s network model.

Citation Information

Patent Citations

  • Ship target detection method based on improved YOLOv5 deep learning network

    CN117523179A