A ship detection and identification method, device and equipment based on an improved YOLOv5 model

By improving the structure and loss function of the YOLOv5 model, the problems of low accuracy and recall in ship detection in low-light images were solved, especially the difficulty in detecting small targets, thus achieving efficient ship detection and identification.

CN118212545BActive Publication Date: 2026-11-20AEROSPACE INFORMATION RES INST CAS
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410163158.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-02-05
Publication Date
2026-11-20
Estimated Expiration
2044-02-05

AI Technical Summary

Technical Problem

In the existing technology, ship detection and identification methods based on low-light images have problems such as low detection accuracy and recall, especially the difficulty in detecting small targets, and traditional methods cannot effectively utilize the characteristics of high-resolution low-light images.

Method used

The improved YOLOv5 model is optimized to adapt to ship detection in high-resolution low-light images by introducing a small object detection layer, full-dimensional dynamic convolution (ODconv), Shuffle Attention (SA), and a weighted bidirectional feature pyramid (BiFPN) structure, combined with the SIoU loss function.

Benefits of technology

It improves the accuracy and recall rate of ship detection, especially the detection performance of small targets, while reducing the number of model parameters and computational complexity, and realizes rapid detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118212545B_ABST
    Figure CN118212545B_ABST
Patent Text Reader

Abstract

The present application relates to the field of remote sensing image processing and target detection and recognition, and particularly relates to a ship detection and recognition method, device and equipment based on an improved YOLOv5 model. The method comprises: acquiring a faint light ship data set containing a target ship; inputting the faint light ship data set into a backbone network of the improved YOLOv5 model, performing feature extraction through different detection layers, and obtaining a feature layer set processed through different down-sampling multiples, wherein the feature layer set contains a small target feature layer obtained through a low sampling multiple detection layer; inputting the feature layer set with the small target feature layer into a neck network of the improved YOLOv5 model, obtaining a feature map after feature fusion processing; and inputting the feature map into a head network of the improved YOLOv5 model, obtaining a prediction result of the target ship after target prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of remote sensing image processing and target detection and recognition, and in particular to a method, apparatus and equipment for ship detection and recognition based on an improved YOLOv5 model. Background Technology

[0002] In recent years, with the rapid development of the marine economy, the throughput of major ports around the world has been increasing, the number of ships and the density of sea traffic have been increasing, the maritime navigation environment has become increasingly complex, and the number of maritime traffic safety accidents has also increased. Nighttime is a high-incidence period for maritime traffic safety accidents, and many illegal, unregulated and unreported behaviors also occur at night. Strengthening the monitoring of ships on the sea at night is urgent and important, and is of great significance to strengthening maritime ship management, safeguarding my country's marine resource interests and the safety of ship navigation.

[0003] Remote sensing is a science and technology based on electromagnetic wave theory that emerged in the 1960s. It uses various sensors to collect and process the electromagnetic radiation and reflected signals from remote targets or objects. It features a large detection range, fast information acquisition, and long dynamic monitoring time, and is currently widely used in the field of maritime target detection and identification.

[0004] Based on the different characteristics and acquisition methods of remote sensing images, there are currently four main methods for maritime target detection using remote sensing technology: optical remote sensing images, synthetic aperture radar (SAR) images, infrared images, and low-light images. Due to limitations in sensor operating time, optical remote sensing and SAR cannot monitor ships at night. Infrared imaging systems consume a lot of power and have low image resolution, making it difficult to extract detailed target information, which is detrimental to subsequent target identification. Similar to infrared images, most low-light images are also limited by resolution. Low-resolution low-light images can only detect the overall distribution of target situations or a single target, and cannot achieve higher-precision identification. Commonly used methods are simply threshold-based segmentation methods, resulting in low detection accuracy and recall. Moreover, due to data limitations, there is currently very little research on high-resolution low-light images, and many ships appear as small targets in high-resolution low-light images, posing a challenge for small target detection.

[0005] In summary, the commonly used methods for ship detection and identification based on low-light images are still based on the traditional threshold segmentation method, and no deep learning-based detection and identification method has been developed for high-resolution low-light images. Summary of the Invention

[0006] To address the shortcomings of the existing technologies, the present invention aims to provide a ship detection and identification method, apparatus, and equipment based on an improved YOLOv5 model. This method can compensate for the deficiencies in nighttime sea surface monitoring capabilities, enabling the detection and identification of ships in high-resolution low-light images. It improves the accuracy and recall rate of ship detection and identification based on low-light images, especially enhancing the detection performance of small targets, while also increasing the model's detection speed.

[0007] According to the first aspect, the present invention provides a ship detection and identification method based on an improved YOLOv5 model, the overall model framework of which is as follows: Figure 4 As shown, specifically, the method includes the following steps:

[0008] Obtain a low-light vessel dataset containing the target vessel;

[0009] The low-light ship dataset is input into the backbone network of the improved YOLOv5 model, and features are extracted through different detection layers to obtain a set of feature layers after different downsampling factors, including a small target feature layer obtained after processing by a low-sampling factor detection layer.

[0010] The feature layer set with the small target feature layer is input into the neck network of the improved YOLOv5 model, and after feature fusion processing, a feature map is obtained.

[0011] The feature map is input into the head network of the improved YOLOv5 model, and after target prediction, the prediction result of the target ship is obtained.

[0012] Furthermore, in the detection layer of the improved YOLOv5 model backbone network, Omni-Dimensional Dynamic Convolution (ODconv) is used to perform convolution calculations on the input image.

[0013] Furthermore, in the detection layer of the improved YOLOv5 model backbone network, Shuffle Attention (SA) is used for feature capture.

[0014] Furthermore, in the improved YOLOv5 model's neck network, a feature fusion strategy using a weighted bidirectional feature pyramid (BiFPN) structure is employed to perform feature fusion processing on the input feature layer set.

[0015] Furthermore, the low-light ship dataset is obtained through the following steps:

[0016] High-resolution low-light images were collected, and ship targets were labeled using an automatic ship identification system to obtain a low-light ship dataset.

[0017] The low-light ship dataset is split into training, validation, and test datasets.

[0018] Data augmentation was performed on images in the training, validation, and test datasets using mirroring and rotation at different angles;

[0019] The improved YOLOv5 model was trained using the training and validation datasets, and evaluated using the test dataset.

[0020] Furthermore, the improved YOLOv5 model was trained using the training and validation datasets, and the network parameters when the model achieved the best detection performance were saved, resulting in an improved YOLOv5 model suitable for low-light ship detection and recognition.

[0021] Furthermore, the SIoU (SCYLLA Intersection over Union) loss function is used to calculate the regression loss during the training process.

[0022] According to a second aspect, the present invention also provides a ship detection and identification device based on an improved YOLOv5 model, specifically comprising:

[0023] Backbone network unit: configured to extract features from the input low-light ship dataset containing the target ship through different detection layers, and obtain a set of feature layers after downsampling at different multiples, including the small target feature layer obtained after processing by the low-sampling multiple detection layer;

[0024] Neck network unit: configured to perform feature fusion processing on a set of feature layers with small target feature layers to obtain a feature map;

[0025] Head network unit: configured to perform target prediction on the input feature map to obtain the prediction result of the target ship.

[0026] According to a third aspect, the present invention also provides a computing device including a processor and a memory, the processor being configured to execute instructions stored in the memory to perform the method described in the first aspect.

[0027] According to a fourth aspect, the present invention also provides a computer-readable storage medium including computer program instructions, which, when executed by a computing device, perform the method described in the first aspect.

[0028] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0029] This invention first studies and analyzes the characteristics of ship targets in high-resolution low-light images, and then makes a series of targeted improvements to the original YOLOv5 model based on these characteristics. Specifically, these improvements include: introducing a small target detection layer in the backbone network, replacing ordinary convolution with ODconv, adding an SA mechanism, adopting a BiFPN strategy in the neck network, and replacing the CIoU loss function in the original YOLOv5 model with the SIoU loss function during model training. These improvements make the improved model more suitable for ship detection and recognition in high-resolution low-light images, improving the detection performance of ship targets, while also lightweighting the model, reducing the number of parameters and computations, and maintaining the advantage of fast detection speed while improving detection accuracy. Attached Figure Description

[0030] Figure 1 A flowchart illustrating a ship detection and identification method based on an improved YOLOv5 model provided in an embodiment of the present invention;

[0031] Figure 2 This is a schematic diagram illustrating the technical route for the improved original YOLOv5 model provided in the embodiments of the present invention;

[0032] Figure 3 This is a schematic diagram of the original YOLOv5 model framework;

[0033] Figure 4 A schematic diagram of the improved YOLOv5 model framework provided in an embodiment of the present invention;

[0034] Figure 5(a) is a display diagram of the labeled targets of some container ships in the low-light ship data provided in the embodiment of the present invention;

[0035] Figure 5(b) is a display diagram of some small vessel labeled targets in the low-light vessel dataset provided in the embodiment of the present invention;

[0036] Figure 5(c) is a display of the labeled targets of some fishing boats in the low-light vessel dataset provided in the embodiment of the present invention;

[0037] Figure 6 This is a schematic diagram of the ODconv structure provided in an embodiment of the present invention;

[0038] Figure 7 This is a schematic diagram of the SA mechanism provided in an embodiment of the present invention;

[0039] Figure 8 A schematic diagram of the BiFPN structure provided in an embodiment of the present invention;

[0040] Figure 9(a) is a schematic diagram of the SIoU loss function angle cost scheme provided in an embodiment of the present invention;

[0041] Figure 9(b) is a schematic diagram of the SIoU loss function distance cost scheme provided in an embodiment of the present invention;

[0042] Figure 9(c) is a schematic diagram of the SIoU loss function shape cost and IoU cost scheme provided in an embodiment of the present invention;

[0043] Figure 10 The image shows the ship identification and detection results of the improved YOLOv5 model in the experiment provided in this embodiment of the invention;

[0044] Figure 11 The image shows the ship identification and detection results of the original YOLOv5 model in the experiment provided in this embodiment of the invention;

[0045] Figure 12 A schematic diagram of a ship detection and identification device based on an improved YOLOv5 model provided in an embodiment of the present invention;

[0046] Figure 13 This is a schematic diagram of the structure of a computing device provided in an embodiment of the present invention. Detailed Implementation

[0047] This invention proposes a ship detection and identification method, apparatus, and equipment based on an improved YOLOv5 model. To enable those skilled in the art to better understand the present invention, the technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments.

[0048] Figure 3 The framework of the original YOLOv5 model is shown. The original YOLOv5 model is mainly divided into three parts: a backbone network for feature extraction, a neck network for feature enhancement and fusion, and a head network for detection and recognition.

[0049] (1) First, the input image is 640 pixels * 640 pixels in resolution. After being downsampled by different factors in the backbone network, the length, width and number of channels of the three detection layers introduced into the neck network to participate in feature fusion are (80, 80, 256), (40, 40, 512) and (20, 20, 1024), respectively. The larger the downsampling factor, the more information is contained in each position of the feature layer, but the weaker the ability to characterize small targets, and the more blurred the characterization of small targets.

[0050] (2) Secondly, the original YOLOv5 model adopted a feature fusion strategy combining FPN and PANet in the neck network. On the basis of FPN, a bottom-up path was established to fuse stronger semantic information in the high-level feature layer with stronger positional information in the low-level feature layer. This feature fusion is just a simple superposition of feature layers, using Concat or shortcut for connection, without distinguishing between the feature layers loaded at the same time.

[0051] (3) Finally, in the original YOLOv5 model, the input image will be predicted by the head network. When training the model, it is necessary to continuously calculate the loss in the loss function based on the prediction result and the real annotation and backpropagate. The overall loss of the original YOLOv5 model includes three parts: the loss of feature point regression parameters, the confidence loss of whether or not an object is included, and the loss of the type of object included. The original YOLOv5 model uses the CIoU function to calculate the regression loss based on the position information of the real box and the predicted box. However, the CIoU loss function does not consider the orientation matching degree between the real box and the predicted box, which affects the convergence speed and efficiency.

[0052] Corresponding to the above concept, and taking into account the characteristics of ship targets in high-resolution low-light imagery, a series of targeted improvements were made to the original YOLOv5 model based on these characteristics, resulting in an improved YOLOv5 model suitable for low-light ship detection and identification. The following section describes a method for ship detection and identification based on the improved YOLOv5 model, using examples.

[0053] Figure 1 This illustrates a ship detection and identification method based on an improved YOLOv5 model according to an example embodiment of the present invention. (See attached document.) Figure 1 The method specifically includes the following steps:

[0054] S101: Obtain a low-light vessel dataset containing the target vessel.

[0055] S102: Input the low-light ship dataset into the backbone network of the improved YOLOv5 model, extract features through different detection layers, and obtain a set of feature layers after different downsampling factors, including the small target feature layer obtained after processing by the low-sampling factor detection layer.

[0056] Figure 2 This diagram illustrates the technical approach of an improved YOLOv5 model according to an example embodiment of the present invention. (See attached image.) Figure 2 The improvements to the backbone network of the original YOLOv5 model specifically include:

[0057] When performing feature extraction in the backbone network, a fourth detection layer, namely the small target detection layer, is introduced into the neck network for feature fusion.

[0058] In one example, the small object detection layer is located after the first CspLayer module in the backbone network, such as... Figure 3 As shown, when the downsampling factor is 4, the length, width and number of channels of the feature layer are (160, 160, 128). This feature layer has a small downsampling factor and a small receptive field, so it contains rich feature information of small targets. In other examples, the small target detection layer can also be located after other modules in the backbone network, or it can be other downsampling factors. No specific limitation is made here.

[0059] The detection layer is brought out, such as Figure 4 As shown, the newly introduced small target detection layer is incorporated into the neck network to enhance feature fusion. Combined with the three existing detection layers in the original YOLOv5 model in this example, a total of four detection layers are added. The newly introduced small target detection layer is more suitable for detecting and recognizing smaller targets. This modification improves the model's ability to describe the features of small targets, but it increases the number of parameters and computations, thus reducing the detection speed.

[0060] In another embodiment, the backbone network of the original YOLOv5 model can be improved by using ODconv full-dimensional dynamic convolution to perform convolution calculations on the input image. This embodiment specifically includes:

[0061] Use Omni-Dimensional Dynamic Convolution (ODconv) as the convolutional module to replace the ordinary convolutional modules in the backbone network.

[0062] In one example, such as Figure 3 As shown, the backbone network of the original YOLOv5 model contains four ordinary convolutional modules with 128, 256, 512, and 1024 channels, respectively. After convolution, these four modules are input into the CspLayer module, corresponding to four derived feature layers with length, width, and number of channels of (160, 160, 128), (80, 80, 256), (40, 40, 512), and (20, 20, 1024), respectively. The convolutions of these four modules are replaced with ODconv. In other examples, the model may have different numbers of convolutional modules and different convolutional kernel parameters, which are not specifically limited here.

[0063] The structure of ODconv is as follows Figure 6 As shown, this is a dynamic convolution that differs from conventional static convolution. It introduces a multi-dimensional attention mechanism through a parallel policy to learn more flexible attention across the four dimensions of the convolution kernel space, described in the following form:

[0064] y=(α w1 ⊙αf1 ⊙α c1 ⊙α s1 ⊙W1+…+α wn ⊙α fn ⊙α cn ⊙α sn ⊙W n )*x (1)

[0065] Where, α wi Represents the convolution kernel W i The attention scalar, α si ,α ci α fi This represents the three newly introduced attention modules, located along the spatial dimension, the input channel dimension, and the output channel dimension, respectively. These four attention modules employ a multi-head attention module π. i (x) is calculated; for the convolution kernel W i α si Assign different attention values ​​and α to the convolution parameters at k*k spatial locations. ci Different attention values ​​and α are assigned to the convolutional filters of different input channels. fi Different attention values ​​are assigned to the convolutional filters of different output channels, while α wi Then, different values ​​are assigned to the n global convolution kernels; these four types of attention progressively adjust the convolution kernel W. i Multiplying by different attention along dimensions such as position, channel, filter, and kernel makes the convolution operation different for each dimension of the input, improving the feature extraction capability of convolution and making it highly efficient, thus optimizing the number of operations and parameters of the model.

[0066] In another embodiment, to further enhance the model's ability to capture features of the target of interest, Shuffle Attention is used for feature capture in the detection layer. This embodiment specifically includes:

[0067] Before each feature layer is introduced into the neck network, a Shuffle Attention (SA) mechanism is added to highlight the features of the region of interest. The four SA modules are placed after each CspLayer module in the backbone network to perform channel decomposition on the input feature layer. Channel and spatial attention are calculated on the decomposed features to obtain high-level feature representations and capture cross-channel and positional information of the target of interest. Then, Concat and channel permutation operations are performed to restore the number of channels to the size of the input without changing the length, width and number of channels of the input features.

[0068] In one example, such as Figure 4As shown, four SA modules are introduced into the backbone network of the YOLOv5 model, located before each feature layer introduced into the neck network. The number of channels in these four SA modules are 128, 256, 512 and 1024, respectively. The input feature layer enters the neck network after feature capture by the SA modules. In other examples, the introduced SA modules may have other parameter settings depending on the different sampling convolution kernel parameters, which are not specifically limited here.

[0069] Figure 7 A schematic diagram of the SA attention mechanism is given:

[0070] The input features X∈R C×H×W Divide into g groups according to channels: For each group's features, different importance coefficients are generated through the spatial and attention modules, and feature X... K It will be split into two branches along the channel dimension: One branch learns channel attention features, and another branch learns spatial attention features; the channel attention implementation uses the following computation method:

[0071]

[0072] Where H and W are the length and width of the input feature layer, respectively. The summation and averaging of each channel in the feature layer are used to represent the feature information of that channel; then, F... c The calculations are performed, and the attention weights for each channel are generated by activating the sigmoid function.

[0073] X' k1 =σ(F c (s))·X k1 =σ(W1s+b1)·X k1 (3)

[0074] Among them, F c The operation is multiplying s by a matrix. Add another bias

[0075] When calculating spatial attention, Group Norm (GN) is first applied to X. k2 The data is processed to obtain statistical information at the spatial level, and then processed via F... c Enhancements will be made, as described below:

[0076] X' k2 =σ(W2·(X) k2 )+b2)·X k2 (4)

[0077] After calculating the two attention parameters, they are integrated, first by a simple concat operation to obtain the following result: Then, channel permutation is used for component communication; the final output feature layer of the SA module has the same size as the input feature layer, which is computationally efficient and effective. The four feature layers that participate in the SA calculation will enter the neck network for feature fusion in the next step.

[0078] S103: Input the set of feature layers with the small target feature layers into the neck network of the improved YOLOv5 model, and obtain the feature map after feature fusion processing.

[0079] In the neck network of the YOLOv5 model, the input feature layer undergoes feature fusion processing based on a specific feature fusion strategy. This process fuses stronger semantic information from higher-level feature layers with stronger positional information from lower-level feature layers to obtain a feature map.

[0080] In another embodiment, to enhance the performance of the neck network in fusing features at different levels, a feature fusion strategy using a weighted bidirectional feature pyramid structure is employed to perform feature fusion processing on the input set of feature layers in the neck network. This embodiment specifically includes:

[0081] The feature fusion strategy replaces the Feature Pyramid Network (FPN) structure in the neck network with a BiFPN weighted bidirectional feature pyramid structure.

[0082] The BiFPN fusion strategy assigns weights to features at different levels during feature fusion. This strategy learns the importance of feature layers with different resolutions and performs discriminative fusion of different input features, employing a simple and efficient weighted feature fusion mechanism.

[0083]

[0084] Among them, by each w i Then, the ReLU function is applied for activation to ensure that w i ≥0 and ∈=0.0001 is a small value to avoid numerical instability; similarly, the value of each normalized weight is also between 0 and 1, but it is more efficient since there is no softmax operation here.

[0085] Meanwhile, the BiFPN fusion strategy adds a skip connection between input and output nodes at the same scale, such as... Figure 8 As shown; when the number of layers is h, the feature connectivity calculation method corresponding to the same layer is as shown in the formula:

[0086]

[0087]

[0088] Where, mid represents the high-level features being upsampled and connected to the low-level features for fusion, and out represents the fused low-level features being downsampled and connected to the mid features and the input features for fusion, and then used as the output.

[0089] The improved YOLOv5 model performs weighted feature fusion on the four feature layers derived from the backbone network in the neck network as shown above, and then introduces them into the head network for detection and recognition.

[0090] S104: Input the feature map into the head network of the improved YOLOv5 model, and after target prediction, obtain the prediction result of the target ship.

[0091] The input feature map is predicted by the head network of the improved YOLOv5 model to obtain prediction results of different ship targets, and the results are verified by the target detection evaluation index.

[0092] According to another embodiment of the present invention, the method further includes:

[0093] A low-light vessel dataset is obtained, and the dataset is split and augmented to obtain a training dataset, a validation dataset, and a test dataset.

[0094] In one example of this embodiment, SDGSAT-1 satellite 10m resolution low-light image data of the Guangdong-Hong Kong-Macao Greater Bay Area and Shanghai Port Area from November 2011 to October 2022 were first collected, totaling 230 scenes.

[0095] Secondly, a dataset was created based on the collected image data; when labeling the ship categories, the Automatic Identification System (AIS) data of ships at sea within the imaging time range of the image was obtained, and the true category of the ship was determined based on this data;

[0096] (1) The 10m resolution SDGSAT-1 low-light image was cropped to a size of 640 pixels * 640 pixels using a sliding window method;

[0097] (2) Use the Labelimg tool to annotate marine targets in different scenarios (such as pure ocean background, river, near coast, etc.) and different weather backgrounds (such as cloudless, cloudy, etc.).

[0098] The obtained low-light vessel dataset contains 2038 images, including 7553 various maritime targets. Figure 5 shows some of the labeled targets, where Figure 5(a) shows some of the labeled targets of container ships, Figure 5(b) shows some of the labeled targets of small ships, and Figure 5(c) shows some of the labeled targets of fishing boats.

[0099] Next, the low-light ship dataset is split into a training-validation dataset and a test dataset:

[0100] (1) The ratio of the number of images in the training-validation dataset to the test dataset is 9:1;

[0101] (2) Split the training-validation dataset into a training dataset and a validation dataset; wherein the ratio of the number of images in the training dataset and the validation dataset is 9:1;

[0102] Finally, the images in the training, validation, and test datasets were augmented by mirroring and rotating them at different angles to simulate various postures of ships on the sea surface.

[0103] The low-light ship dataset, after data splitting and data augmentation, contains 12,228 images and 45,318 targets. It includes a training dataset, a validation dataset, and a test dataset. The training dataset is used to train the network model, the validation dataset is used to evaluate the training results in real time, and the test dataset is used for the final evaluation of the network model after the model training is completed.

[0104] Furthermore, the improved YOLOv5 model was trained using the training and validation datasets, and the model parameters were updated using the Stochastic Gradient Descent (SGD) optimizer. The network parameters at which the improved YOLOv5 model achieved the best detection performance were saved, resulting in an improved YOLOv5 model suitable for detecting and recognizing ships in low light conditions.

[0105] In another example embodiment, to improve the training speed and inference accuracy of the improved YOLOv5 model, the regression loss during model training can also be calculated using the SIoU loss function. This embodiment specifically includes:

[0106] SIoU replaces CIoU as the loss function. The CIoU loss function used in the original YOLOv5 model did not consider the orientation matching between the ground truth bounding box and the predicted bounding box. The SIoU loss function is optimized based on this and consists of four cost functions: angle cost, distance cost, shape cost, and IoU cost, as shown in Figure 9. Specifically, they include:

[0107] Figure 9(a) shows a schematic diagram of the SIoU loss function angle cost scheme; the formula for calculating the angle cost is as follows:

[0108]

[0109]

[0110]

[0111]

[0112] Where α is the predicted bounding box b gt The angle between the actual bounding box b and the center point, c x With c y These are the x and y coordinates of the center point of the frame, respectively.

[0113] Figure 9(b) illustrates the distance cost scheme for the SIoU loss function; the distance cost is calculated taking into account the angle cost defined above, and the formula is as follows:

[0114] Δ=∑ t=x,y (1-e -γρt) (12)

[0115] in, γ=2-Λ,c w With c h These represent the differences in the x-coordinate and y-coordinate of the center points of the ground truth bounding box and the predicted bounding box, respectively.

[0116] Figure 9(c) illustrates the SIoU loss function, shape cost, and IoU cost schemes; the shape cost formula is as follows:

[0117]

[0118] in, w and h are the width and height of the prediction box; w gt h gt The actual width and height of the bounding box.

[0119] Therefore, the SIoU loss function Loss is calculated. Reg It consists of the above three parts and the IoU loss, and the calculation formula is as follows:

[0120]

[0121]

[0122] Therefore, the overall loss function Loss is calculated as follows:

[0123] Loss = Loss Reg +Lossobj +Loss cls (16)

[0124] Among them, Loss Reg The loss is the SIoU loss function, which measures the regression parameters of the feature points. obj The confidence loss is calculated based on whether or not the object is included; Loss cls Loss due to the types of objects included;

[0125] By calculating the regression loss during the training process through the above steps, and introducing directionality into the loss function, the degrees of freedom can be reduced, making the improved YOLOv5 model converge faster and more accurately during training.

[0126] In this embodiment, model training is performed on a server with the PyTorch framework and CUDA 11.6 computing platform. The server has 128GB of RAM and is equipped with an NVIDIA GeForce RTX3080 GPU. During model training, the SGD optimizer is used to update the model parameters. The initial learning rate is set to 0.01, the weight decay is 0.0005, the momentum is set to 16, the batch size is 16, and the dataset training epochs are 200.

[0127] This embodiment also provides the following experiments and comparative data:

[0128] To objectively and accurately evaluate the detection performance of the model, multiple metrics were used as evaluation criteria. Based on the test dataset, the object detection results of the original YOLOv5 model and the improved YOLOv5 model were compared.

[0129] Since there are multiple categories of targets to be detected, the average AP value (mAP) is used to evaluate the overall detection performance of the model; the frames per second (FPS) is used to evaluate the detection speed of the model; and the number of floating-point operations (FLOPs) and parameters are used to measure the complexity of the model.

[0130] The comparison results between the improved YOLOv5 model and the original YOLOv5 model are shown in Table 1:

[0131] Table 1 Comparison of detection results between the original YOLOv5 model and the improved YOLOv5 model.

[0132]

[0133] Note: GFLOPs = 10 9 FLOPs; 1M = 10 6

[0134] As shown in Table 1, the improved YOLOv5 model significantly enhances the detection performance of small vessels in low-light imagery. The detection performance of the other two types of vessels is also improved, with an overall mAP of 97.0%. While improving detection performance, the model is also lightweight, reducing the number of parameters and computational complexity. Furthermore, the FPS results show that the improved model's detection speed is increased by 18%, meeting real-time requirements. Therefore, the improved YOLOv5 model enhances detection performance while reducing model complexity, providing a new method for achieving high-precision, real-time low-light vessel detection and identification.

[0135] Figure 10 The following figures illustrate the ship identification and detection results of the improved YOLOv5 model in the experiment. Figure 11 The experiment corresponding to Figure 10 The image shows the ship identification and detection results of the original YOLOv5 model in three low-light images. Comparing the detection results of the two models, it can be seen that the improved YOLOv5 model has a new small target detection layer and an attention mechanism, which greatly enhances the detection capability of small targets and improves the problem of high false negative rate of small targets in the original YOLOv5 model. At the same time, the weighted feature fusion and improved loss function during training make the loss calculation and backpropagation process more accurate, thereby alleviating the false detection problem.

[0136] The method provided in this invention, compared to the existing YOLOv5 model, studies and analyzes the characteristics of ship targets in high-resolution low-light images, and makes a series of targeted improvements to the original YOLOv5 model based on these characteristics. This makes the improved YOLOv5 model more suitable for ship detection and recognition in high-resolution low-light images, improving the accuracy and recall rate of ship detection and recognition, especially improving the detection performance of small targets. At the same time, the model is lightweight, reducing the number of parameters and calculations, while still maintaining the advantage of fast detection speed while improving detection accuracy.

[0137] This invention also provides a ship detection and identification device based on an improved YOLOv5 model, which can be deployed on any device or platform with computing and processing capabilities. Figure 12 A schematic diagram of a ship detection and identification device based on an improved YOLOv5 model according to one embodiment is shown.

[0138] like Figure 12 As shown, the device 1200 includes:

[0139] Backbone network unit 1210: configured to extract features from the input low-light ship dataset containing the target ship through different detection layers, and obtain a set of feature layers after downsampling at different multiples, including a small target feature layer obtained after processing by the low-sampling multiple detection layer;

[0140] Neck network unit 1220: configured to perform feature fusion processing on a set of feature layers with small target feature layers to obtain a feature map;

[0141] Head network unit 1230: configured to perform target prediction on the input feature map to obtain the prediction result of the target ship.

[0142] See Figure 13 This invention provides a computing device 1300, including a processor 1310 and a memory 1320. The memory 1320 stores computer instructions. The processor 1310 executes the computer instructions stored in the memory 1320, enabling the computing device 1300 to perform the aforementioned operations. Figure 1 The method embodiment shown.

[0143] It is understood that the processor in the embodiments of this application can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. A general-purpose processor can be a microprocessor or any conventional processor.

[0144] This application also provides a computer storage medium, including computer software instructions, the computer software instructions including those for implementing... Figure 1 The procedure for the method shown. The computer-readable storage medium can be any available medium capable of storing data or a data storage device containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive), etc.

[0145] This application also provides a computer program product, including methods for implementing... Figure 1The program for the method shown. This computer program product is a software or program product capable of running on a processor or stored on any usable medium.

[0146] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of this application.

Claims

1. A ship detection and identification method based on an improved YOLOv5 model, characterized in that, Includes the following steps: A low-light vessel dataset containing the target vessel is obtained by collecting high-resolution low-light images and labeling the vessel targets using an automatic vessel identification system. The low-light ship dataset is input into the backbone network of the improved YOLOv5 model, and features are extracted through different detection layers. In the detection layer, full-dimensional dynamic convolution is used to perform convolution calculation on the input image, and ShuffleAttention is used to capture features to obtain a set of feature layers after downsampling at different multiples, including a small target feature layer obtained after processing by the low-sampling detection layer. The feature layer set with the small target feature layer is input into the neck network of the improved YOLOv5 model, and the input feature layer set is fused using a feature fusion strategy with a weighted bidirectional feature pyramid structure to obtain a feature map. The feature map is input into the head network of the improved YOLOv5 model, and after target prediction, the prediction result of the target ship is obtained.

2. The method according to claim 1, characterized in that, The aforementioned low-light ship dataset is further processed as follows: The low-light ship dataset is split into training, validation, and test datasets. Data augmentation is performed on the images in the training dataset, the validation dataset, and the test dataset by mirroring and rotating them at different angles; The improved YOLOv5 model is trained using the training dataset and the validation dataset, and evaluated using the test dataset.

3. The method according to claim 2, characterized in that, The improved YOLOv5 model was obtained through the following method: The improved YOLOv5 model is trained using the training dataset and the validation dataset. The network parameters when the model achieves the best detection performance are saved to obtain an improved YOLOv5 model suitable for low-light ship detection and recognition.

4. The method according to claim 3, characterized in that, The training of the improved YOLOv5 model also includes: The regression loss during the training process is calculated using the SIoU loss function.

5. A ship detection and identification device based on an improved YOLOv5 model, characterized in that, include: Backbone network unit: configured to extract features from the input low-light ship dataset containing target ships through different detection layers. In the detection layer, full-dimensional dynamic convolution is used to perform convolution calculation on the input image, and Shuffle Attention is used for feature capture to obtain a set of feature layers after downsampling at different multiples, including a small target feature layer obtained after processing by the low-sampling detection layer. The low-light ship dataset is obtained by collecting high-resolution low-light images and labeling ship targets in conjunction with an automatic ship identification system. Neck network unit: configured to perform feature fusion processing on a set of feature layers with small target feature layers using a weighted bidirectional feature pyramid structure to obtain feature maps; Head network unit: configured to perform target prediction on the input feature map to obtain the prediction result of the target ship.

6. A computing device, characterized in that, It includes a processor and a memory, the processor being configured to execute instructions stored in the memory to perform the method of any one of claims 1-4.

7. A computer-readable storage medium, characterized in that, It includes computer program instructions, which, when executed by a computing device, cause the computing device to perform the method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Offshore wind power safety monitoring and early warning method based on machine vision

    CN114529821A