Ship detection method based on small target detection head and global-local feature fusion

By constructing a ship detection method that integrates a small target detection head with global-local feature fusion, the problems of small target feature loss and sea surface background noise interference in the UAV visual recognition system are solved, achieving high-precision, real-time ship target detection and classification.

CN122073036APending Publication Date: 2026-05-22GUILIN UNIV OF ELECTRONIC TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUILIN UNIV OF ELECTRONIC TECH
Filing Date
2026-02-04
Publication Date
2026-05-22

AI Technical Summary

Technical Problem

Unmanned aerial vehicle (UAV) visual recognition systems for ships face challenges in complex sea conditions, including loss of small target features, severe interference from sea surface background noise, insufficient model generalization ability, and inadequate real-time performance. These issues result in high false negative rates and frequent misjudgments, making it difficult to meet the needs of actual combat.

Method used

A ship detection method based on small target detection head and global-local feature fusion is constructed. The method extracts shallow high-resolution features through independent small target detection head, and combines global-local collaborative interaction mechanism and dynamic information distribution module to achieve rapid locking and real-time accurate detection of small targets on the sea surface.

Benefits of technology

It significantly improves the accuracy of identification and classification of small target ships under UAV vision, reduces the false negative rate and false positive rate, and improves the robustness and real-time detection capability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122073036A_ABST
    Figure CN122073036A_ABST
Patent Text Reader

Abstract

The invention discloses a ship detection method based on a small target detection head and global-local feature fusion, which solves the problems of few samples and illumination difference by improving a mosaic enhancement technology, remarkably improves the small target recall rate by combining an independent small target detection head with adaptive anchor frame optimization, and improves the detection accuracy. A global-local cooperative interaction mechanism is introduced to aggregate multi-dimensional features, a dynamic information distribution and injection network and an adaptive gating technology are combined, local features are supplemented by using global context information, and lost geometric details and edge information of a small target in a down-sampling process are effectively recovered. A processing mechanism in which classification and regression are independent and parallel is adopted and designed, classification and regression tasks are processed respectively, and a final recognition and classification result of the small target ship under the vision of the unmanned aerial vehicle is output. According to the method, the problem of leak detection caused by weak small ship target feature expression ability is solved, the recognition and classification precision of the small target ship under the vision of the unmanned aerial vehicle is remarkably improved, and the method has important application value and practical significance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer vision and target detection technology. Specifically, it is a ship detection method based on a small target detection head and global-local feature fusion, which is particularly suitable for high-precision detection and classification of small ship targets in UAV aerial images against a complex sea surface background. Background Technology

[0002] With the development of the global maritime economy and the evolution of the geopolitical landscape, maritime situational awareness places extremely high demands on the identification and refined recognition of non-cooperative targets. Current technologies primarily rely on radar, satellite remote sensing, and shore-based surveillance, but these have significant shortcomings in terms of real-time performance and evidence collection effectiveness in modern combat: radar systems can only detect the presence and location of targets, but cannot acquire detailed image images, making it difficult to meet the need for extracting certain key information about ships. Satellite imaging is limited by orbital periods and weather conditions, resulting in significant data acquisition delays and a single perspective; shore-based optical equipment is limited by the curvature of the Earth, making it difficult to cover distant sea areas and ineffective against highly maneuverable targets.

[0003] Unmanned aerial vehicle (UAV) visual recognition systems for ships face three major technical bottlenecks in complex sea conditions: First, feature loss due to miniaturization. High-altitude wide-field-of-view results in a very low target pixel ratio (usually less than 32×32 pixels), and multi-layer downsampling processes severely attenuate the geometric edge features of small targets, leading to a high false alarm rate. Second, reduced signal-to-noise ratio under strong background noise. Dynamic wave textures, sunlight reflections, and dense fog are highly similar to the visual features of small targets, resulting in severe spectral aliasing and false alarm interference. Finally, the contradiction between real-time performance and generalization. Domain differences between satellite overhead view training data and UAV head-up view lead to insufficient model generalization ability, while high-precision large models have high inference latency, making it difficult to meet high-speed locking requirements.

[0004] In existing research, general-purpose target detection algorithms suffer feature loss due to receptive field matching problems when dealing with small targets; existing feature fusion mechanisms lack the ability to suppress background noise from the sea surface, making them prone to misjudgment; large models such as Transformer have excessive computational overhead, while lightweight models lack robustness against interference. These technical deficiencies severely restrict the perception performance and application effectiveness of UAVs in practical scenarios such as anti-ship evidence collection, rapid identification, and real-time tracking. Summary of the Invention

[0005] This invention addresses the technical bottlenecks in wide-area search scenarios using unmanned aerial vehicles (UAVs), such as the loss of small ship target features due to multiple downsampling, feature attenuation in the traditional feature pyramid (FPN+PAN) structure during cross-level information transmission, and the high computational cost and slow inference speed of complex global attention models based on Transformer. It provides a ship detection method based on a small target detection head and global-local feature fusion. By constructing an independent small target detection head and a lightweight global context routing (GCR) feature fusion mechanism, it achieves rapid locking and real-time accurate detection of small targets on the sea surface.

[0006] This invention relates to a method for detecting small targets (ships) on the sea surface by unmanned aerial vehicles (UAVs) based on a small target detection head and global-local feature fusion, comprising the following steps:

[0007] Step S100: Construct a dataset of ships on the sea surface, perform image annotation and normalization, apply mosaic data augmentation, and generate training samples.

[0008] Using drone-borne optoelectronic equipment, aerial photography was conducted at different heights and angles to collect visible light images of ships on the sea surface. The data includes image pixel matrices, target category labels, bounding box coordinates, and other information for four types of effective targets: fishing boats, passenger ships, cargo ships, and warships.

[0009] To address the challenges of large differences in target scale and environmental interference on the sea surface, a standardized data preprocessing workflow was constructed, which included manual annotation, format normalization conversion, and dataset partitioning. Subsequently, a mosaic data augmentation technique was introduced, which generated highly robust training samples through geometric stitching and photometric distortion simulation.

[0010] Image preprocessing and enhancement, specifically:

[0011] Considering that small targets are prone to feature loss during downsampling, the original image is first... The bilinear interpolation method was uniformly adopted to adjust the input size to a high resolution. and pixel values Mapping from [0, 255] to the interval [0, 1] to eliminate the influence of dimensions and accelerate network convergence, the normalization formula is:

[0012] ;

[0013] To adapt to the small target detection head built in subsequent steps;

[0014] To address the issues of a monotonous sea surface background and insufficient small target samples, a mosaic augmentation technique is employed.

[0015] During the training phase, four training set images are randomly selected. Set a random center split point The four images were randomly scaled and cropped and then stitched together into the same large image.

[0016] In this process, to simulate complex lighting environments, the brightness and darkness of the HSV color space are adjusted by converting the image from RGB space to HSV space and adjusting the brightness component. The nonlinear perturbation is calculated using the following formula:

[0017] ;

[0018] In the formula, For random gain coefficients, This is the brightness offset, and its value must be constrained to the range [0,1].

[0019] Meanwhile, in the stitched new image, the coordinates of the target bounding box It needs to be based on the step size (Stride). Translation offset Perform a remapping, transforming the relationship as follows:

[0020] ;

[0021] The synthesized new image is obtained through the above processing. It not only enriches the background semantic information, but also significantly increases the number of small targets in a single image, effectively improving the model's robustness to scale changes and illumination interference.

[0022] Step S200: Construct a feature extraction network containing independent small target detection heads, extract shallow high-resolution features, and adopt an adaptive anchor box optimization mechanism:

[0023] Using the normalized image data provided by S100 as input, this step aims to overcome the defect of traditional general detection algorithms that cause the loss of small target features due to excessive downsampling.

[0024] This invention constructs an independent small target detection branch, which intelligently utilizes shallow high-resolution feature maps. The algorithm extracts shallow features (resolution 320×320) with a downsampling factor of 4 along the depth direction of the backbone network, and lays up dense anchor frames within this scale.

[0025] Within the extracted shallow high-resolution feature space, convolutional feature modeling is performed on the texture edges of the small ship target. The local response of each feature point is calculated using a convolution kernel function to generate a high-resolution feature map. The calculation formula is: .

[0026] Based on the extracted feature maps, the detection head convolutional layer maps them into prediction parameter tensors. .

[0027] To address the issue of extremely small ship target size (e.g., less than 15 pixels) caused by changes in UAV flight altitude, this step further introduces an adaptive anchor frame optimization mechanism to calculate the average matching metric between the true bounding box set and the center of the candidate anchor frame cluster. when When the set threshold is exceeded, the current preset anchor frame is determined to be mismatched, and the genetic algorithm is triggered to mutate and evolve the anchor frame size to generate a special anchor frame size for small targets, thereby significantly improving the recall rate of small targets;

[0028] Finally, this step outputs a feature set containing four scales. ,in This is a newly added shallow high-resolution feature.

[0029] Step S300: Construct a global-local collaborative interaction mechanism to aggregate low-level texture features and high-level semantic features:

[0030] The core task of this step is to solve the problem of small target information attenuation caused by the layer-by-layer transmission of traditional feature pyramids. A global-local collaborative interaction mechanism is introduced to aggregate spatial details and semantic information scattered at different scales through unified feature alignment and multi-dimensional mapping.

[0031] First, a uniform feature alignment operation is performed to eliminate differences in spatial resolution between feature maps at different levels. Average pooling is used for shallow features, and bilinear interpolation is used for deep features, unifying the feature mapping to the target size. After alignment, the algorithm constructs two aggregation branches in parallel:

[0032] The low-order texture aggregation branch performs channel concatenation on the aligned full-scale features and uses lightweight convolution to generate low-order global features. It is specifically designed to capture detailed features such as the edges and outlines of ship targets;

[0033] The high-order semantic aggregation branch selects a subset of deep semantic features and introduces a multi-head self-attention mechanism (MHSA). To compensate for the feature loss caused by the scarcity of pixels in small ship targets, it calculates the query, key-value matrix, and attention weights. Output the enhanced global semantic descriptor

[0034] This process demonstrates how the model uses global information to dynamically weight features, thereby establishing feature contextual relationships.

[0035] Step S400: Construct a dynamic information distribution and injection network by building an adaptive gated injection module to fuse global and local features.

[0036] The low-order features generated in step S300 With higher-order features As global prior knowledge, it provides accurate feedback and correction for multi-scale local features;

[0037] This step involves designing a dynamic information distribution and injection network. First, it performs spatial remapping and distribution of global information, constructing a multi-scale broadcast module based on the spatial resolution of the target level. The global descriptors are adaptively transformed and fused into a unified global injection source.

[0038] For shallow branches, texture details are prioritized; for deep branches, semantic information is prioritized. The mapping formula is:

[0039] The core step is to build the Adaptive Gated Injection Module (AGIM). Traditional direct addition often leads to the burying of local details. Therefore, this step designs a gating mechanism based on segmentation-interaction-fusion:

[0040] Local features Segmented to preserve topological information and those who participate in the interaction By calculating the attention gating coefficient Dynamically adjust injection intensity The physical meaning of this formula is to automatically determine the region attributes. If it is ocean clutter, the global semantic weight is increased to suppress false detections. If it is a ship target, more local details are preserved.

[0041] Finally, feature reconstruction is performed, concatenating interactive features with preserved local features, and generating the final enhanced feature pyramid through smooth convolution. .

[0042] Step S500: Based on the enhanced multi-scale feature map, a detection mechanism that combines classification and regression in an independent and parallel manner is adopted to output the ship detection results.

[0043] This step receives the enhanced feature pyramid output from step S400. To address the different feature requirements of classification and recognition tasks, a processing mechanism was designed that allows for independent and parallel processing of classification and regression branches. This mechanism constructs a dual-branch structure that does not interfere with each other, extracting the required feature information for each branch. The classification branch calculates the class confidence score, and the regression branch calculates the bounding box coordinates. This effectively avoids feature conflicts caused by parameter sharing in traditional algorithms, and ultimately outputs high-precision recognition and classification results for small target ships.

[0044] The method of this invention solves the problem of missed detection caused by the weak target feature representation ability of small ships, and significantly improves the recognition and classification accuracy of small target ships under UAV vision, which has important application value and practical significance. Attached Figure Description

[0045] Figure 1 This is a flowchart illustrating the ship target detection method in an embodiment.

[0046] Figure 2 This is a schematic diagram of the structure of a small target detection head for shallow high-resolution features in an embodiment.

[0047] Figure 3 This is a schematic diagram of the global information aggregation network process of the GCR mechanism in the embodiment;

[0048] Figure 4 This is a schematic diagram of the dynamic information distribution and injection network process of the DIM network in the embodiment;

[0049] Figure 5 These are images of detection results in different scenarios in the embodiments;

[0050] Among them, (a) is a scene of densely packed fishing boats in the near sea under foggy weather, (b) is a scene of yachts moored at the dock under sunny weather, (c) is a scene of fishing boats operating in the mid-to-far sea under wave interference, and (d) is a scene of warships sailing under low light conditions.

[0051] Figure 6 This is a comparison chart of the performance differences between the confusion matrix in the embodiment and the method of the present invention on the target;

[0052] Wherein, (a) is the confusion matrix of the baseline model, and (b) is the confusion matrix using the method of the present invention. Detailed Implementation

[0053] To better understand the technical solution of the present invention, the following detailed description of the present invention is provided in conjunction with the accompanying drawings and embodiments, but this is not intended to limit the present invention.

[0054] Example

[0055] Ship detection method based on small target detection head and improved feature fusion, referring to Figure 1 This includes the following steps:

[0056] Step S100, Data Preprocessing and Image Enhancement:

[0057] This step is the foundation of the entire method. The key is to acquire high-quality training data and eliminate discrepancies to accelerate network convergence. In specific implementation, aerial photography is carried out using UAV-borne optoelectronic equipment at different heights and angles to collect visible light images of ships on the sea surface. The data includes image pixel matrices, target category labels, bounding box coordinates, and other information for four types of effective targets: fishing boats, passenger ships, cargo ships, and warships. The UAV aerial images are then input into electronic devices to construct a sea surface ship dataset and perform image preprocessing.

[0058] To address the challenges of large differences in target scale and environmental interference on the sea surface, a standardized data processing workflow was constructed, involving manual annotation, format normalization, and dataset partitioning. Subsequently, a mosaic data augmentation technique was introduced, using geometric stitching and photometric distortion simulation to generate highly robust training samples. Specifically:

[0059] Data annotation and format conversion, specifically:

[0060] The selected images were manually annotated using the image annotation tool LabelImg.

[0061] Use a bounding box to tightly select ship targets and confirm the target category label;

[0062] To adapt to the input requirements of the YOLO algorithm, a mapping relationship between the pixel coordinate system and the normalized coordinate system is established, and the annotation file is converted to .txt format;

[0063] Let the coordinates of the top-left corner of the target bounding box in the original image be... The coordinates of the lower right corner are The image width is The height is Then the normalized center coordinates and width and height The calculation formula is:

[0064] ;

[0065] Ultimately, each target is represented as a quintuple containing category index and location information. To ensure data compatibility.

[0066] The dataset partitioning process is as follows:

[0067] To ensure the objectivity of the model evaluation, let the total number of samples in the dataset be... The random scrambling algorithm is used to generate an index sequence, and the dataset is divided into three mutually exclusive subsets in an 8:1:1 ratio.

[0068] Training Set: Used for weight parameters Gradient descent update;

[0069] Validation Set: Used to monitor the loss function. The changing trend and hyperparameter tuning;

[0070] Test Set: Used to evaluate the generalization performance metrics of the model, such as mAP (mean precision) and recall.

[0071] Image preprocessing and enhancement, specifically:

[0072] Considering that small targets are prone to feature loss during downsampling, the original image is first... The bilinear interpolation method was uniformly adopted to adjust the input size to a high resolution. and pixel values Mapping from [0, 255] to the interval [0, 1] to eliminate the influence of dimensions and accelerate network convergence, the normalization formula is:

[0073] ;

[0074] To adapt to the small target detection head built in subsequent steps;

[0075] To address the issues of monotonous sea surface backgrounds and insufficient small target samples, a mosaic augmentation technique is employed. During the training phase, four training set images are randomly selected. Set a random center split point The four images were randomly scaled and cropped and then stitched together into the same large image.

[0076] To simulate complex lighting environments, the brightness and darkness of the HSV color space are adjusted, and the calculation formula is as follows:

[0077] Meanwhile, in the stitched new image, the coordinates of the target bounding box It needs to be based on the step size (Stride). Translation offset Perform a remapping, transforming the relationship as follows:

[0078] ;

[0079] The synthesized new image is obtained through the above processing. It not only enriches the background semantic information, but also significantly increases the number of small targets in a single image, effectively improving the model's robustness to scale changes and illumination interference.

[0080] Step S200: Feature extraction and construction of a small target detection head based on shallow high-resolution features, refer to... Figure 1 and Figure 2 ;

[0081] Based on the normalized image data provided by S100, a feature extraction backbone network with four detection scales is constructed. Hierarchical feature abstraction is used to convolve and downsample the preprocessed image to construct an independent small target detection branch. Using shallow high-resolution feature maps, the algorithm extracts shallow features with a downsampling factor of 4 (resolution 320×320) along the depth direction of the backbone network and lays out dense anchor boxes within this scale.

[0082] Within the extracted shallow high-resolution feature space, convolutional feature modeling (approximately nonlinear mapping) is performed on the texture edges of the small ship target. Then, the feature response intensity within each spatial unit is statistically analyzed to generate a high-resolution, enhanced small target feature map containing rich high-frequency texture and edge information. A lightweight convolutional detection head is used to process this feature map, and prediction vectors are extracted based on the feature channel mapping relationship. This accurately extracts a set of discrete small ship prediction boxes. Specifically, high-resolution feature mapping is performed, and the local response and channel features of each feature point are calculated using a convolutional kernel function. The calculation formula is as follows: ;

[0083] In the formula, Indicates the shallow feature map in coordinates First The output values ​​of each channel; This represents the preprocessed image input in step S100; This represents the weight matrix of the k-th convolutional kernel. For bias terms; This indicates the step size (Stride). =4, corresponding to a 4x downsampling; This represents the activation function, used to introduce non-linear features.

[0084] Based on the extracted feature map A dedicated small object detection head is constructed, which maps high-dimensional features into prediction parameter tensors through 1×1 convolutions. The output tensor corresponds to each grid position. There are several pre-defined anchor boxes, each containing a position offset, confidence score, and class probability. The mapping formula is as follows:

[0085] ;

[0086] In the formula, and These represent the weight matrix and bias vector of the detection head convolutional layer, respectively; 'a' represents the index of the a-th anchor box at the current grid position. The final output prediction vector has dimensions of .

[0087] The predicted parameters output by the detection head are decoded, and the relative offset is mapped back to the image coordinate system to form the predicted bounding box value of the small target. The calculation formula is as follows:

[0088] ;

[0089] In the formula, The center coordinates of the prediction box The width and height of the predicted bounding box;

[0090] The regression offset parameter output by the network;

[0091] This represents the coordinates of the top-left corner of the current feature grid cell;

[0092] Define the width and height of the preset anchor priority;

[0093] This is the Sigmoid function, which constrains the output to the interval (0,1).

[0094] The fixed anchor frame size used in the above processing performs well in the detection area of ​​conventional sea surface targets; however, when the flight altitude of the UAV changes and the ship target is extremely small in the image (e.g., less than 15 pixels) or the scale changes drastically, the fixed anchor frame ratio is difficult to accurately match the geometric features of the small target.

[0095] For a set of real bounding boxes labeled manually (Sorted strictly by target area size), calculate its relationship with... Center of each candidate anchor frame cluster Average matching metric The calculation formula is:

[0096] ;

[0097] In the formula: This indicates the current cluster fitness index;

[0098] The total number of samples;

[0099] For the first The width and height data of a real target;

[0100] For the first Width and height data of each cluster center;

[0101] It is the intersection-union ratio function;

[0102] Based on fitness index Execute adaptive decision-making: when When the set threshold is exceeded, the current preset anchor frame is determined to be mismatched, triggering the genetic algorithm to mutate and evolve the anchor frame size, generating 3 sets of special anchor frame sizes for small targets, and assigning them specifically to the shallow small target detection head, thereby significantly improving the recall rate of small targets;

[0103] After the above processing, this step finally outputs a feature set containing four scales. in, The newly added shallow high-resolution features in this step are specifically designed for capturing small targets; while It is responsible for detecting medium and large targets. This multi-scale feature set, which contains rich spatial details and deep semantic information, will be sent to the improved feature fusion network based on the GCR mechanism in step S300 for cross-scale information interaction and enhancement, so as to further suppress sea clutter interference and improve detection accuracy.

[0104] Step S300, the global information aggregation network based on the GCR mechanism, refer to Figure 1 and Figure 3 ;

[0105] Construct a global information aggregation network based on the GCR mechanism. Step S200 outputs a feature set containing four scales. To address the issue of feature information attenuation and loss in small ships during the layer-by-layer transmission of traditional pyramid structures, this step introduces a global-local collaborative interaction mechanism. The core of this stage lies in overcoming the limitations of feature fusion between adjacent levels by constructing a global information aggregation module. Through unified size adjustment and feature fusion, it brings together detailed and semantic information scattered across different scales, enabling the model to see both local details and grasp the overall sea conditions.

[0106] First, to achieve cross-level information exchange, the system needs to eliminate the size differences between feature maps and perform a unified alignment operation on multi-scale features. This alignment operation is implemented through two parallel paths, employing a differentiated strategy to adapt to the needs of different paths. In the T-Low path, for high-level features... and Downsampling is performed using average pooling (AvgPool) to optimize the low-level high-resolution features. Upsampling is performed using bilinear interpolation while maintaining... The scale remains unchanged, and finally, the data is stitched together and fused using convolution; however, in the T-High path, the... Downsampling is performed using average pooling (AvgPool) to maintain... Without changing the initial state, feature enhancement is then achieved through concatenation and multi-head attention mechanisms. This design ensures that features from different levels are scale-consistent before integration, while retaining representative information of each layer through path-specific processing.

[0107] Let the preset uniform alignment target size be... Then the aligned feature mapping process can be described by the following formula:

[0108] ;

[0109] In the formula, For the input of the first Layer feature map, The size of the current feature map. This is the scaling factor.

[0110] After feature alignment is completed, the algorithm constructs a low-order texture aggregation branch, specifically designed to capture detailed features such as edges and contours of ship targets. This branch integrates the aligned full-scale feature set. By stitching together the channels, a fused feature map containing rich details is formed;

[0111] Subsequently, a lightweight convolution module is used to process and reduce the dimensionality of the feature map, thereby generating low-order global features. The calculation logic is as follows:

[0112] ;

[0113] In the formula, This indicates a splicing operation along the channel dimension. and To fuse the weights and biases of convolutional layers, For activation function, This is for batch normalization operations.

[0114] Meanwhile, to compensate for the lack of features caused by the limited number of pixels in small ship targets, the algorithm constructs a high-order semantic aggregation branch in parallel. This branch selects a subset of features containing deep semantics. Align and aggregate again.

[0115] To capture long-range global dependencies, i.e., to utilize the extensive sea surface environment context to assist in determining the ship's position, a multi-head self-attention (MHSA) mechanism is introduced in higher-order branches to capture global contextual information. Specifically:

[0116] Let the higher-order features after aggregation be It is converted into a sequence form and input into the Transformer module, which then outputs enhanced global semantic features through self-attention operations. The core calculation process is as follows:

[0117] ;

[0118] ;

[0119] ;

[0120] In the formula, These are the query, key, and value matrices, respectively. It is a linear projection matrix; The scaling factor, as defined in the formula, demonstrates how the model uses global information to dynamically weight features, thereby effectively suppressing ocean clutter backgrounds and highlighting small ship targets.

[0121] After the deep aggregation process described above, step S300 ultimately generates two key features in two dimensions: low-order features that lock in the appearance details of small targets. and high-order features for locking sea surface environmental information These two sets of features break through the limitations of a single perspective and constitute complete global prior information. These features will serve as core inputs and be fed into the dynamic information distribution and injection network in step S400. Through a feedback mechanism, the feature representation capabilities at each detection scale will be precisely enhanced.

[0122] Step S400, Dynamic information distribution and injection network based on DIM network, refer to Figure 1 and Figure 4 ;

[0123] Low-order features generated by S300 With higher-order features This step aims to utilize this global information to accurately supplement and enhance local features at various scales.

[0124] The Dynamic Information Distribution and Injection Network (DIM) constructs an adaptive distribution link to accurately distribute global information to each feature pyramid level. With the help of an adaptive gating injection mechanism, the network can reconstruct features while preserving the original spatial details, thereby fundamentally enhancing the feature response strength of detection units at each scale, especially the small target detection branch of S200 to the ship.

[0125] First, the global information is resized and distributed. Since the global features generated in step S300 are highly compressed features, their scale is similar to the original feature pyramid. Because of the mismatch, a multi-scale distribution module is first constructed based on the spatial resolution of the target level. low-order features and higher-order features Each branch undergoes adaptive size adjustment; for shallow high-resolution branches Prioritize the distribution of content containing texture details. Bilinear interpolation is used to upsample it to the same level as... The same 320×320 scale is used to supplement details that are easily lost in small targets, for deep semantic branches. Then, the distribution will be prioritized. .

[0126] To achieve more precise adjustments, the two are weighted and merged into a unified global injection source. Regarding the first The mapping formula for layer features is as follows:

[0127] ;

[0128] In the formula, For the first Spatial dimensions of layer feature maps;

[0129] For spatial alignment operations,

[0130] and These are learnable weighting coefficients for different levels;

[0131] After accurately distributing global information, the core step is to build an Adaptive Gated Injection Module (AGIM) to distribute the global information. fused into local features middle.

[0132] Traditional direct addition can easily lead to the subtle details of small targets being swallowed up by strong global features. To address this, this step designs a strategy based on splitting, interacting, and fusing. Specifically, it first separates local features... Split into two parts along the channel dimension and Simply retain it without any modifications to maintain the original spatial details, and Then responsible for global features Interact;

[0133] The intensity of global information injection is dynamically adjusted by calculating the gating coefficient (Attention Gate). The mathematical model is as follows:

[0134]

[0135] In the formula, The Sigmoid activation function generates The gating coefficient matrix, The Hadamard product (element-wise multiplication) is a formula whose physical meaning is that the model automatically determines whether the target is a ship. If it is a ship target, the interference of global weights is reduced to preserve more local details (α→0); if it is the background, global information is used for filtering.

[0136] Finally, feature reconstruction and output are performed, resulting in enhanced interaction features. With preserved local features The features are concatenated and then integrated through a 3×3 convolutional layer to eliminate differences between channels, generating the final enhanced feature pyramid. This reconstruction process recovers the edge information lost by the small target during multiple downsampling processes, and its final output formula is:

[0137] ;

[0138] After processing in step S400, the output feature set is... It possesses the high-resolution advantage of shallow features in S200 and integrates the correlation information of global context in S300. This set of features will be fed into the final detection head network to calculate the precise bounding box coordinates and class confidence of ship targets, thereby achieving high-precision UAV ship visual recognition and classification in all weather and at multiple scales.

[0139] Step S500: Based on the enhanced multi-scale feature map, a detection mechanism that combines classification and regression in an independent and parallel manner is adopted to output the ship detection results, and the detection results are verified, referring to... Figure 1 , Figure 5 and Figure 6 ;

[0140] Receive the enhanced feature pyramid output in step S400 To address the different feature requirements of classification and recognition tasks, a processing mechanism was designed that allows for independent and parallel processing of classification and regression branches to handle the classification and regression tasks respectively. The category confidence is calculated from the classification branch, and the bounding box coordinates are calculated from the regression branch. Finally, high-precision recognition and classification results for small target ships are output.

[0141] To verify the effectiveness of the invention, detection results in different scenarios, such as Figure 5 As shown. Figure 5 This paper demonstrates the detection performance of the method of this invention on ship targets of different sizes under complex sea surface backgrounds, including four challenging scenario tests, which fully demonstrate the model's accurate identification capability for small targets. Among them, 5(a) shows a dense scene of fishing boats in nearshore waters under light fog. In this scene, the target ships appear as blurry targets with a small pixel ratio due to their distance and low visibility. The model successfully detected multiple fishing boats and cargo ships, with confidence scores of 0.83, 0.89, and 0.90 for fishing boats and 0.92 for cargo ships. This shows that even with small target size and the influence of weather conditions, the method of this invention can still maintain high detection accuracy. The model can effectively distinguish densely packed small targets and avoid false detections and false negatives.

[0142] Image 5(b) shows a scene of passenger ships docking at a pier on a sunny day. Although the lighting conditions are ideal, the yachts and fishing boats differ significantly in size, and the fishing boats have a very low pixel count and are similar in color to the pier background, increasing the difficulty of detection. The model accurately identified the passenger ships and fishing boats in the detection results, with a confidence score of 0.96 for typical targets (passenger ships) and 0.86 for fishing boats. This demonstrates the superiority of this invention in extracting features from small targets, maintaining stable performance even in complex pier areas.

[0143] Figure 5(c) illustrates a scenario of fishing vessel operations in the mid-to-far seas under wave interference. In this scenario, the cargo ship and fishing vessel targets differ significantly in size and are subject to strong interference from sea waves. The model successfully detected both the cargo ship and fishing vessel targets, with confidence scores of 0.88 and 0.90 for the cargo ship and 0.61 for the fishing vessel. This demonstrates that the present invention maintains a balanced and reliable detection capability even when facing multiple targets with significant size differences.

[0144] 5(d) shows a warship navigation scene under low light conditions. Under insufficient light, the model successfully detected two warships with confidence levels of 0.83 and 0.81, respectively, indicating that the model still has stable detection capabilities under low light conditions.

[0145] As shown in the figure, even when faced with extremely low target pixel ratios due to high-altitude wide-field-of-view conditions, and background noise interference from wave wakes and dense fog, the detection method of this invention can still accurately identify small ship targets and provide a high confidence level. The average detection confidence level in various scenarios exceeds 0.80, fully demonstrating the robustness and reliability of the detection method under different sea conditions and lighting conditions. Specifically, the model can still achieve a detection confidence level of 0.92 under light fog conditions, an extremely high accuracy of 0.96 under clear weather conditions, a reliable detection level of 0.90 under wave interference, and a stable performance of 0.83 under low light conditions. This indicates that the method of this invention has excellent adaptability to various complex sea surface backgrounds.

[0146] To further quantify and evaluate the effect of the method of the present invention on the feature enhancement of small targets, Figure 6 The performance differences of the improved model across five target classes are illustrated using a confusion matrix comparison. The confusion matrices in the figures have been standardized. 6(a) shows the confusion matrix of the baseline model, and 6(b) shows the result after incorporating the method of this invention. From the color distribution of the confusion matrix, the blue of the main diagonal (representing correct predictions) in 6(b) is significantly darker, indicating a significant improvement in the prediction accuracy for each target class. Conversely, the blue of the off-diagonal (representing misjudgments) is significantly lighter, indicating a significant reduction in inter-class confusion. The recognition accuracy for fishingships, passenger ships, cargo ships, warships, and backgrounds improves from 0.85, 0.86, 0.88, 0.88, and 0.85 to 0.92, 0.91, 0.90, 0.93, and 0.94, respectively. In particular, the accuracy for fishing boats was significantly improved, with severe misclassifications between fishing boats and the background reduced to 0.03 and 0.02 respectively, verifying the effectiveness of the shallow detail preservation mechanism for small target feature extraction. The probability of misclassification between other ship categories was also generally reduced, such as the confusion between fishing boats and passenger ships, and cargo ships and warships. This demonstrates that the GCR and DIM mechanisms effectively enhance the distinguishability of small target ships from the background and improve inter-class discriminability through global-local feature interaction. In summary, this invention achieves breakthroughs in accuracy, robustness, and specificity of small target detection through feature enhancement mechanisms.

[0147] Comprehensive experiments show that the present invention achieves an average detection accuracy of 90% for small target ships, a significant improvement over baseline methods, verifying the significant advantage of the proposed method in enhancing the feature representation capability of small targets. Compared to the missed detections and false positives that are prone to occur in existing technologies, the present invention preserves shallow details through the small target detection head of S200, and achieves deep feature fusion and enhancement through the GCR and DIM mechanisms in S300 and S400. Combined with the fusion strategy of GCR and DIM, the model's ability to recover the geometric details of ship targets is enhanced, significantly alleviating the feature loss problem caused by downsampling, and realizing the identification and classification of small target ships under high-precision UAV vision.

Claims

1. A ship detection method based on a small target detection head and improved feature fusion, characterized in that, Includes the following steps: Step S100: Construct a dataset of ships on the sea surface, perform image annotation and normalization, use mosaic data augmentation, and generate training samples; Step S200: Construct a feature extraction network containing independent small target detection heads, extract shallow high-resolution features, and adopt an adaptive anchor box optimization mechanism; Step S300: Construct a global-local collaborative interaction mechanism to aggregate low-level texture features and high-level semantic features; Step S400: Construct a dynamic information distribution and injection network by building an adaptive gated injection module to fuse global and local features; Step S500: Based on the enhanced multi-scale feature map, a detection mechanism that combines classification and regression in an independent and parallel manner is adopted to output the ship detection results.

2. The method according to claim 1, characterized in that, The mosaic data enhancement in step S100 includes: Four images were randomly selected, scaled, cropped, and then stitched together into the same image. Simulating complex lighting conditions, the image is converted from RGB space to HSV space by introducing dark and bright adjustment in the HSV color space and non-linear perturbation of the brightness component. The coordinates of the target bounding box in the stitched new image are remapped to ensure consistent annotation.

3. The method according to claim 2, characterized in that, The formula for calculating the nonlinear disturbance is: ; In the formula, For random gain coefficients, This is the brightness offset, and its value must be constrained to the range of [0, 1]. The target bounding box coordinates According to step size Translation offset Perform a remapping, and the transformation relationship is as follows: 。 4. The method according to claim 1, characterized in that, The adaptive anchor box optimization in step S200 includes: Calculate the matching metric between the actual bounding box and the preset anchor box; When the matching degree exceeds the set threshold, a genetic algorithm is used to optimize the anchor frame size; The optimized anchor frame is specifically designed for shallow small target detection heads.

5. The method according to claim 4, characterized in that, The matching metric The calculation formula is: ; In the formula: This indicates the current cluster fitness index; The total number of samples; For the first The width and height data of a real target; For the first Width and height data of each cluster center; It is the intersection-union ratio function.

6. The method according to claim 1, characterized in that, Step S300 includes: Perform a unified alignment operation on multi-scale features; Construct low-order texture aggregation branches and high-order semantic aggregation branches; A multi-head self-attention mechanism is introduced in higher-order branches to capture global context information.

7. The method according to claim 1, characterized in that, The adaptive gated injection module in step S400 includes: Local features are split into retained parts and interactive parts; Calculate the gating coefficient and dynamically adjust the injection strength of global information; The enhanced feature map is reconstructed through feature concatenation and convolution.

8. The method according to claim 7, characterized in that, The mathematical model for calculating the gating coefficient is as follows: In the formula, The Sigmoid activation function generates The gating coefficient matrix, The Hadamard product, as expressed in the formula, has the physical meaning that the model automatically determines whether the target is a ship. If it is a ship target, the interference of global weights is reduced to preserve more local details (α→0); if it is the background, global information is used for filtering.

9. The method according to claim 1, characterized in that, The independent parallel mechanism for classification and regression in step S500 includes: Construct a dual-branch detection head to handle classification and regression tasks separately; Output bounding box coordinates, confidence score, and class probability.

10. An electronic device comprising a processor and a memory, characterized in that, The memory stores a computer program, and the processor executes the program to implement the method as described in any one of claims 1-8.