Ship target detection method, device and equipment and storage medium

Through the multi-scale detection head of lightweight convolutional neural network and feature fusion network improved based on attention mechanism, the problem of insufficient ship target detection accuracy in the prior art is solved, and efficient and accurate detection of ship targets of different scales is achieved.

CN119559374APending Publication Date: 2025-03-04WUHAN POLYTECHNIC UNIVERSITY
View PDF 0 Cites 14 Cited by

Patent Information

Application Number
CN202411521265.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

The prior art is difficult to efficiently and accurately detect ship targets of different scales, especially in complex contexts.

Method used

A ship object detection method is proposed. By obtaining the preset ship image data set, the preset object detection model is trained. The model includes a feature extraction network, a feature fusion network and a multi-scale detection head. The feature extraction network is a lightweight convolutional neural network improved based on attention mechanism.

Benefits of technology

The detection accuracy of ship targets at different scales is improved, and the real-time and accuracy of the model is enhanced when processing large-scale image data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119559374A_ABST
    Figure CN119559374A_ABST
Patent Text Reader

Abstract

The invention discloses a ship target detection method, device and equipment and a storage medium, relates to the technical field of image recognition, and discloses a ship target detection method comprising the following steps: obtaining a preset ship image data set; training a preset target detection model based on the preset ship image data set to obtain a ship target detection model, the preset target detection model comprising a feature extraction network, a feature fusion network and a multi-scale detection head which are connected in sequence, the feature extraction network is a lightweight convolutional neural network improved based on an attention mechanism; and obtaining a to-be-detected image, and performing ship target detection on the to-be-detected image through the ship target detection model to obtain a ship target detection result. According to the scheme, the ship target detection model has high real-time performance and accuracy when processing large-scale image data, and the detection precision of ship targets of different scales is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of target detection technology, and in particular to a ship target detection method, device, equipment and storage medium. Background Art

[0002] With the booming global marine economy and the increasing traffic on the sea, it is particularly important to detect ship targets efficiently and accurately. Ship target detection is not only a key technology in the fields of marine traffic monitoring and ship safety management, but also an important basis for realizing intelligent marine management.

[0003] However, ship target detection faces many challenges, such as large differences in target size, variable shapes, and complex backgrounds, which put forward higher requirements on the accuracy and efficiency of the detection algorithm. How to improve the detection accuracy of ship targets of different scales has become a problem to be solved.

[0004] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0005] The main purpose of this application is to provide a ship target detection method, device, equipment and storage medium, aiming to solve the technical problem of how to improve the detection accuracy of ship targets of different scales.

[0006] To achieve the above objectives, the present application proposes a ship target detection method, the method comprising:

[0007] Obtain a preset ship image dataset;

[0008] Based on the preset ship image data set, a preset target detection model is trained to obtain a ship target detection model, wherein the preset target detection model includes a feature extraction network, a feature fusion network, and a multi-scale detection head connected in sequence, and the feature extraction network is a lightweight convolutional neural network improved based on an attention mechanism;

[0009] An image to be detected is acquired, and ship target detection is performed on the image to be detected by using the ship target detection model to obtain a ship target detection result.

[0010] In one embodiment, the step of performing ship target detection on the image to be detected by using the ship target detection model to obtain a ship target detection result includes:

[0011] Extracting features from the image to be detected by the feature extraction network to obtain a multi-scale feature map;

[0012] The multi-scale features are fused through the feature fusion network to obtain a multi-scale feature fusion graph;

[0013] The multi-scale detection head performs ship target detection on the multi-scale feature fusion image to obtain a ship target detection result.

[0014] In one embodiment, the feature extraction network includes a preliminary feature extraction layer, a deep feature extraction layer, a multi-scale pooling layer, and a feature enhancement layer connected in sequence;

[0015] The step of extracting features from the image to be detected by the feature extraction network to obtain a multi-scale feature map includes:

[0016] Performing preliminary feature extraction on the image to be detected through the preliminary feature extraction layer to obtain a preliminary feature map;

[0017] Performing deep feature extraction on the preliminary feature map through the deep feature extraction layer to obtain a local feature map;

[0018] Performing multi-scale pooling on the local feature map through the multi-scale pooling layer to obtain a multi-channel feature map;

[0019] The spatial information and channel information of the multi-channel feature map are enhanced by the feature enhancement layer to obtain a multi-scale feature map.

[0020] In one embodiment, the preliminary feature extraction layer includes a convolution layer, a normalization layer, and an activation function;

[0021] The step of performing preliminary feature extraction on the image to be detected through the preliminary feature extraction layer to obtain a preliminary feature map comprises:

[0022] Extracting local features of the image to be detected through the convolution layer to obtain a local feature map;

[0023] Performing batch normalization on the local feature map through the normalization layer to obtain a standardized local feature map;

[0024] The standardized local feature map is nonlinearly processed by the activation function to obtain a preliminary feature map.

[0025] In one embodiment, the step of enhancing the spatial information and channel information of the multi-channel feature map by the feature enhancement layer to obtain a multi-scale feature map includes:

[0026] Extracting spatial information of the multi-channel feature map by decomposing horizontal coordinates and vertical coordinates;

[0027] Extracting channel information of the multi-channel feature map through global average pooling and global maximum pooling;

[0028] Determine the channel attention weight and the spatial attention weight of the multi-channel feature map through the feature enhancement layer;

[0029] The spatial information and the channel information are enhanced according to the channel attention weight and the spatial attention weight to obtain a multi-scale feature map.

[0030] In one embodiment, the step of training a preset target detection model based on the preset ship image data set to obtain a ship target detection model includes:

[0031] Training a preset target detection model based on the preset ship image data set to obtain an initial training result and an initial target detection model;

[0032] Calculating a bounding box regression loss function value during training based on the initial training result;

[0033] The parameters of the initial target detection model are adjusted based on the bounding box regression loss function value to obtain a ship target detection model.

[0034] In one embodiment, the step of calculating the bounding box regression loss function value during the training process based on the initial training result includes:

[0035] Acquire the predicted frame coordinates and the real frame coordinates of the preset ship image data set based on the initial training result;

[0036] Calculate the target distance based on the predicted frame coordinates and the real frame coordinates;

[0037] A bounding box regression loss function value is calculated during training based on the target distance.

[0038] In addition, to achieve the above-mentioned purpose, the present application also proposes a ship target detection device, the ship target detection device comprising:

[0039] A data acquisition module, used to acquire a preset ship image data set;

[0040] A model training module, used for training a preset target detection model based on the preset ship image data set to obtain a ship target detection model, wherein the preset target detection model includes a feature extraction network, a feature fusion network and a multi-scale detection head connected in sequence, and the feature extraction network is a lightweight convolutional neural network improved based on an attention mechanism;

[0041] The target detection module is used to acquire the image to be detected, and perform ship target detection on the image to be detected through the ship target detection model to obtain a ship target detection result.

[0042] In addition, to achieve the above-mentioned purpose, the present application also proposes a ship target detection device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, and the computer program is configured to implement the steps of the ship target detection method described above.

[0043] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the ship target detection method described above are implemented.

[0044] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the ship target detection method described above are implemented.

[0045] One or more technical solutions proposed in this application have at least the following technical effects:

[0046] A preset ship image data set is obtained, and a preset target detection model is trained based on the preset ship image data set to obtain a ship target detection model, wherein the preset target detection model includes a feature extraction network, a feature fusion network and a multi-scale detection head connected in sequence, and the feature extraction network is a lightweight convolutional neural network improved based on the attention mechanism. An image to be detected is obtained, and ship target detection is performed on the image to be detected through the ship target detection model to obtain a ship target detection result. By combining the lightweight convolutional neural network improved based on the attention mechanism, the feature fusion network and the multi-scale detection head, the model detection speed is improved while the consumption of computing resources is reduced, so that the ship target detection model has strong real-time performance and accuracy when processing large-scale image data, and the detection accuracy of ship targets of different scales is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0048] In order to more clearly illustrate the embodiments of the present application 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, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0049] Figure 1 A schematic diagram of a process flow provided for the first embodiment of the ship target detection method of the present application;

[0050] Figure 2 A diagram of the YOLOv8 algorithm model architecture provided in Example 1 of the ship target detection method of this application;

[0051] Figure 3 The MobileNetV3 network architecture diagram provided for the first embodiment of the ship target detection method of this application;

[0052] Figure 4 An improved YOLOv8 algorithm model architecture diagram provided for the first embodiment of the ship target detection method of this application;

[0053] Figure 5 A schematic diagram of a flow chart provided for the second embodiment of the ship target detection method of the present application;

[0054] Figure 6 The center overlap diagram of the predicted frame and the real frame provided in the second embodiment of the ship target detection method of the present application;

[0055] Figure 7 A visualization result diagram of ship target detection provided in Example 2 of the ship target detection method of this application;

[0056] Figure 8 This is a schematic diagram of the module structure of the ship target detection device according to an embodiment of the present application;

[0057] Fig. 9 Schematic diagram of the device structure of the hardware operating environment involved in the ship target detection method in the embodiment of the present application.

[0058] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0059] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0060] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0061] It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a ship target detection device, etc. The following takes the ship target detection device as an example to illustrate this embodiment and the following embodiments.

[0062] Based on this, the present application embodiment provides a ship target detection method, referring to Figure 1 , Figure 1This is a YOLOv8 algorithm model architecture diagram provided in Example 1 of the ship target detection method of this application.

[0063] In this embodiment, the ship target detection method includes steps S10 to S40:

[0064] Step S10, obtaining a preset ship image data set.

[0065] It should be understood that the ship image dataset contains multiple types of ship images, and is accompanied by the location information (such as bounding boxes) and category labels (such as tankers, cargo ships, etc.) of the ships in each image, which are used to train a preset target detection model (such as a target detection model built based on the YOLOv8 algorithm model) to obtain a ship target detection model, so that the model can learn how to identify and classify different types of ships.

[0066] For example, the preset ship image dataset can be the HRSC2016 dataset released by Northwestern Polytechnical University in 2016, which contains aerial images extracted from Google Earth. The dataset mainly focuses on ships at sea and near the coast, specifically including 27 types of remote sensing ground objects, which mainly include various types of ships such as cargo ships, fishing boats, etc. After manually removing the submarine label, a total of 2976 ship instance information is included. The image size ranges from 300x300 to 1500x900, and most images are larger than 1000x600.

[0067] Step S20, training a preset target detection model based on the preset ship image data set to obtain a ship target detection model, wherein the preset target detection model includes a feature extraction network, a feature fusion network, and a multi-scale detection head connected in sequence, and the feature extraction network is a lightweight convolutional neural network improved based on an attention mechanism.

[0068] It should be noted that the preset target detection model can be a target detection model built based on the improved YOLOv8 algorithm model. Figure 2 , Figure 2 This is a YOLOv8 algorithm model architecture diagram provided in Example 1 of the ship target detection method of this application. Figure 2As shown in Figure 1, the core of the YOLOv8 algorithm model includes four main modules: input end, backbone network (i.e. BackBone), Neck end and output end. Specifically, the YOLOv8 algorithm model uses a variety of preprocessing techniques (such as Mosaic data enhancement, adaptive image scaling and grayscale filling, etc.) at the input end to enhance the quality and diversity of input images. Among them, Mosaic data enhancement can increase the generalization ability of the model by combining four images to create a new training sample. Adaptive image scaling is used to ensure that the image meets the input size requirements of the model while maintaining the aspect ratio of the image. Grayscale filling is used to deal with the size mismatch problem of the image. The backbone network of the YOLOv8 algorithm model extracts image features through convolution, pooling and other methods through Conv, C2f and SPPF (Spatial Pyramid Pooling Fast) modules. The Neck end of the YOLOv8 algorithm model is based on the PAN (Path Aggregation Network) structure design. Through upsampling, downsampling and feature splicing and other technologies, low-level and high-level feature information can be effectively combined, thereby enhancing the feature representation ability of the model. The output end of the YOLOv8 algorithm model uses a decoupled head structure to decouple classification and regression tasks (such as bounding box regression), allowing the model to focus more on its respective tasks and improve detection accuracy and efficiency.

[0069] Furthermore, in terms of positive and negative sample matching, the YOLOv8 algorithm model uses the TaskAlignedAssigner method, which determines positive samples based on the weighted results of the classification score and the regression score, thereby optimizing the sample distribution. The loss calculation includes the classification loss and regression loss calculation. For the classification task, the BCE (Binary Cross-Entropy) loss function is used to calculate the classification loss; for the regression task, the DFL (Deep Feature Loss) and CIoU (Complete Intersection over Union) loss functions are used to calculate the regression loss. The YOLOv8 algorithm model uses the BCE loss function, the DFL loss function, and the CIoU loss function to improve the overlap between the predicted box and the true box, thereby improving the accuracy of target detection.

[0070] In addition, it should be noted that the preset target detection model includes a feature extraction network, a feature fusion network and a multi-scale detection head connected in sequence, and the feature extraction network is a lightweight convolutional neural network improved based on the attention mechanism. Among them, the feature extraction network is used to extract feature information that is helpful for subsequent ship target detection from the images provided by the preset ship image data set to obtain a multi-scale feature map. After extracting features of different scales through the feature extraction network, the multi-layer features in the multi-scale feature map can be combined through the feature fusion network to extract rich contextual information and obtain a multi-scale feature fusion map. The multi-scale detection head uses different detection heads to process feature maps of different scales, which can improve the detection capability of ships of various sizes.

[0071] It should be noted that the lightweight convolutional neural network used in the feature extraction network can be MobileNetV3. For details, please refer to Figure 3 , Figure 3 The MobileNetV3 network architecture diagram provided for the first embodiment of the ship target detection method of this application. MobileNetV3 is a lightweight convolutional neural network architecture designed to meet the needs of mobile terminals and embedded devices for efficient image recognition. It uses technologies such as deep separable convolution, lightweight convolution layers, and layer-by-layer channel expansion, which can significantly reduce the amount of calculation and parameters while maintaining the accuracy of the model. Specifically, the bneck module of MobileNetV3 introduces two key components: the inverted residual structure and separable convolution. The inverted residual structure increases the nonlinear capability by adding a dilated convolution layer before the bottleneck layer, thereby improving the expressive power of the model. The separable convolution decomposes the standard convolution operation into depth convolution and point-by-point convolution to reduce the amount of calculation and the number of parameters.

[0072] In addition, it should be noted that the improvement of the YOLOv8 algorithm model in this embodiment is to replace the Conv and C2f connection parts of the backbone network of the YOLOv8 algorithm model with the Conv_BN_HSwish layer and the stacked bneck module connection part of the lightweight convolutional neural network MobileNetV3, and add the CoordAtt module that introduces the coordinate attention mechanism after the SPPF module. For details, please refer to Figure 4 , Figure 4 This is an improved YOLOv8 algorithm model architecture diagram provided in the first embodiment of the ship target detection method of this application. Figure 4As shown in the figure, the Conv_BN_HSwish layer is used to perform preliminary processing on the input image, including convolution operations, batch normalization, and H-Swish activation functions. A series of bneck modules increase the network depth through residual connections, which can improve feature extraction capabilities while avoiding the gradient vanishing problem. The CoordAtt module enhances the spatial and channel information in the feature map by introducing spatial coordinates and channel attention mechanisms, allowing the network to better capture the location information of the target object.

[0073] Step S30, acquiring an image to be detected, and performing ship target detection on the image to be detected by using the ship target detection model to obtain a ship target detection result.

[0074] It should be understood that the image to be detected can be a scene image containing a ship target collected in real time. The ship target detection model is obtained after training with a preset ship image data set. After acquiring the image to be detected, the feature extraction network, feature fusion network and multi-scale detection head of the ship target detection model will sequentially perform feature extraction, feature fusion and target detection operations on the image to be detected, output multiple bounding boxes, and obtain the ship target detection result. The bounding box is used to indicate the position information of the ship target in the image.

[0075] In a feasible implementation manner, the step of performing ship target detection on the image to be detected by using the ship target detection model in step S30 to obtain a ship target detection result may include steps S31 to S33:

[0076] Step S31, extracting features from the image to be detected through the feature extraction network to obtain a multi-scale feature map.

[0077] It should be noted that the feature extraction network may include a Conv_BN_HSwish layer, a stacked bneck module, an SPPF module, and a CoordAtt module connected in sequence. After the image to be detected is input into the feature extraction network, the multi-scale feature map obtained after being processed by the Conv_BN_HSwish layer, the stacked bneck module, the SPPF module, and the CoordAtt module in sequence can provide rich context information for the subsequent ship target detection task.

[0078] In a feasible implementation, the feature extraction network includes a preliminary feature extraction layer, a deep feature extraction layer, a multi-scale pooling layer, and a feature enhancement layer connected in sequence, and step S31 may include steps A11 to A13:

[0079] Step A11, performing preliminary feature extraction on the image to be detected through the preliminary feature extraction layer to obtain a preliminary feature map.

[0080] It should be understood that the preliminary feature extraction layer can be a Conv_BN_HSwish layer. When the image to be detected is input into the feature extraction network, after reaching the Conv_BN_HSwish layer, the image to be detected will be sequentially subjected to convolution operations, batch normalization, and the introduction of activation functions to obtain a preliminary feature map. The preliminary feature map condenses the spatial information of the image to be detected, but retains rich local feature information, such as edges, corners, textures, etc.

[0081] In a feasible implementation, the preliminary feature extraction layer includes a convolution layer, a normalization layer and an activation function, and step A11 may include: performing local feature extraction on the image to be detected through the convolution layer to obtain a local feature map; performing batch normalization on the local feature map through the normalization layer to obtain a standardized local feature map; performing nonlinear processing on the standardized local feature map through the activation function to obtain a preliminary feature map.

[0082] It should be noted that after the image to be detected is input into the preliminary feature extraction layer, i.e., the Conv_BN_HSwish layer, it will first pass through a Conv layer (i.e., a convolution layer), which will extract local features of the ship target image from the input image to be detected, such as edges, textures, and shapes, and convert the pixel values ​​of the image to be detected into feature values ​​to obtain a local feature map. After being processed by the convolution layer, the normalization layer will normalize the local feature map output by the convolution layer, standardize the data of each channel, so that the mean of each feature channel is close to 0 and the variance is close to 1, and obtain a standardized local feature map to reduce the change of the feature value and accelerate convergence. After being processed by the normalization layer, the standardized local feature map will be nonlinearly transformed by the activation function, so that the model can capture the nonlinear characteristics of the local feature map and obtain a preliminary feature map. Specifically, the activation function can be the H-Swish activation function, which is an improvement on the ReLU activation function and can enhance the nonlinear expression ability of the model, especially the lightweight model on mobile devices.

[0083] Step A12: performing deep feature extraction on the preliminary feature map through the deep feature extraction layer to obtain a local feature map.

[0084] It should be understood that the deep feature extraction layer can be a stacked backneck module. After the preliminary feature extraction layer performs preliminary feature extraction on the image to be detected, the preliminary feature map obtained retains the low-order features of the image such as edges, textures, and shapes, and the stacked backneck module will further extract higher-level and more complex features such as local structures from the preliminary feature map through deep separable convolution and residual structure to obtain a local feature map.

[0085] It should be noted that each bneck module contains a point-by-point convolution layer, a depth-wise convolution layer, and another point-by-point convolution layer in sequence. Among them, the point-by-point convolution layer (such as a 1x1 convolution layer) is used to compress the number of channels of the input preliminary feature map to reduce the computational complexity; the depth-wise convolution layer (such as a 3x3 convolution layer or a larger convolution layer) is used to process the feature map in the spatial dimension and extract local features; another point-by-point convolution layer (such as a 1x1 convolution layer) is used to expand the number of channels of the intermediate feature map back to the original number to retain and restore sufficient feature information. By stacking multiple Bneck modules to capture more complex features, feature information can be retained while reducing computational complexity.

[0086] Step A13: performing multi-scale pooling on the local feature map through the multi-scale pooling layer to obtain a multi-channel feature map.

[0087] It should be understood that the multi-scale pooling layer can be an SPPF module. After the local feature map is input into the SPPF module, the features of different scales of the local feature map will be captured through the multi-scale pooling operation to obtain a multi-channel feature map. The feature representation of the local feature map is mainly concentrated in the local area, and the receptive field is small, while the multi-channel feature map integrates the features of large, medium and small receptive fields, contains rich global and contextual information (not only limited to the features of the ship target itself, but also the background features around the ship target), has a stronger multi-scale feature representation capability, a larger receptive field, and is more suitable for processing ship targets of different scales in complex scenes. The detection capability of the model can be improved through the multi-scale pooling operation of the SPPF module.

[0088] Step A14, enhancing the spatial information and channel information of the multi-channel feature map through the feature enhancement layer to obtain a multi-scale feature map.

[0089] It should be understood that the feature enhancement layer can be a CoordAtt module, in which a coordinate attention mechanism, namely, the CA attention mechanism, is introduced. By extracting spatial information and channel information from the input multi-channel feature map, and performing enhancement processing based on spatial coordinates and channel attention, the obtained multi-scale feature map enhances the spatial positioning capability of the model, which is particularly suitable for complex scenes and ship target detection tasks that require high-precision positioning.

[0090] In a feasible implementation, step A14 may include: extracting the spatial information of the multi-channel feature map by decomposing horizontal coordinates and vertical coordinates; extracting the channel information of the multi-channel feature map by global average pooling and global maximum pooling; determining the channel attention weight and spatial attention weight of the multi-channel feature map through the feature enhancement layer; enhancing the spatial information and the channel information according to the channel attention weight and the spatial attention weight to obtain a multi-scale feature map.

[0091] It should be noted that after inputting the multi-channel feature map, the horizontal coordinate and vertical coordinate of the multi-channel feature map will be decomposed to obtain a horizontal coordinate map and a vertical coordinate map. The horizontal coordinate map is used to represent the horizontal coordinate of each position of the feature map, and the vertical coordinate map is used to represent the vertical coordinate of each position of the feature map. The horizontal coordinate map and the vertical coordinate map constitute the spatial information of the multi-channel feature map.

[0092] In addition, it should be noted that after global average pooling, the feature map of each channel can be aggregated into a single value by averaging, the global features of the channel can be extracted, and the global average information of all elements of the multi-channel feature map can be obtained. After global maximum pooling, the maximum value can be extracted from each channel to obtain the global maximum information of all elements of the multi-channel feature map. The global average information and the global maximum information constitute the channel information of the multi-channel feature map.

[0093] It should be understood that after obtaining the spatial information and channel information of the multi-channel feature map, the CoordAtt module combines the global average information and the global maximum information, generates channel attention weights through a fully connected layer, and concatenates the spatial information containing the horizontal coordinate map and the vertical coordinate map with the multi-channel feature map, and calculates the spatial attention map through convolution operations, that is, the spatial attention weights of the multi-channel feature map F. The channel attention weights are applied to the multi-channel feature map, and the feature map of each channel is multiplied by the corresponding attention weights to obtain the feature map after enhancing the important channels. The spatial attention weights are applied to the spatial dimensions of the feature map after enhancing the important channels, and each position of the feature map is weighted to obtain a multi-scale feature map with enhanced spatial information.

[0094] Step S32, fusing the multi-scale features through the feature fusion network to obtain a multi-scale feature fusion graph.

[0095] It should be noted that the feature fusion network will fuse the multi-scale feature map output by the feature enhancement layer (such as the CoordAtt module) and the preliminary feature map output by the preliminary feature extraction layer (such as the stacked bneck module) through UpSample (upsampling) and Concat (concatenation) operations, and further process them using C2f and Conv layers to obtain a multi-scale feature fusion map. The UpSample operation is used to increase the spatial resolution (i.e., image size) of the feature map. It can enlarge the low-resolution feature map and align and fuse it with the high-resolution feature map. The Concat operation can concatenate two or more feature maps in the channel dimension. The top-down feature fusion strategy can be used to fuse low-resolution high-level features (semantic features) with high-resolution low-level features (detail features). Features at different resolutions are combined together to improve the detection effect of small and large targets.

[0096] Step S33, performing ship target detection on the multi-scale feature fusion image through the multi-scale detection head to obtain a ship target detection result.

[0097] It should be noted that the output end of the ship target detection model is a multi-scale detection head, which contains multiple detection heads. The multi-scale feature fusion map obtained after feature extraction and feature fusion will be input into multiple detection heads. Each detection head will process the input feature map and output multiple bounding boxes, which indicate the possible locations of ships in the image.

[0098] For example, Figure 4 As shown, the multi-scale detection head can include three detection heads P3, P4 and P5, which are used for detection on three feature maps with different resolutions. Among them, P3 detects small ship targets through high-resolution feature maps from low layers, P4 detects medium-sized ship targets through medium-resolution feature maps, and P5 detects large ship targets through low-resolution high-level feature maps. This multi-scale detection mechanism ensures that the ship target detection model can handle ship targets of different sizes at the same time. In particular, for dynamic scenes, larger targets can be detected on small-resolution feature maps, while smaller targets can be detected on high-resolution feature maps.

[0099] The present embodiment provides a ship target detection method, which obtains a preset ship image data set, trains a preset target detection model based on the preset ship image data set, and obtains a ship target detection model, wherein the preset target detection model includes a feature extraction network, a feature fusion network, and a multi-scale detection head connected in sequence, wherein the feature extraction network is a lightweight convolutional neural network improved based on an attention mechanism, obtains an image to be detected, and performs ship target detection on the image to be detected through the ship target detection model to obtain a ship target detection result, and by combining the lightweight convolutional neural network improved based on the attention mechanism, the feature fusion network, and the multi-scale detection head, the model detection speed is improved while the consumption of computing resources is reduced, so that the ship target detection model has strong real-time performance and accuracy when processing large-scale image data, and the detection accuracy of ship targets of different scales is improved.

[0100] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 5 , step S20 may include steps S21 to S23:

[0101] Step S21, training a preset target detection model based on the preset ship image data set to obtain an initial training result and an initial target detection model.

[0102] It should be understood that in the process of training the preset target detection model based on the preset ship image dataset, the preset ship image dataset will be divided in an appropriate proportion to obtain a training set and a test set (such as 70% of the dataset is used as a training set to train the preset target detection model, and 30% is used as a test set to test the initial target detection model).

[0103] It should be noted that after the training set of the preset ship image data set is input into the preset target detection model for training, the initial target detection model obtained contains the model parameters after preliminary training. The initial target detection model will be used as the basic model for further training and parameter adjustment. After obtaining the initial target detection model, the test set of the preset ship image data set will be input into the initial target detection model to obtain the bounding box prediction result of the ship target detected in the test set, that is, the initial training result. The bounding box is a rectangular box that marks the ship target object in the image, and is defined by the coordinates of the upper left corner and the lower right corner of the rectangular box. The bounding box pre-marked for the ship target in the image in the test set is the real box, and the bounding box detected by the initial target detection model is the predicted box.

[0104] Step S22, calculating a bounding box regression loss function value during training based on the initial training result;

[0105] It should be understood that in the process of training the preset target detection model, the loss value between the predicted box and the true box, that is, the bounding box regression loss function value, is calculated. The bounding box regression loss function value is used to measure the accuracy of the predicted box and the consistency of the true box.

[0106] The YOLOv8 algorithm model uses the CIoU loss function as the bounding box regression loss function. The loss is calculated by the overlapping area, center point distance and aspect ratio of the predicted box and the real box. The bounding box regression loss function value L of the CIoU loss function is CIoU The calculation formula is as follows:

[0107]

[0108] Among them, B gt represents the real box, B pred represents the prediction box, ρ 2 (B gt , B pred ) represents the Euclidean distance between the center points of the predicted box and the real box, C represents the diagonal length of the smallest circumscribed rectangle that can contain the predicted box and the real box, IoU (Intersection over Union) is used to measure the overlap between the predicted box and the real box, v is used to measure whether the aspect ratio is consistent, and α is a balancing parameter used to adjust the weight of the aspect ratio loss term. The calculation formula of IoU is as follows:

[0109]

[0110] The calculation formula of v is as follows:

[0111]

[0112] Among them, W gt Indicates the width of the real box, h gt Indicates the height of the real box, W pred Indicates the width of the prediction box, h pred Indicates the height of the prediction box.

[0113] The calculation formula of α is as follows:

[0114]

[0115] For the YOLOv8 algorithm model, in the bounding box regression process of ship target detection, when the center points of the predicted box and the true box overlap, the CIoU loss function can optimize the shape, position and size deviations between the predicted box and the true box through the penalty term. However, in this case, when the aspect ratio of the predicted box and the true box is consistent but the predicted length and width values ​​are not equal, the CIoU loss function will lose its effectiveness, which is not conducive to the full expression of the loss function and will limit the convergence speed and accuracy of the model.

[0116] In a feasible implementation, step S22 may include: obtaining predicted box coordinates and real box coordinates of the preset ship image data set based on the initial training results; calculating the target distance based on the predicted box coordinates and the real box coordinates; and calculating the bounding box regression loss function value during the training process based on the target distance.

[0117] It should be understood that the initial training results include the predicted box coordinates of the test set of the preset ship image dataset. The real box coordinates of the test set can be obtained through the corresponding annotation information of the preset ship image dataset. The predicted box coordinates include the coordinates of the upper left corner of the predicted box And the coordinates of the lower right corner of the prediction box The real frame coordinates include the coordinates of the upper left corner of the real frame And the coordinates of the lower right corner of the real box The target distance represents the distance between the closest points of two bounding boxes, that is, the minimum point distance, which can measure the position difference between the predicted box and the true box, especially when the bounding boxes partially overlap or incompletely overlap.

[0118] It should be noted that, considering the limitations of the CIoU loss function, this embodiment uses the MPDIoU loss function to replace the CIoU loss function in the YOLOv8 algorithm model, takes the minimum point distance into consideration, redescribes the loss function, and reduces the total degree of freedom of the loss function. The bounding box regression loss function value L of the MPDIoU loss function MPDIoU The calculation formula is as follows:

[0119]

[0120] Among them, w and h are the width and height of the input image in the model network respectively. Represents the square of the Euclidean distance between the upper left corner of the predicted box and the upper left corner of the true box, Represents the square of the Euclidean distance between the lower right corner of the predicted box and the lower right corner of the true box.

[0121] The calculation formula is as follows:

[0122]

[0123] in, is the coordinate of the upper left corner of the prediction box, The coordinates of the upper left corner of the real box.

[0124] The calculation formula is as follows:

[0125]

[0126] in, is the coordinate of the lower right corner of the prediction box, is the coordinate of the lower right corner of the real box.

[0127] It should be noted that the MPDIoU loss function takes into account the limitations of the CIoU loss function and is more suitable for small target detection. According to the formula of the MPDIoU loss function, in other cases such as non-overlapping center points, the function can promote the predicted box to approach the true box, and when the predicted box and the true box center points overlap, the aspect ratio is consistent but the predicted length and width values ​​are different, the penalty term of the MPDIoU function is not 0 and will not degenerate into IoU loss. Therefore, compared with the CIoU loss function, the use of the MPDIoU loss function not only simplifies the calculation process, but also stabilizes the model convergence and improves the model's detection accuracy for ship targets. For details, please refer to Figure 6 , Figure 6 This is an overlap diagram of the predicted frame and the real frame center provided in the second embodiment of the ship target detection method of this application. Figure 6 As shown, the size of the real box is 2×2, the size of the predicted box on the left is 4×4, and the size of the predicted box on the right is 1×1. By calculation, we can find the L CIoU =0.75, L MPDIoU =0.79; right figure L CIoU =0.75, L MPDIoU =0.76. Obviously, the CIoU loss function cannot fully express the difference between the predicted box and the true box, which limits the convergence speed and accuracy of the model.

[0128] Step S23, adjusting the parameters of the initial target detection model based on the bounding box regression loss function value to obtain a ship target detection model.

[0129] It should be understood that after obtaining the bounding box regression loss function value, the gradient of the model parameters will be calculated by the back propagation algorithm according to the calculated bounding box regression loss function value, and the optimization algorithm (such as gradient descent, Adam, etc.) will be used to initialize the parameters of the target detection model according to the gradient to minimize the loss value and obtain the ship target detection model. Through the above bounding box regression process, the model can continuously optimize the position of the predicted bounding box, so that the ship target detection result output by the ship target detection model is closer to the real marked bounding box, thereby improving the accuracy of the ship target detection process.

[0130] For example, during the model training process, the Adam optimizer can be used to update the parameters, the learning rate is set to 0.01, and the batch size is set to 4. During the training process, the model is evaluated in each epoch, and the learning rate and training strategy are adjusted according to the evaluation results.

[0131] For example, when evaluating the ship target detection model obtained after training the preset target detection model built based on the improved YOLOv8 algorithm model, mAP (mean Average Precision) can be used as the evaluation indicator, where the IoU threshold is set to 0.5, that is, mAP@0.5. The mAP indicator reflects the average accuracy level of the model for different categories of target detection on the entire data set. Specifically, the calculation formula of mAP is as follows:

[0132]

[0133] Where c represents the number of categories of the detected target, and i is the category index. The AP (Average Precision) value can be obtained by plotting the curve of Precision and Recall, and calculating the area enclosed by the curve and the coordinate axis in the range of 0 to 1. The calculation formula of AP is as follows:

[0134]

[0135] Among them, p(r) represents the function of the change of precision with recall. The calculation formula of precision and recall is as follows:

[0136]

[0137] Among them, TP (True Positives) indicates the number of samples that the model predicts to be positive and are actually positive; FP (False Positives) indicates the number of samples that the model predicts to be positive but are actually negative; FN (False Negatives) indicates the number of samples that the model predicts to be negative but are actually positive. Precision measures the proportion of true positives among the samples predicted to be positive by the model, while recall reflects the proportion of positives correctly predicted by the model to the total number of positives.

[0138] In addition to detection accuracy, the model's parameter count (Params) and floating-point operations (FLOPs) can also be used as evaluation indicators to assess the model's detection speed. The parameter count reflects the model's complexity and storage requirements, while FLOPs measures the amount of computation required by the model during the inference process, thereby indirectly reflecting the model's detection speed. Taking these two indicators into consideration, the performance and practicality of the model can be more comprehensively evaluated.

[0139] In order to verify the effectiveness of various improvements based on the YOLOv8 algorithm model, this embodiment also designed multiple groups of ablation experiments on the HRSC2016 dataset, and obtained the ablation experiment results as shown in Table 1. Among them, √ indicates that the module is included in the preset target detection model, × indicates that the module is not included in the preset target detection model, and G1, G2, G3 and G4 represent the preset target detection models obtained by making corresponding improvements to the YOLOv8 algorithm model. The introduction of the MobileNetV3+CA module significantly reduces the number of parameters and the amount of calculation, making the model more lightweight and efficient. It can be seen from the performance of the optimized G4 that in the case of the MobileNetV3+CA module, combined with other improvements (such as the MPDIoU module), the model can be kept lightweight while maintaining high performance. The MPDIoU module has a significant effect on performance improvement without increasing the complexity and amount of calculation of the model.

[0140] Table 1

[0141] Group MobileNetV3+CA MPD Params(M) Flops(G) Map@0.5(%) G1 × × 30.11 8.2 0.949 G2 √ × 23.61 5.8 0.888 G3 × √ 30.11 8.2 0.951 G4 √ √ 23.61 5.8 0.938

[0142] In summary, the optimized G4 shows the advantages of the combination of MobileNetV3+CA and MPDIoU modules, that is, while significantly reducing the model complexity and computational complexity, it maintains a high detection accuracy, while improving the practicality and adaptability of the model, and provides an effective idea for further optimization.

[0143] The experimental results show that the improved YOLOv8 algorithm model proposed in the solution of this application not only shows better detection performance on the preset ship image dataset HRSC2016, achieving a detection accuracy of 93.8%, but also keeps the model parameters and calculation amount at a normal level, retaining the advantage in ship target detection. For further information, please refer to Figure 7 , Figure 7 This is a visualization result diagram of ship target detection provided in Example 2 of the ship target detection method of this application. Figure 7As shown, by visualizing some detection results on the HRSC2016 dataset, it can be found that the improved YOLOv8 algorithm model proposed in the solution of this application can accurately detect and identify remote sensing ship targets in the complex background of remote sensing images, and still maintains good performance even for densely arranged narrow and long ships that are difficult to detect and ships with large scale variations.

[0144] The present embodiment provides a ship target detection method, which trains a preset target detection model based on the preset ship image data set to obtain an initial training result and an initial target detection model, calculates a bounding box regression loss function value during the training process based on the initial training result, adjusts the parameters of the initial target detection model based on the bounding box regression loss function value, and obtains a ship target detection model. By calculating the bounding box regression loss function value during the model training process and adjusting the parameters of the initial target detection model, the performance of the model can be optimized, and the deviation between the predicted bounding box and the true bounding box can be reduced, thereby improving the accuracy of ship target detection.

[0145] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the ship target detection method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0146] This application also provides a ship target detection device, please refer to Figure 8 , the ship target detection device comprises:

[0147] The data acquisition module 10 is used to acquire a preset ship image data set;

[0148] A model training module 20 is used to train a preset target detection model based on the preset ship image data set to obtain a ship target detection model, wherein the preset target detection model includes a feature extraction network, a feature fusion network, and a multi-scale detection head connected in sequence, and the feature extraction network is a lightweight convolutional neural network improved based on an attention mechanism;

[0149] The target detection module 30 is used to acquire the image to be detected, and perform ship target detection on the image to be detected by using the ship target detection model to obtain a ship target detection result.

[0150] In one embodiment, the target detection module 30 is further used to perform feature extraction on the image to be detected through the feature extraction network to obtain a multi-scale feature map; fuse the multi-scale features through the feature fusion network to obtain a multi-scale feature fusion map; perform ship target detection on the multi-scale feature fusion map through the multi-scale detection head to obtain a ship target detection result.

[0151] In one embodiment, the feature extraction network includes a preliminary feature extraction layer, a deep feature extraction layer, a multi-scale pooling layer and a feature enhancement layer connected in sequence; the target detection module 30 is also used to perform preliminary feature extraction on the image to be detected through the preliminary feature extraction layer to obtain a preliminary feature map; perform deep feature extraction on the preliminary feature map through the deep feature extraction layer to obtain a local feature map; perform multi-scale pooling on the local feature map through the multi-scale pooling layer to obtain a multi-channel feature map; enhance the spatial information and channel information of the multi-channel feature map through the feature enhancement layer to obtain a multi-scale feature map.

[0152] In one embodiment, the preliminary feature extraction layer includes a convolution layer, a normalization layer and an activation function; the target detection module 30 is also used to perform local feature extraction on the image to be detected through the convolution layer to obtain a local feature map; perform batch normalization on the local feature map through the normalization layer to obtain a standardized local feature map; perform nonlinear processing on the standardized local feature map through the activation function to obtain a preliminary feature map.

[0153] In one embodiment, the target detection module 30 is also used to extract the spatial information of the multi-channel feature map by decomposing horizontal coordinates and vertical coordinates; extract the channel information of the multi-channel feature map through global average pooling and global maximum pooling; determine the channel attention weight and spatial attention weight of the multi-channel feature map through the feature enhancement layer; enhance the spatial information and the channel information according to the channel attention weight and the spatial attention weight to obtain a multi-scale feature map.

[0154] In one embodiment, the model training module 20 is also used to train a preset target detection model based on the preset ship image data set to obtain an initial training result and an initial target detection model; calculate the bounding box regression loss function value during the training process based on the initial training result; adjust the parameters of the initial target detection model based on the bounding box regression loss function value to obtain a ship target detection model.

[0155] In one embodiment, the model training module 20 is further used to obtain the predicted box coordinates and the real box coordinates of the preset ship image data set based on the initial training results; calculate the target distance based on the predicted box coordinates and the real box coordinates; and calculate the bounding box regression loss function value during the training process based on the target distance.

[0156] The ship target detection device provided by the present application adopts the ship target detection method in the above embodiment, which can solve the technical problem of how to improve the detection accuracy of ship targets of different scales. Compared with the prior art, the beneficial effects of the ship target detection device provided by the present application are the same as the beneficial effects of the ship target detection method provided by the above embodiment, and the other technical features in the ship target detection device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0157] The present application provides a ship target detection device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the ship target detection method in the above-mentioned embodiment one.

[0158] Reference below Fig. 9 , which shows a schematic diagram of the structure of a ship target detection device suitable for implementing the embodiment of the present application. The ship target detection device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig. 9 The ship target detection device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0159] like Fig. 9As shown, the ship target detection device may include a processing device 1001 (such as a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the ship target detection device are also stored. The processing device 1001, ROM1002 and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the ship target detection device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a ship target detection device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.

[0160] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0161] The ship target detection device provided by the present application adopts the ship target detection method in the above embodiment, which can solve the technical problem of how to improve the detection accuracy of ship targets of different scales. Compared with the prior art, the beneficial effects of the ship target detection device provided by the present application are the same as the beneficial effects of the ship target detection method provided by the above embodiment, and the other technical features in the ship target detection device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0162] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0163] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0164] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the ship target detection method in the above-mentioned embodiment.

[0165] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0166] The computer-readable storage medium may be included in the ship target detection device; or may exist independently without being assembled into the ship target detection device.

[0167] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the ship target detection device, the ship target detection device: obtains a preset ship image data set; trains a preset target detection model based on the preset ship image data set to obtain a ship target detection model, wherein the preset target detection model includes a feature extraction network, a feature fusion network and a multi-scale detection head connected in sequence, and the feature extraction network is a lightweight convolutional neural network improved based on the attention mechanism; obtains an image to be detected, and performs ship target detection on the image to be detected through the ship target detection model to obtain a ship target detection result.

[0168] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0169] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0170] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0171] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned ship target detection method, and can solve the technical problem of how to improve the detection accuracy of ship targets of different scales. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the ship target detection method provided in the above-mentioned embodiment, and will not be repeated here.

[0172] The present application also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the ship target detection method as described above are implemented.

[0173] The computer program product provided by the present application can solve the technical problem of how to improve the detection accuracy of ship targets of different scales. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the ship target detection method provided by the above embodiment, which will not be repeated here.

[0174] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A ship target detection method, characterized in that: The ship target detection method comprises: Obtain a preset ship image dataset; Based on the preset ship image data set, a preset target detection model is trained to obtain a ship target detection model, wherein the preset target detection model includes a feature extraction network, a feature fusion network, and a multi-scale detection head connected in sequence, and the feature extraction network is a lightweight convolutional neural network improved based on an attention mechanism; An image to be detected is acquired, and ship target detection is performed on the image to be detected by using the ship target detection model to obtain a ship target detection result.

2. The method according to claim 1, characterized in that The step of performing ship target detection on the image to be detected by using the ship target detection model to obtain a ship target detection result comprises: Extracting features from the image to be detected by the feature extraction network to obtain a multi-scale feature map; The multi-scale features are fused through the feature fusion network to obtain a multi-scale feature fusion graph; The multi-scale detection head performs ship target detection on the multi-scale feature fusion image to obtain a ship target detection result.

3. The method according to claim 2, characterized in that The feature extraction network includes a preliminary feature extraction layer, a deep feature extraction layer, a multi-scale pooling layer and a feature enhancement layer connected in sequence; The step of extracting features from the image to be detected by the feature extraction network to obtain a multi-scale feature map includes: Performing preliminary feature extraction on the image to be detected through the preliminary feature extraction layer to obtain a preliminary feature map; Performing deep feature extraction on the preliminary feature map through the deep feature extraction layer to obtain a local feature map; Performing multi-scale pooling on the local feature map through the multi-scale pooling layer to obtain a multi-channel feature map; The spatial information and channel information of the multi-channel feature map are enhanced by the feature enhancement layer to obtain a multi-scale feature map.

4. The method according to claim 3, characterized in that The preliminary feature extraction layer includes a convolution layer, a normalization layer and an activation function; The step of performing preliminary feature extraction on the image to be detected through the preliminary feature extraction layer to obtain a preliminary feature map comprises: Extracting local features of the image to be detected through the convolution layer to obtain a local feature map; Performing batch normalization on the local feature map through the normalization layer to obtain a standardized local feature map; The standardized local feature map is nonlinearly processed by the activation function to obtain a preliminary feature map.

5. The method according to claim 3, characterized in that The step of enhancing the spatial information and channel information of the multi-channel feature map by the feature enhancement layer to obtain a multi-scale feature map includes: Extracting spatial information of the multi-channel feature map by decomposing horizontal coordinates and vertical coordinates; Extracting channel information of the multi-channel feature map through global average pooling and global maximum pooling; Determine the channel attention weight and the spatial attention weight of the multi-channel feature map through the feature enhancement layer; The spatial information and the channel information are enhanced according to the channel attention weight and the spatial attention weight to obtain a multi-scale feature map.

6. The method according to claim 1, characterized in that The step of training a preset target detection model based on the preset ship image data set to obtain a ship target detection model comprises: Training a preset target detection model based on the preset ship image data set to obtain an initial training result and an initial target detection model; Calculating a bounding box regression loss function value during training based on the initial training result; The parameters of the initial target detection model are adjusted based on the bounding box regression loss function value to obtain a ship target detection model.

7. The method according to claim 6, characterized in that The step of calculating the bounding box regression loss function value during the training process based on the initial training result comprises: Acquire the predicted frame coordinates and the real frame coordinates of the preset ship image data set based on the initial training result; Calculate the target distance based on the predicted frame coordinates and the real frame coordinates; A bounding box regression loss function value is calculated during training based on the target distance.

8. A ship target detection device, characterized in that: The device comprises: A data acquisition module, used to acquire a preset ship image data set; A model training module, used for training a preset target detection model based on the preset ship image data set to obtain a ship target detection model, wherein the preset target detection model includes a feature extraction network, a feature fusion network and a multi-scale detection head connected in sequence, and the feature extraction network is a lightweight convolutional neural network improved based on an attention mechanism; The target detection module is used to acquire the image to be detected, and perform ship target detection on the image to be detected through the ship target detection model to obtain a ship target detection result.

9. A ship target detection device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the ship target detection method according to any one of claims 1 to 7.

10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the ship target detection method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Method and system for detecting tiny ship target in thermal infrared image based on hierarchical feature attention network

    CN120107819A

  • A method and system for detecting small ship targets in thermal infrared images based on hierarchical feature attention network

    CN120107819B

  • Ship detection method based on edge semantic fusion and contrast feature aggregation

    CN120198682A

  • Image edge detection method and device, equipment and storage medium

    CN120235900A

  • Image edge detection method, device, equipment and storage medium

    CN120235900B