A remote sensing image ship small target detection method and system
Patent Information
- Application Number
- CN202311827351.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-28
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2043-12-28
AI Technical Summary
然而由于遥感图像获取的距离较远,采集信息范围较大,小型船舶可能在图像中只占据很少的像素,导致难以区分或检测到
[0067]本申请提出的一种基于特征增强和多尺度感知的遥感图像船舶小目标检测方法及系统,针对遥感图像中船舶目标较小,难以和背景区分开的问题,通过在原始YOLOv8网络模型中引入动态通道注意力卷积DyCAConv,使用动态权重机制自适应地调整全局特征和局部特征中各个区域的重要性,提升模型的表征能力;引入MS-CF Block模块和小目标检测层,捕捉并强化小目标所需要的细节信息,提高对小目标的检测精度;最后引入角度差异信息和分级损失权重系数优化损失函数,更好地引导模型关注更小的目标。有效减少了小目标漏检和误检的情况,提高了网络对提高对不同尺寸目标的感知能力,同时也提高了小目标检测的检测精度。
Smart Images

Figure CN117789030B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of remote sensing image ship target detection technology, and relates to a method and system for detecting small ships in remote sensing images, specifically a method for detecting small ships in remote sensing images based on feature enhancement and multi-scale perception. Background Technology
[0002] In recent years, with the development of aerospace technology, drone technology, and the launch of numerous remote sensing satellites, more and more scholars have been conducting research on remote sensing images (RSIs). Using remote sensing sensors (such as satellites, aircraft, or drones) and different wavelengths (such as visible light, infrared, and radar) to acquire remote sensing images of ships offers lower costs and higher efficiency compared to traditional ground surveys. Current ship target detection technologies mainly fall into two categories: traditional computer vision methods and deep learning methods. Traditional ship detection methods include four steps: land-sea segmentation, data preprocessing, pre-screening, and false alarm elimination. However, traditional large-scale RSI ship detection methods often suffer from background noise interference and small target size in complex environments, resulting in low detection efficiency, limited detection capabilities, high manual labor costs, and large interpretation errors.
[0003] To further leverage the role of target detection algorithms in marine monitoring, this paper combines them with remote sensing image processing technology. After acquiring ship image data, target detection algorithms process and analyze the acquired image information to accurately locate and identify ship targets in the images. This can effectively reduce manual costs, maintain maritime safety, and promote the rational utilization of marine resources. However, due to the long distances and large information ranges covered by remote sensing images, small ships may occupy only a few pixels in the image, making them difficult to distinguish or detect. Compared to targets of regular size, small targets have low resolution, lack sufficient appearance information, and have fewer usable features, making it difficult to distinguish them from the image background and surrounding similar targets, leading to missed detections and false detections of small targets. Summary of the Invention
[0004] Objective: In view of at least one of the above technical problems, this application proposes a method and system for detecting small targets of ships in remote sensing images based on feature enhancement and multi-scale perception.
[0005] To solve the above-mentioned technical problems, this application adopts the following technical solution:
[0006] Firstly, this application provides a method for detecting small targets of ships in remote sensing images, including:
[0007] Acquire a remote sensing image of the ship to be detected; wherein the remote sensing image of the ship is a remote sensing image containing the ship.
[0008] The remote sensing image of the ship to be detected is input into the pre-trained small target detection model;
[0009] The ship small target detection result is determined based on the output of the small target detection model;
[0010] The small target detection model includes a backbone network module, a neck network module, and a head network module.
[0011] The backbone network module replaces the standard convolution with dynamic channel attention convolution to extract features from the remote sensing images of ships to be detected, obtaining multi-scale feature maps with dimensions of the original... Figure 1 The first feature map, second feature map, third feature map, and fourth feature map are 32, 1 / 16, 1 / 8, and 1 / 4 respectively.
[0012] The neck network module incorporates a small target detection layer and a multi-scale channel fusion module to perform multi-scale feature fusion on the multi-scale feature maps, resulting in multi-scale fused feature maps: a first-scale fused feature map, a second-scale fused feature map, a third-scale fused feature map, and a fourth-scale fused feature map.
[0013] The head network module incorporates a small target detection head P6, which is used to detect multi-scale fused feature maps to obtain multi-scale target detection results.
[0014] In some embodiments, the processing of the dynamic channel attention convolution DyCAConv includes:
[0015] Obtain attention weights, wherein the attention weights include horizontal attention weights a. w Attention weights in the vertical direction a h ;
[0016] Obtain dynamic weights, wherein the dynamic weights include horizontal dynamic weights (Dynamic_weights). w and the dynamic weights in the vertical direction. h ;
[0017] Based on the attention weights and dynamic weights, the input features are weighted and fused to obtain the feature representation Out;
[0018] After further transformation and compression of the obtained feature representation Out through convolution and batch normalization, the output feature map of dynamic channel attention convolution DyCAConv is obtained by activating it with the SiLU function.
[0019] Furthermore, in some embodiments, obtaining attention weights includes:
[0020] Global average pooling is performed on the input features to obtain feature maps in the horizontal and vertical directions;
[0021] After concatenating the horizontal and vertical feature maps onto the channel dimension, they are passed through convolutional layers and batch normalization layers in sequence. Finally, the Swish activation function is used to perform a non-linear transformation on the batch normalized features to obtain a richer feature map.
[0022] Next, the feature map obtained in the previous step is segmented and transposed, splitting it into features in the horizontal and vertical directions;
[0023] Then, after performing convolution operations on the features in the horizontal and vertical directions respectively, the attention weight 'a' in the horizontal direction is obtained by processing with the sigmoid function. w Attention weights in the vertical direction a h .
[0024] In some embodiments, obtaining dynamic weights includes:
[0025] For the input features, global average pooling is first used to reduce the dimensionality, resulting in a 1×1 feature map.
[0026] The feature map is flattened into a one-dimensional vector and then fed into a fully connected layer for processing. After activation using the Softmax function, the dynamic weights in the horizontal direction are obtained. w and the dynamic weights in the vertical direction. h .
[0027] In some embodiments, the input features are weighted and fused according to the attention weights and dynamic weights to obtain the feature representation Out;
[0028] Out = x * ((Dynamic_weights) w )*a w +(Dynamic_weights h )*a h )
[0029] Where x represents the input feature; Dynamic_weights w and Dynamic_weights h These represent the dynamic weight values in the horizontal and vertical directions, respectively. w and a h These represent the attention weight values in the horizontal and vertical directions, respectively.
[0030] In some embodiments, the processing procedure of the multi-scale channel fusion MS-CF module includes:
[0031] Two feature maps MC1 and MC2 of different scales are extracted from the input features. Then, the feature maps MC1 and MC2 are connected in the channel dimension through two 1×1 convolutional layers to form a comprehensive attention feature map.
[0032] The comprehensive attention feature map is subjected to average pooling and max pooling operations respectively to obtain the mean feature map MC. Avg and the maximum value feature map MC Max MC of the average feature map Avg and the maximum value feature map MC Max The channels are concatenated and merged into a single two-channel feature map, which is then activated by a 7×7 convolution and a sigmoid function to obtain the attention weights MC. Weight ;
[0033] The feature maps MC1 and MC2 are respectively associated with their corresponding attention weights MC1 and MC2. Weight Channel-by-channel weighted summation is performed to generate attention feature maps (MCs);
[0034] The input features are multiplied with the attention feature map MC, which has been increased in dimension by 5×5 convolution, to obtain the enhanced multi-scale features output by the multi-scale channel fusion MS-CF module.
[0035] In some embodiments, the total loss function L used during the training of the small object detection model is:
[0036] L = β l ·L large +β m ·L medium +β s ·L small +β t ·L tiny
[0037] Among them, L large L medium L small L tiny β represents the output loss of the large target detection head P5, the medium target detection head P4, the small target detection head P3, and the micro target detection head P6, respectively. l β m β s β t These are the corresponding loss weight coefficients. In this embodiment, β l =0.6, β m =0.8, β s =1.0, βt =1.2.
[0038] Furthermore, the loss L output by each detection head k This includes classification loss and regression loss, where the classification loss uses binary cross-entropy loss L. BCE The regression loss is the classification focus loss L. DFL Plus full border loss L CIoU ;
[0039] L k =L BCE +L DFL +L CIoU (k=large, medium, small, tiny)
[0040] The binary cross-entropy loss L BCE The calculation methods include:
[0041]
[0042] Where N represents the number of samples, L i p represents the loss for the i-th sample; for each sample i, p i y represents the probability that i is predicted to be of the positive class. i This represents the actual label of sample i, with 1 for positive classes and 0 for negative classes; the loss L for all samples is... i The final binary cross-entropy loss L is obtained by averaging. BCE ;
[0043] The method for calculating the classification focus loss includes: first, calculating the weights of the left and right boundaries based on the target bounding box distance information; then, calculating the cross-entropy loss of the left and right boundaries; multiplying the cross-entropy loss of the left and right boundaries by their corresponding weights to obtain the weighted left and right boundary losses; and finally, averaging these weighted losses to obtain the classification focus loss L. DFL ;
[0044] The complete border loss L CIoU The calculation methods include: introducing angle information when calculating the full bounding box loss, and helping the model to more accurately locate ship targets by calculating the angle difference between the predicted box and the ground truth box;
[0045] For two diagonal points (x1, y1) and (x2, y2) on the diagonal of the rectangle, use the arctangent function to calculate the angle Angel of the diagonal vector;
[0046] Angel = atan2(y2-y1, x2-x1)
[0047] Calculate the angle difference between the predicted bounding box and the ground truth bounding box;
[0048] Angel D =|Angel P -Angel G |
[0049] Among them, Angel P Indicates the angle of the prediction box, Angel G Angel represents the angle of the true bounding box. D This represents the angular difference between the predicted bounding box and the ground truth bounding box;
[0050] The difference in angle obtained by Angel D In the calculation of the full border loss, the optimized full border loss L CIoU for:
[0051]
[0052] Where IoU represents the intersection-union ratio, b and b gt Let represent the center points of the predicted bounding box and the ground truth bounding box, respectively; ρ represents the Euclidean distance between the two center points; c represents the diagonal distance of the smallest closure region that can simultaneously contain both the predicted and ground truth bounding boxes; α represents the weighting coefficient for aspect ratio similarity; γ represents the weighting coefficient for angular information; and v represents the similarity measure of aspect ratio, defined as:
[0053]
[0054] Among them, w gt and h gt represents the width and height of the true bounding box of the target object, respectively; w and h represent the width and height of the predicted bounding box, respectively.
[0055] Secondly, this application provides a remote sensing image ship small target detection system, comprising:
[0056] Including processor and storage media;
[0057] The storage medium is used to store instructions;
[0058] The processor is configured to operate according to the instructions to execute the method according to the first aspect.
[0059] Thirdly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.
[0060] Fourthly, the present invention provides an apparatus comprising,
[0061] Memory;
[0062] processor;
[0063] as well as
[0064] Computer programs;
[0065] The computer program is stored in the memory and configured to be executed by the processor to implement the method described in the first aspect above.
[0066] Compared with the prior art, the beneficial effects achieved by this application are as follows:
[0067] This application proposes a method and system for detecting small ships in remote sensing images based on feature enhancement and multi-scale perception. Addressing the problem that ships in remote sensing images are small and difficult to distinguish from the background, this method introduces Dynamic Channel Attention Convolution (DyCAConv) into the original YOLOv8 network model. A dynamic weighting mechanism adaptively adjusts the importance of different regions in global and local features, enhancing the model's representational ability. An MS-CF Block module and a small target detection layer are introduced to capture and enhance the detailed information needed for small targets, improving detection accuracy. Finally, angle difference information and hierarchical loss weight coefficients are incorporated to optimize the loss function, better guiding the model to focus on smaller targets. This effectively reduces missed and false detections of small targets, improves the network's ability to perceive targets of different sizes, and enhances the detection accuracy of small targets. Attached Figure Description
[0068] Figure 1 This is a flowchart illustrating the method for detecting small ship targets in remote sensing images according to this application.
[0069] Figure 2 This is a schematic diagram of the small target detection model in the embodiments of this application;
[0070] Figure 3 This is a schematic diagram of the dynamic channel attention convolution structure in an embodiment of this application;
[0071] Figure 4 This is a schematic diagram of the DyCAConv attention weight calculation process in an embodiment of this application;
[0072] Figure 5 This is a schematic diagram of the DyCAConv dynamic weight calculation process in the embodiments of this application;
[0073] Figure 6 This is a structural diagram of the MS-CF Block multi-scale channel fusion module in the embodiments of this application. Detailed Implementation
[0074] The technical solution of this application will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the embodiments and specific features in the embodiments are detailed descriptions of the technical solution of this application, rather than limitations thereof. In the absence of conflict, the embodiments and technical features in the embodiments can be combined with each other.
[0075] Example 1
[0076] This embodiment provides a method for detecting small targets of ships in remote sensing images, including:
[0077] Acquire a remote sensing image of the ship to be detected; wherein the remote sensing image of the ship is a remote sensing image containing the ship.
[0078] The remote sensing image of the ship to be detected is input into the pre-trained small target detection model;
[0079] The ship small target detection result is determined based on the output of the small target detection model;
[0080] The small target detection model includes a backbone network module, a neck network module, and a head network module.
[0081] The backbone network module uses Dynamic Channel Attention Convolution (DyCAConv) instead of standard convolution to extract features from the remote sensing images of ships to be detected, obtaining multi-scale feature maps with dimensions of 640×640 pixels. Figure 1 The first feature map, second feature map, third feature map, and fourth feature map are 32, 1 / 16, 1 / 8, and 1 / 4 respectively.
[0082] The neck network module incorporates a small target detection layer and a multi-scale channel fusion (MS-CF) module to perform multi-scale feature fusion on the multi-scale feature maps, resulting in multi-scale fused feature maps: a 160×160 first-scale fused feature map, an 80×80 second-scale fused feature map, a 40×40 third-scale fused feature map, and a 20×20 fourth-scale fused feature map.
[0083] The head network module incorporates a small target detection head P6, which is used to detect multi-scale fused feature maps to obtain multi-scale target detection results.
[0084] The head network module includes a micro-target detection head P6, a small target detection head P3, a medium target detection head P4, and a large target detection head P5, which are used to detect a first-scale fusion feature map of 160×160, a second-scale fusion feature map of 80×80, a third-scale fusion feature map of 40×40, and a fourth-scale fusion feature map of 20×20, respectively.
[0085] In some embodiments, such as Figure 1 As shown, a method for detecting small targets of ships in remote sensing images includes:
[0086] Step 1: Construct a ship remote sensing image dataset:
[0087] Establish training, validation, and test sets for ship remote sensing images, randomly partition them in an 8:1:1 ratio, and then convert the partitioned VOC format dataset into a YOLO format dataset.
[0088] Step 2: Construct a small target detection model: Improve the network structure based on the YOLOv8 network;
[0089] 1. Feature Extraction
[0090] The backbone of the network is improved by replacing the original convolutions with Dynamic Channel Attention Convolution (DyCAConv). DyCAConv calculates the horizontal and vertical attention weights for each channel in the input feature map and dynamically adjusts the importance of each channel, calculating dynamic weights for each channel. Based on the dynamic weights and attention weights, the input feature maps are weighted and fused to generate an adjusted output feature map, improving the model's attention to and representation ability of features from different channels.
[0091] This application proposes Dynamic Channel Attention Convolution (DyCAConv) to reconstruct the backbone network. Unlike standard convolution, Dynamic Channel Attention Convolution essentially utilizes a dynamic attention mechanism between channels to adjust the weights of the input feature map.
[0092] In some embodiments, such as Figure 3 As shown, the processing procedure of the dynamic channel attention convolution DyCAConv includes:
[0093] S101, Obtain attention weights;
[0094] In some embodiments, S101 specifically includes: performing a global average pooling operation on the input feature x to obtain feature maps in the horizontal and vertical directions; capturing global features in the width and height directions respectively.
[0095] After concatenating the horizontal and vertical feature maps onto the channel dimension, they are passed through convolutional layers and batch normalization layers in sequence. Finally, the Swish activation function is used to perform a non-linear transformation on the batch normalized features to obtain a richer feature map.
[0096] Next, the feature map obtained in the previous step is segmented and transposed, splitting it into features in the horizontal and vertical directions;
[0097] Then, after performing convolution operations on the features in these two directions respectively, the horizontal attention weight 'a' is obtained by processing them with the sigmoid function. w Attention weights in the vertical direction a h The attention weight calculation process is as follows: Figure 4 As shown.
[0098] S102, Obtain dynamic weights;
[0099] The dynamic weights in the horizontal and vertical directions are calculated using global feature information, such as... Figure 5 As shown. In some embodiments, S102 specifically includes:
[0100] For the input feature x, global average pooling dimensionality reduction will first be performed to obtain a 1×1 feature map;
[0101] The feature map is flattened into a one-dimensional vector and then fed into a fully connected layer for processing. After activation using the Softmax function, the dynamic weights in the horizontal direction are obtained. w and the dynamic weights in the vertical direction. h .
[0102] S103. Based on the attention weights and dynamic weights, the input features are weighted and fused to obtain the feature representation Out;
[0103] Out = x * ((Dynamic_weights) w )*a w +(Dynamic_weights h )*a h )
[0104] Where x represents the input feature; Dynamic_weights w and Dynamic_weights h These represent the dynamic weight values in the horizontal and vertical directions, respectively. w and a h These represent the attention weight values in the horizontal and vertical directions, respectively.
[0105] S104. After further transformation and compression of the obtained feature representation Out through convolution and batch normalization, the output feature map of dynamic channel attention convolution DyCAConv is obtained after activation by the SiLU function.
[0106] 2. Multi-scale feature fusion
[0107] In the neck part of the original network, we propose the MS-CF Block (Multi-Scale Channel Fusion Block) to fuse features from feature layers of different scales through the neck network.
[0108] The feature map extracted from the backbone network is input into the neck network for upsampling. The upsampled feature map is then concatted with the corresponding feature map extracted from the backbone network from bottom to top to obtain the fused feature map.
[0109] This application proposes an MS-CF Block multi-scale channel fusion module. For example... Figure 6 As shown, the processing procedure of the multi-scale channel fusion MS-CF module includes:
[0110] Two feature maps MC1 and MC2 of different scales are extracted from the input features. Then, the feature maps MC1 and MC2 are connected in the channel dimension through two 1×1 convolutional layers to form a comprehensive attention feature map.
[0111] The comprehensive attention feature map is subjected to average pooling and max pooling operations respectively to obtain the mean feature map MC. Avg and the maximum value feature map MC Max MC of the average feature map Avg and the maximum value feature map MC Max The channels are concatenated and merged into a single two-channel feature map, which is then activated by a 7×7 convolution and a sigmoid function to obtain the attention weights MC. Weight ;
[0112] The feature maps MC1 and MC2 are respectively associated with their corresponding attention weights MC1 and MC2. Weight Channel-by-channel weighted summation is performed to generate attention feature maps (MCs);
[0113] The input features are multiplied with the attention feature map MC, which has been increased in dimension by 5×5 convolution, to obtain the enhanced multi-scale features output by the multi-scale channel fusion MS-CF module.
[0114] 3. To improve the detection accuracy of small targets, this application improves the Neck and Head parts of the network. In addition to the three default detection heads in YOLOv8, a small target detection layer and a corresponding small target detection head, P6, are added, proposing a small target detection network. The original YOLOv8 detection network has three default detection heads: P3, P4, and P5. For an input image of 640×640 pixels, the detection feature map size of P3 is 80×80, used to detect targets larger than 8×8. The detection feature map size of P4 is 40×40, used to detect targets larger than 16×16. The detection feature map size of P5 is 20×20, used to detect targets larger than 32×32. The newly added small target detection head, P6, has a detection feature map size of 160×160, capable of detecting targets as small as 4×4.
[0115] Step 3: Train the constructed small target detection model using the ship remote sensing image dataset.
[0116] The loss function of the detection model is optimized. The original object detection model has three output layers. To improve the detection capability for small objects, a fourth output layer is added. Correspondingly, the head network is also improved by adding a corresponding small object detection head, and the loss of the detection network is obtained through this head. Angle difference information and hierarchical loss weight coefficients are introduced to optimize the loss function of the detection head output. The detection network model is then trained based on the loss function obtained in the previous stage to obtain the detection network with optimal performance.
[0117] In this embodiment, the final loss function, including classification loss and regression loss, can be calculated through the final detection head part.
[0118] L k =L BCE +L DFL +L CIoU (k=large, medium, small, tiny)
[0119] YOLOv8 uses BCE (Binary Cross Entropy) as the classification loss. For each category, it determines "whether it belongs to this class" and outputs the confidence score. The binary cross entropy loss L... BCE The calculation formula is:
[0120]
[0121] Where N represents the number of samples, L i p represents the loss for the i-th sample; for each sample i, p i y represents the probability that i is predicted to be of the positive class.i Let L represent the actual label of sample i, with 1 for positive classes and 0 for negative classes. The loss L for all samples is... i The final binary cross-entropy loss L is obtained by averaging. BCE .
[0122] YOLOv8 uses two regression losses: Classification Focus Loss (DFL Loss) and Complete Boundary Loss (CIoU Loss). The Classification Focus Loss (DFL Loss) first calculates the weights of the left and right boundaries based on the distance information of the target bounding box, then calculates the cross-entropy loss of the left and right boundaries. The cross-entropy loss of each boundary is multiplied by its corresponding weight to obtain a weighted loss for the left and right boundaries, which is then averaged to obtain the final Classification Focus Loss (DFL Loss). Considering that ship targets in ship images often have different orientations and directions, this application introduces angle information when calculating the complete boundary loss. The angle difference between the predicted and ground truth bounding boxes helps the model more accurately locate ship targets. For the two diagonal points (x1, y1) and (x2, y2) on the diagonal of the rectangle, the arctangent function is used to calculate the angle of the diagonal vector, as shown in the following formula:
[0123] Angel = atan2(y2-y1, x2-x1)
[0124] Then, the angle difference between the predicted bounding box and the ground truth bounding box is calculated using the following formula:
[0125] Angel D =|Angel P -Angel G |
[0126] Among them, Angel P Indicates the angle of the prediction box, Angel G Angel represents the angle of the true bounding box. D This represents the angular difference between the predicted bounding box and the ground truth bounding box. The obtained angular information is incorporated into the calculation of the complete bounding box loss. The optimized CIoULoss calculation formula is as follows:
[0127]
[0128] Where IoU represents the intersection-union ratio, b and b gt Let represent the center points of the predicted bounding box and the ground truth bounding box, respectively. ρ represents the Euclidean distance between the two center points. c represents the diagonal distance of the smallest closure region that simultaneously contains both the predicted and ground truth bounding boxes. α represents the weighting coefficient for aspect ratio similarity, and γ represents the weighting coefficient for angular information. D The angle difference between the predicted bounding box and the ground truth bounding box is represented by , and v represents the similarity metric based on aspect ratio, defined as:
[0129]
[0130] Among them, w gt and h gt Let represent the width and height of the ground truth bounding box, respectively. Let w and h represent the width and height of the predicted bounding box, respectively. The final regression loss is in the form of CIoU Loss + DFL Loss.
[0131] To give smaller targets more attention and weight during training, this application employs a hierarchical loss weighting method to "hierarchically" process targets of different sizes. Feature maps output by head networks of different scales correspond to targets of different sizes, with P3, P4, P5, and P6 detectors corresponding to small, medium, large, and tiny targets, respectively. The total loss function output by each detector head is calculated as follows:
[0132] L k =L BCE +L DFL +L CIoU (k=large, medium, small, tiny)
[0133] For each size level, a corresponding loss weighting coefficient β is designed. s β m β l and β t During training, this weighting coefficient setting gives higher weight to the loss for small targets, making the model focus more on the detection accuracy of small targets and improving the ability to identify and locate them. Finally, the terms in the loss function are summed according to their weights, and the calculation formula is as follows:
[0134] L = β l ·L large +β m ·L medium+ β s ·L small +β t ·L tiny
[0135] Where L represents the total loss of the detection model, L large L medium L small L tiny These represent the output losses of the detection heads at layers P5, P4, P3, and P6, respectively. Based on the importance of targets of different sizes, this application assigns higher loss weights to small and micro-targets. The loss weight coefficients are set to β. l =0.6, β m =0.8, β s=1.0, β t =1.2.
[0136] After obtaining the loss function through the above steps, the network's parameter weights are optimized and updated using gradient descent and backpropagation to better adapt the model to the training data. Based on the changes in average accuracy and loss trends during cross-validation between the training and validation sets, the learning rate and number of iterations are adjusted until the network's performance metrics in the validation set do not change significantly and the total loss no longer decreases, thus obtaining the optimal detection network.
[0137] Step 4: Input the remote sensing ship test set images to be detected into the trained detection network model to obtain the final detection results.
[0138] In summary, this application takes ship targets in remote sensing images as the research object and improves the target detection network model based on feature enhancement and multi-scale perception. Addressing the problem that ship targets in remote sensing images are small and difficult to distinguish from the background, this application introduces Dynamic Channel Attention Convolution (DyCAConv) into the original YOLOv8 network model. This dynamic weight mechanism adaptively adjusts the importance of each region in global and local features, improving the model's representational ability. Furthermore, it introduces an MS-CF Block module and a small target detection layer to capture and enhance the detailed information needed for small targets, improving the detection accuracy. Finally, it incorporates angle difference information and hierarchical loss weight coefficients to optimize the loss function, better guiding the model to focus on smaller targets.
[0139] Example 2
[0140] Based on the same inventive concept as Embodiment 1, this embodiment introduces a remote sensing image ship small target detection system, including a processor and a storage medium;
[0141] The storage medium is used to store instructions;
[0142] The processor is configured to operate according to the instructions to execute the method according to Embodiment 1.
[0143] Example 3
[0144] Based on Embodiment 1, this embodiment provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in Embodiment 1.
[0145] Example 4
[0146] Based on Embodiment 1, this embodiment provides a device, including,
[0147] Memory;
[0148] processor;
[0149] as well as
[0150] Computer programs;
[0151] The computer program is stored in the memory and configured to be executed by the processor to implement the method described in Embodiment 1.
[0152] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0153] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0154] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0155] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0156] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims. All of these forms are within the protection scope of this application.
Claims
1. A method for detecting small targets of ships in remote sensing images, characterized in that, include: Acquire a remote sensing image of the ship to be detected; wherein the remote sensing image of the ship is a remote sensing image containing the ship. The remote sensing image of the ship to be detected is input into the pre-trained small target detection model; The ship small target detection result is determined based on the output of the small target detection model; The small target detection model comprises a backbone network module, a neck network module, and a head network module. The backbone network module replaces standard convolution with dynamic channel attention convolution to extract features from the remote sensing image of the ship to be detected, obtaining multi-scale feature maps. The neck network module incorporates a small target detection layer and a multi-scale channel fusion module to perform multi-scale feature fusion on the multi-scale feature maps, obtaining a multi-scale fused feature map. The head network module includes a small target detection head P6, which detects the multi-scale fused feature maps separately, obtaining multi-scale target detection results. The processing procedure of the dynamic channel attention convolution DyCAConv includes: obtaining attention weights, wherein the attention weights include horizontal attention weights a. w Attention weights in the vertical direction a h ; Obtain dynamic weights, wherein the dynamic weights include dynamic weights in the horizontal direction. and dynamic weights in the vertical direction Based on the attention weights and dynamic weights, the input features are weighted and fused to obtain the feature representation Out; the obtained feature representation Out is further transformed and compressed by convolution and batch normalization, and then activated by the SiLU function to obtain the output feature map of dynamic channel attention convolution DyCAConv. The process of obtaining attention weights includes: performing global average pooling on the input features to obtain feature maps in the horizontal and vertical directions; concatenating the horizontal and vertical feature maps along the channel dimension, then passing them through a convolutional layer and a batch normalization layer, followed by a non-linear transformation of the batch normalized features using the Swish activation function to obtain a richer feature map; next, segmenting and transposing the feature map obtained in the previous step to split it into features in the horizontal and vertical directions; then performing convolutional operations on the horizontal and vertical features respectively, and finally processing them with the sigmoid function to obtain the horizontal attention weight 'a'. w Attention weights in the vertical direction a h ; The process of obtaining dynamic weights includes: for the input features, first performing global average pooling dimensionality reduction to obtain... The feature map is flattened into a one-dimensional vector and then fed into a fully connected layer for processing. After activation using the Softmax function, dynamic weights in the horizontal direction are obtained. and dynamic weights in the vertical direction .
2. The method for detecting small ship targets in remote sensing images according to claim 1, characterized in that, Based on the attention weights and dynamic weights, the input features are weighted and fused to obtain the feature representation Out; ; Where x represents the input feature; and These represent the dynamic weight values in the horizontal and vertical directions, respectively. and These represent the attention weight values in the horizontal and vertical directions, respectively.
3. The method for detecting small ship targets in remote sensing images according to claim 1, characterized in that, The processing procedure of the multi-scale channel fusion MS-CF module includes: Two feature maps, MC1 and MC2, of different scales are extracted from the input features, and then processed through two... The convolutional layer connects feature maps MC1 and MC2 along the channel dimension to form a comprehensive attention feature map; The comprehensive attention feature map is subjected to average pooling and max pooling operations respectively to obtain the mean feature map MC. Avg and the maximum value feature map MC Max MC of the average feature map Avg and the maximum value feature map MC Max The channels are connected and merged into a single two-channel feature map. Attention weights (MC) are obtained after convolution and sigmoid function activation. Weight ; The feature maps MC1 and MC2 are respectively associated with their corresponding attention weights MC1 and MC2. Weight Channel-by-channel weighted summation is performed to generate attention feature maps (MCs); Input features and process Multiplying the attention feature maps after convolution and dimensionality enhancement by MC yields the enhanced multi-scale features output by the multi-scale channel fusion MS-CF module.
4. The method for detecting small ship targets in remote sensing images according to claim 1, characterized in that, The total loss function used during the training of the small object detection model is... for: ; in, , , , These represent the output losses of the large target detection head P5, the medium target detection head P4, the small target detection head P3, and the micro target detection head P6, respectively. These are the corresponding loss weight coefficients.
5. The method for detecting small ship targets in remote sensing images according to claim 4, characterized in that, , , , 。 6. The method for detecting small ship targets in remote sensing images according to claim 5, characterized in that, The loss output of each detector head This includes classification loss and regression loss, where the classification loss uses binary cross-entropy loss. Regression loss is classification focus loss. Plus full border loss ; ; The binary cross-entropy loss The calculation methods include: ; Where N represents the number of samples, Let i represent the loss for the i-th sample; for each sample i, This represents the probability that i is predicted to be of the positive class. Let represent the actual label of sample i, with 1 for positive classes and 0 for negative classes; the loss of all samples. The final binary cross-entropy loss is obtained by averaging. ; The method for calculating the classification focus loss includes: first, calculating the weights of the left and right boundaries based on the target bounding box distance information; then, calculating the cross-entropy loss of the left and right boundaries; multiplying the cross-entropy loss of the left and right boundaries by their corresponding weights to obtain the weighted left and right boundary losses; and finally, averaging these weighted losses to obtain the classification focus loss. ; The complete border loss The calculation method includes: introducing angle information when calculating the full bounding box loss, and helping the model to more accurately locate ship targets by calculating the angle difference between the predicted box and the ground truth box; For the two diagonal points on the diagonal of the rectangle and Use the arctangent function to calculate the angle of the diagonal vector. ; ; Calculate the angle difference between the predicted bounding box and the ground truth bounding box; ; in, Indicates the angle of the prediction box. Indicates the angle of the true bounding box. This represents the angular difference between the predicted bounding box and the ground truth bounding box; The difference in angles obtained In the calculation of the full border loss, the optimized full border loss is introduced. for: ; Where IoU represents the intersection-union ratio, and These represent the center points of the predicted bounding box and the ground truth bounding box, respectively. represents the Euclidean distance between the two center points; c represents the diagonal distance of the smallest closure region that can simultaneously contain both the predicted and ground truth boxes. The weighting coefficients representing aspect ratio similarity Weighting coefficients representing angle information The similarity measure of aspect ratio is defined as: ; in, and These represent the width and height of the target's true bounding box, respectively. and These represent the width and height of the predicted bounding box, respectively.
7. A remote sensing image ship small target detection system, characterized in that, Including processor and storage media; The storage medium is used to store instructions; The processor is configured to operate according to the instructions to perform the method according to any one of claims 1 to 6.