Adaptive detection method, device and equipment for remote sensing image ship target

By constructing a dynamic sampling coordinate system and a fusion weight strategy of a gating network, the problem of insufficient sampling point distribution in ship target detection in remote sensing images is solved, achieving accurate focusing of the ship's outline and improving detection accuracy and robustness.

CN122135309APending Publication Date: 2026-06-02INST OF AUTOMATION CHINESE ACAD OF SCI

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
INST OF AUTOMATION CHINESE ACAD OF SCI
Filing Date
2026-02-03
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

Existing technologies lack sufficient sampling point distribution strategies for multi-scale deformable attention mechanisms, making it difficult to effectively focus on ship targets in remote sensing images that are tilted at arbitrary angles, have elongated shapes, large scale differences, and are densely distributed, resulting in low detection accuracy.

Method used

A dynamic sampling coordinate system based on the reference points of the ship target is constructed, and sampling points are generated in the main diagonal and sub-diagonal directions. A fusion weight is generated through a gating network, and feature aggregation sampling is performed to improve detection accuracy.

Benefits of technology

It improves the accuracy and robustness of ship target detection in remote sensing images, overcomes the diffusion of traditional grid sampling strategies, and can accurately focus on the ship outline while avoiding background interference.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122135309A_ABST
    Figure CN122135309A_ABST
Patent Text Reader

Abstract

This invention provides an adaptive detection method, apparatus, and device for ship targets in remote sensing images. The method includes: constructing a main diagonal direction and a secondary diagonal direction strongly correlated with the geometric shape of the ship target based on reference points of the ship target, and generating main diagonal sampling points and secondary diagonal sampling points along these two directions. This allows the feature sampling area to be distributed along the possible slender structure of the ship target, overcoming the diffusion of traditional grid sampling strategies. By using a gating network to dynamically generate fusion weights based on the feature responses of the main diagonal direction and the secondary diagonal direction, the actual tilt direction of the ship's body can be adaptively determined, thereby enabling the aggregated sampling to accurately focus on the ship itself. This effectively solves the technical problem that the distribution of sampling points is difficult to fit the ship's contour when processing slender, tilted ship targets, improving the feature extraction accuracy of ship targets and ensuring the accuracy of ship target detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of target detection technology, and in particular to an adaptive detection method, apparatus, and equipment for ship targets in remote sensing images. Background Technology

[0002] Ship detection aims to automatically identify and locate various ship targets from multi-source images such as remote sensing images and video surveillance. It is a core foundational technology for important scenarios such as intelligent maritime supervision, shipping safety, and port operation and maintenance. In recent years, with the rapid development of high-resolution Earth observation technology, we have been able to acquire massive amounts of high-definition remote sensing image data, providing a data foundation for refined target detection. At the same time, detection methods based on the Transformer architecture have abandoned the local inductive bias of traditional convolutional neural networks. With its powerful global context information modeling capabilities and flexible feature expression mechanisms, it has shown excellent performance in natural scene target detection and has been gradually introduced into the field of remote sensing image interpretation. Among the many Transformer-based detection models, DeformableDETR (Deformable Transformers for End-to-End Object Detection) represents a significant technological breakthrough. It innovatively introduces a deformable attention mechanism, effectively solving the bottlenecks of high computational cost and slow convergence speed of the original DETR model. This mechanism allows the model to no longer perform global attention calculations on all locations in the feature map, but instead adaptively distribute a small number of sampling points at key locations in the feature space according to the query. This dynamic focusing capability makes it particularly adept at handling irregularly shaped and structurally complex non-rigid targets, providing a highly promising new technological path for solving target detection tasks such as ships, which often exhibit significant tilting, scaling, and deformation characteristics. To further improve performance, its derivative model, RF-DETR, integrates the cutting-edge DINOv2 (Distillation with No Labels version 2) model as the feature extraction backbone network and adopts a more efficient lightweight architecture design, achieving a significant leap in detection capabilities. The DINOv2 backbone network, through self-supervised pre-training on large-scale datasets, possesses stronger general visual representation capabilities and can extract more discriminative features. This allows RF-DETR to significantly enhance the robustness of representation for complex-shaped ship targets and the final detection accuracy while inheriting the efficiency and flexibility of deformable attention mechanisms.

[0003] Despite these challenges, ship detection tasks still face numerous technical difficulties. Ship targets exhibit a high degree of uncertainty in their morphology. Their scale varies significantly, ranging from large cargo ships tens of meters long to small fishing boats only a few meters long, all coexisting in the same scene; their shapes are complex, with passenger ships, cargo ships, and warships possessing drastically different superstructures and outlines; their spatial attitudes are diverse, specifically manifested in targets often exhibiting arbitrary angles of tilt and rotation, and significant differences in length-to-width ratios giving many ships a distinctly elongated structure. Furthermore, ports and nearshore areas often see densely distributed small-scale targets, and severe occlusion and overlap between ships further complicate target separation and identification. While the multi-scale deformable attention mechanism widely used in existing methods possesses some geometric perception capabilities, its sampling point distribution strategy remains insufficient. This mechanism performs well when dealing with conventional targets, but when faced with slender targets such as ships with various random tilt angles, the ship's body is relatively small compared to the background area. The adaptive sampling points are affected by the background area and the distribution pattern is difficult to fully fit the tilted, narrow, or blurred hull outline. The overall distribution is still scattered, which reduces the accuracy of ship target detection in remote sensing images. Summary of the Invention

[0004] This invention provides an adaptive detection method, apparatus, and device for ship targets in remote sensing images, which addresses the significant shortcomings of existing multi-scale deformable attention mechanism sampling point distribution strategies. When faced with ship targets that are tilted at arbitrary angles, have long and narrow shapes, large scale differences, and are densely distributed, the sampling points are difficult to effectively focus on the target body, are easily affected by background interference, and appear scattered, failing to accurately fit the ship's outline, resulting in low accuracy in detecting ship targets in remote sensing images.

[0005] This invention provides an adaptive detection method for ship targets in remote sensing images, comprising the following steps: Obtain multi-scale feature maps of the image to be detected; Based on the reference point of the ship target, a dynamic sampling coordinate system including the main diagonal direction and the secondary diagonal direction is constructed. Under the dynamic sampling coordinate system, main diagonal sampling points and secondary diagonal sampling points are generated along the main diagonal direction and the secondary diagonal direction, respectively. Based on the main diagonal sampling points and the secondary diagonal sampling points, the multi-scale feature map is sampled to obtain a first aggregated feature vector and a second aggregated feature vector. The high-dimensional response features of the main branch are determined based on the first aggregated feature vector, and the high-dimensional response features of the secondary branch are determined based on the second aggregated feature vector. The high-dimensional response features of the main branch and the high-dimensional response features of the secondary branch are input into a gating network to obtain the main gating fusion weights in the main diagonal direction and the secondary gating fusion weights in the secondary diagonal direction output by the gating network. Based on the main gating fusion weight, the secondary gating fusion weight, the first sampling position of the main diagonal sampling point, and the second sampling position of the secondary diagonal sampling point, the multi-scale feature map is aggregated and sampled to obtain the target features of the image to be detected. Based on the target features, the ship target is detected to obtain the ship target detection result.

[0006] An adaptive detection method for ship targets in remote sensing images provided by the present invention, wherein a dynamic sampling coordinate system including a main diagonal direction and a secondary diagonal direction is constructed based on a reference point of the ship target, comprising: Obtain the width and height of the reference point of the ship target; Determine the diagonal modulus based on the width and the height; Based on the diagonal modulus, the width, and the height, the main diagonal direction and the secondary diagonal direction are determined, and a dynamic sampling coordinate system including the main diagonal direction and the secondary diagonal direction is constructed.

[0007] An adaptive detection method for ship targets in remote sensing images according to the present invention, wherein determining the high-dimensional response features of the main branch based on the first aggregated feature vector and determining the high-dimensional response features of the sub-branch based on the second aggregated feature vector, includes: Based on the first aggregated feature vector, the main feature activation intensity response in the main diagonal direction is determined, and based on the second aggregated feature vector, the secondary feature activation intensity response in the sub-diagonal direction is determined. Based on the first aggregated feature vector and the preset query vector, a first semantic matching degree response feature is determined, and based on the second aggregated feature vector and the query vector, a second semantic matching degree response feature is determined. Based on the main feature activation intensity response, the first semantic matching degree response feature, the diagonal modulus, and the average sampling width, the main branch high-dimensional response feature is determined; the average sampling width is determined based on the first sampling width of the main diagonal sampling point and the second sampling width of the sub-diagonal sampling point. The high-dimensional response features of the sub-branch are determined based on the activation intensity response of the sub-feature, the second semantic matching degree response feature, the diagonal modulus, and the average sampling width.

[0008] An adaptive detection method for ship targets in remote sensing images according to the present invention further includes: Based on the query vector, the main diagonal direction, the diagonal modulus, the average sampling width, the width variation coefficient of the average sampling width, and the target area of ​​the ship target, the attention weight of the main sampling point in the main diagonal direction is determined. Based on the query vector, the sub-diagonal direction, the diagonal magnitude, the average sampling width, the width variation coefficient of the average sampling width, and the target area, determine the attention weight of the sub-sampling points in the sub-diagonal direction; The process of aggregating and sampling the multi-scale feature map based on the main gate fusion weight, the secondary gate fusion weight, the first sampling position of the main diagonal sampling point, and the second sampling position of the secondary diagonal sampling point to obtain the target features of the image to be detected includes: Based on the main gating fusion weight, the secondary gating fusion weight, the main sampling point attention weight, the secondary sampling point attention weight, the first sampling position of the main diagonal sampling point, and the second sampling position of the secondary diagonal sampling point, the multi-scale feature map is aggregated and sampled to obtain the target features of the image to be detected.

[0009] An adaptive detection method for ship targets in remote sensing images according to the present invention includes a step of aggregating and sampling the multi-scale feature map to obtain target features of the image to be detected based on the main gating fusion weight, the secondary gating fusion weight, the main sampling point attention weight, the secondary sampling point attention weight, the first sampling position of the main diagonal sampling point, and the second sampling position of the secondary diagonal sampling point. The method comprises: Based on the main gating fusion weight and the secondary gating fusion weight, the first sampling position and the second sampling position are weighted and fused to obtain the fused sampling position; Based on the main gating fusion weight and the secondary gating fusion weight, the main sampling point attention weight and the secondary sampling point attention weight are weighted and fused to obtain the fused attention weight; Based on the fusion sampling location and the fusion attention weight, the multi-scale feature map is weighted and aggregated to obtain the target feature.

[0010] An adaptive detection method for ship targets in remote sensing images according to the present invention includes generating main diagonal sampling points and secondary diagonal sampling points along the main diagonal direction and the secondary diagonal direction, respectively, in the dynamic sampling coordinate system, comprising: Determine the initial offset relative to the reference point, and the target sampling bandwidth; The target sampling bandwidth is adaptively converged, and the initial offset is geometrically calibrated to obtain calibration parameters; Based on the calibration parameters and the reference point, the main diagonal sampling point and the secondary diagonal sampling point are generated.

[0011] An adaptive detection method for ship targets in remote sensing images according to the present invention includes a step of determining the target sampling bandwidth, comprising: Obtain the basic sampling bandwidth; Based on the target area of ​​the ship target and the learnable area sensitivity parameters, the width scaling factor is determined; The target sampling bandwidth is determined based on the base sampling bandwidth and the width scaling factor.

[0012] An adaptive detection method for ship targets in remote sensing images according to the present invention includes geometrically calibrating the initial offset to obtain calibration parameters, comprising: Determine the rotation angle of the ship target, and based on the rotation angle, determine the rotation matrix; Based on the rotation matrix, the initial offset is transformed to obtain the calibration parameters.

[0013] The present invention also provides an adaptive detection device for ship targets in remote sensing images, comprising the following units: The acquisition unit is used to acquire multi-scale feature maps of the image to be detected. The generation unit is used to construct a dynamic sampling coordinate system including a main diagonal direction and a secondary diagonal direction based on the reference point of the ship target, and to generate main diagonal sampling points and secondary diagonal sampling points along the main diagonal direction and the secondary diagonal direction respectively under the dynamic sampling coordinate system; The determining unit samples the multi-scale feature map based on the main diagonal sampling points and the sub-diagonal sampling points to obtain a first aggregated feature vector and a second aggregated feature vector. Based on the first aggregated feature vector, it determines the high-dimensional response features of the main branch and the high-dimensional response features of the sub-branch based on the second aggregated feature vector. The high-dimensional response features of the main branch and the high-dimensional response features of the sub-branch are input into the gating network to obtain the main gating fusion weights in the main diagonal direction and the sub-gating fusion weights in the sub-diagonal direction output by the gating network. The detection unit is used to aggregate and sample the multi-scale feature map based on the main gating fusion weight, the secondary gating fusion weight, the first sampling position of the main diagonal sampling point and the second sampling position of the secondary diagonal sampling point to obtain the target features of the image to be detected, and to detect the ship target based on the target features to obtain the ship target detection result.

[0014] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the adaptive detection method for ship targets in remote sensing images as described above.

[0015] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the adaptive detection method for ship targets in remote sensing images as described above.

[0016] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the adaptive detection method for ship targets in remote sensing images as described above.

[0017] The present invention provides an adaptive detection method, apparatus, and device for ship targets in remote sensing images. Based on a reference point of the ship target, a dynamic sampling coordinate system including a main diagonal direction and a secondary diagonal direction is constructed. Under this dynamic sampling coordinate system, main diagonal sampling points and secondary diagonal sampling points are generated along the main diagonal and secondary diagonal directions, respectively. Based on these sampling points, a multi-scale feature map is sampled to obtain first and second aggregated feature vectors, and high-dimensional response features of the main and secondary branches are determined accordingly. Then, a gating network is used to obtain gating fusion weights for the main and secondary diagonal directions. Finally, based on the gating fusion weights and the positions of the main and secondary diagonal sampling points, the multi-scale feature map is aggregated and sampled to obtain the final target features and complete the detection. On the one hand, by constructing main diagonal and secondary diagonal directions strongly correlated with the geometric shape of the ship target based on reference points, and generating main diagonal and secondary diagonal sampling points along these two directions, the feature sampling area can be distributed along the possible slender structure of the ship target, overcoming the diffusion of traditional grid sampling strategies. On the other hand, by dynamically generating fusion weights based on the feature responses of the main diagonal and secondary diagonal directions through a gating network, the actual tilt direction of the ship's body can be adaptively determined, so that the final aggregate sampling can accurately focus on the ship itself. This effectively solves the technical problem that the distribution of sampling points is difficult to fit the ship's contour when dealing with slender and tilted ship targets, improves the feature extraction accuracy of the target's geometric structure, avoids interference from invalid background information, and ensures the accuracy and robustness of ship target detection in complex remote sensing scenarios. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0019] Figure 1This is one of the flowcharts of the adaptive detection method for ship targets in remote sensing images provided by the present invention.

[0020] Figure 2 This is the second flowchart of the adaptive detection method for ship targets in remote sensing images provided by the present invention.

[0021] Figure 3 This is a schematic diagram of the adaptive detection device for ship targets in remote sensing images provided by the present invention.

[0022] Figure 4 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0024] The terms "first," "second," etc., used in this invention are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention can be implemented in orders other than those illustrated or described herein, and that the objects distinguished by "first," "second," etc., are generally of the same class.

[0025] This invention provides an adaptive detection method for ship targets in remote sensing images, aiming to solve the detection challenges posed by the elongated, multi-scale, and arbitrarily tilted characteristics of ship targets in remote sensing images. Its core idea is to abandon the traditional rigid grid sampling method and propose an adaptive attention mechanism that combines main and secondary diagonal features. By dynamically constructing a sampling coordinate system highly correlated with the target's geometry, and using a gating network to softly discriminate and fuse features from different directions, accurate extraction of ship target features is achieved. Figure 1 This is one of the flowcharts illustrating the adaptive detection method for ship targets in remote sensing images provided by the present invention, such as... Figure 1 As shown, the method includes steps 110, 120, 130 and 140.

[0026] Step 110: Obtain the multi-scale feature map of the image to be detected.

[0027] Specifically, firstly, multi-scale feature maps of the image to be detected can be acquired. The image to be detected can be a digital image from any source, but is particularly suitable for high-resolution remote sensing images. These remote sensing images can be acquired by optical or synthetic aperture radar sensors mounted on platforms such as satellites, aircraft, or drones. The image to be detected can be a single still image or a frame extracted from a video stream. The content of the image to be detected can include various scenes such as vast sea surfaces, complex ports, and dense waterways; this embodiment of the invention does not impose specific limitations on these aspects.

[0028] Here, multi-scale feature maps refer to a set of feature maps with different spatial resolutions obtained after processing an input image to be detected by a deep neural network, such as a backbone network. In deep learning, different layers of a deep network learn features with different levels of abstraction. For example, shallower layers (higher resolution) can usually capture low-level details such as the edges and textures of the target, while deeper layers (lower resolution) can capture high-level semantic information such as the outline and component combinations of the target. The advantage of using multi-scale feature maps is that it can simultaneously ensure the detection capability of ship targets of different sizes; large-scale feature maps are suitable for detecting large targets, and small-scale feature maps are suitable for detecting small targets.

[0029] In this embodiment, the backbone network for generating multi-scale feature maps can employ various network structures commonly used in the art. For example, the backbone network can adopt a convolutional neural network-based architecture, such as the ResNet series, ResNeXt series, etc.; it can also adopt the Transformer-based architecture, which has performed well in recent years. This embodiment of the invention does not specifically limit this approach. In a particular implementation, the DINOv2 model can be used as the backbone network. This model, pre-trained through self-supervised learning, possesses powerful general visual representation capabilities and can provide high-quality multi-scale feature maps for subsequent detection tasks.

[0030] Step 120: Based on the reference point of the ship target, construct a dynamic sampling coordinate system including the main diagonal direction and the secondary diagonal direction. Under the dynamic sampling coordinate system, generate main diagonal sampling points and secondary diagonal sampling points along the main diagonal direction and the secondary diagonal direction, respectively.

[0031] Specifically, a dynamic sampling coordinate system can be constructed based on the reference point of the ship target, including the main diagonal and secondary diagonal directions. Under the dynamic sampling coordinate system, main diagonal sampling points and secondary diagonal sampling points are generated along the main diagonal and secondary diagonal directions, respectively. The purpose is to establish a local coordinate system highly correlated with the geometry of each target candidate to be detected, thereby guiding the subsequent feature sampling process to better fit the slender and inclined shape of the ship.

[0032] Here, the reference point for the ship target can be an initial position and size estimate associated with a query vector. The reference point can be a four-dimensional vector (cx, cy, w, h), where (cx, cy) represent the coordinates of the center point of the predicted bounding box, and w and h represent the width and height of the predicted bounding box, respectively. The reference point is generated for each query vector during the decoder phase of the detection network, serving as a benchmark for subsequent feature sampling and accurate bounding box regression. In the initial iterations of the method, the reference point may only be a coarse estimate, gradually becoming more accurate as the network learns.

[0033] The process of constructing a dynamic sampling coordinate system is performed independently for each reference point. Unlike the globally fixed Cartesian coordinate system (XY coordinate system), the dynamic sampling coordinate system constructed in this embodiment of the invention is dynamic, and the direction of its coordinate axes changes with the geometric parameters (such as aspect ratio) of the reference point.

[0034] Specifically, the main diagonal and secondary diagonal directions are the two core basis vectors of this dynamic coordinate system. This can be understood as follows: with the center of the rectangle defined by the ship's reference point as the origin, the main diagonal direction points to one diagonal of the rectangle, while the secondary diagonal direction points to the other diagonal. For example, for a rectangle with width *w* and height *h*, the main diagonal direction can be defined as the direction from the upper left corner to the lower right corner, and the secondary diagonal direction can be defined as the direction from the upper right corner to the lower left corner. Choosing these two directions as the coordinate basis is based on an important geometric prior: for slender ship targets, their hull axis (i.e., the keel direction) is usually approximately equal to one diagonal of their circumscribed rectangle. Therefore, sampling along these two directions can cover the main structure of the ship with a very high probability.

[0035] After constructing the dynamic sampling coordinate system described above, sampling points need to be generated. The main diagonal sampling points are a set of points distributed along the main diagonal direction, while the secondary diagonal sampling points are another set of points distributed along the secondary diagonal direction. These points can be generated in various ways. For example, they can be generated along the main / secondary diagonal directions and in their nearest neighboring regions, according to preset rules such as spacing or offsets learned by the network, to determine a series of specific two-dimensional coordinates. These generated sampling point coordinates collectively form the basis for subsequent feature sampling.

[0036] Step 130: Based on the main diagonal sampling points and the secondary diagonal sampling points, the multi-scale feature map is sampled to obtain a first aggregated feature vector and a second aggregated feature vector. Based on the first aggregated feature vector, the high-dimensional response features of the main branch are determined, and based on the second aggregated feature vector, the high-dimensional response features of the secondary branch are determined. The high-dimensional response features of the main branch and the high-dimensional response features of the secondary branch are input into the gating network to obtain the main gating fusion weights in the main diagonal direction and the secondary gating fusion weights in the secondary diagonal direction output by the gating network.

[0037] Specifically, firstly, the multi-scale feature map is sampled based on the main diagonal and sub-diagonal sampling points. For the coordinates of each sampling point, its feature value is extracted on the corresponding multi-scale feature map. Since the coordinates of the sampling points are usually floating-point numbers, and the pixel positions of the multi-scale feature map are discrete, this sampling process usually requires the use of interpolation algorithms, such as bilinear interpolation, to obtain more accurate feature values.

[0038] After sampling, the feature values ​​extracted from all sampling points along the main diagonal are aggregated to form a first aggregated feature vector; similarly, the feature values ​​extracted from all sampling points along the secondary diagonal are aggregated to form a second aggregated feature vector. The aggregation method may include averaging, summing, or concatenation, etc., and this embodiment of the invention does not specifically limit this.

[0039] Furthermore, high-dimensional response features for the main branch and sub-branch are determined. This process aims to extract metrics from the aggregated feature vector that reflect feature saliency and semantic relevance. For example, the L2 norm of the aggregated feature vector can be calculated to characterize the activation intensity of the feature in that direction, or the cosine similarity between the aggregated feature vector and the initial query vector can be calculated to characterize the degree of semantic matching. These metrics are then used as high-dimensional response features.

[0040] Then, the high-dimensional response features of the main branch and the sub-branch are input into a gating network to obtain the main gating fusion weights in the main diagonal direction and the sub-gating fusion weights in the sub-diagonal direction. The gating network is a small neural network module, which can consist of one or more fully connected layers (linear layers). The output of the gating network is the main gating fusion weight and the sub-gating fusion weight. These two weights are typically normalized using the Softmax function, and their sum is 1. For example, if the gating network determines that the ship's main body is more aligned with the main diagonal direction based on the input high-dimensional response features, it might output a main gating fusion weight of 0.9 and a sub-gating fusion weight of 0.1. This mechanism enables dynamic discrimination and adaptation of the ship's tilt attitude without the need for rigid angle classification.

[0041] Step 140: Based on the main gating fusion weight, the secondary gating fusion weight, the first sampling position of the main diagonal sampling point, and the second sampling position of the secondary diagonal sampling point, aggregate sampling is performed on the multi-scale feature map to obtain the target features of the image to be detected, and the ship target is detected based on the target features to obtain the ship target detection result.

[0042] Specifically, based on the main gate fusion weight, the secondary gate fusion weight, the first sampling position of the main diagonal sampling point, and the second sampling position of the secondary diagonal sampling point, the multi-scale feature map is aggregated and sampled to obtain the target features of the image to be detected. Ship targets are then detected based on these target features to obtain the ship target detection result. Aggregation sampling here is a weighted fusion process. It integrates the sampling information from the two branches using the main gate fusion weight and the secondary gate fusion weight. Specifically, the feature information ultimately used for aggregation is the result of a weighted combination of the sampling information from the main diagonal direction defined by the first sampling position and the secondary diagonal direction defined by the second sampling position, according to these two weights. For example, the sampling positions of the two branches can be weighted and averaged to obtain a set of fused sampling positions, which are then sampled again; or the feature values ​​obtained are weighted and summed after sampling at the positions of the two branches respectively. In this way, the ship target detection model can allocate more attention to the diagonal direction, which is more relevant to the ship's main body, while suppressing features from irrelevant or background directions, thereby obtaining a target feature with a stronger representational ability of the target morphology.

[0043] Finally, the target features are input into the detection head. The detection head typically consists of two parallel branches: a classification branch and a regression branch. The classification branch determines whether the target feature corresponds to a ship target and its specific ship category, such as cargo ship or fishing vessel, outputting a ship category confidence score. The regression branch refines the initial bounding box defined by the reference point, outputting more accurate position and size information. Combining the classification and regression results, the final ship target detection result is obtained, which can be a series of bounding box coordinates along with their corresponding category labels and confidence scores.

[0044] The method provided in this invention constructs a dynamic sampling coordinate system including a main diagonal direction and a secondary diagonal direction based on the reference point of the ship target. Under the dynamic sampling coordinate system, main diagonal sampling points and secondary diagonal sampling points are generated along the main diagonal direction and the secondary diagonal direction, respectively. Based on the main diagonal sampling points and secondary diagonal sampling points, the multi-scale feature map is sampled to obtain first and second aggregated feature vectors, and the high-dimensional response features of the main and secondary branches are determined accordingly. Then, the gating fusion weights of the main and secondary diagonal directions are obtained through a gating network. Finally, based on the gating fusion weights and the positions of the main and secondary diagonal sampling points, the multi-scale feature map is aggregated and sampled to obtain the final target features and complete the detection. On the one hand, by constructing main diagonal and secondary diagonal directions strongly correlated with the geometric shape of the ship target based on reference points, and generating main diagonal and secondary diagonal sampling points along these two directions, the feature sampling area can be distributed along the possible slender structure of the ship target, overcoming the diffusion of traditional grid sampling strategies. On the other hand, by dynamically generating fusion weights based on the feature responses of the main diagonal and secondary diagonal directions through a gating network, the actual tilt direction of the ship's body can be adaptively determined, so that the final aggregate sampling can accurately focus on the ship itself. This effectively solves the technical problem that the distribution of sampling points is difficult to fit the ship's contour when dealing with slender and tilted ship targets, improves the feature extraction accuracy of the target's geometric structure, avoids interference from invalid background information, and ensures the accuracy and robustness of ship target detection in complex remote sensing scenarios.

[0045] Based on the above embodiments, step 120, which involves constructing a dynamic sampling coordinate system based on the reference point of the ship target, including the main diagonal direction and the secondary diagonal direction, includes: Step 120-1: Obtain the width and height of the reference point of the ship target; Step 120-2: Determine the diagonal modulus based on the width and the height; Step 120-3: Based on the diagonal modulus, the width, and the height, determine the main diagonal direction and the secondary diagonal direction, and construct a dynamic sampling coordinate system including the main diagonal direction and the secondary diagonal direction.

[0046] Specifically, first, the width and height of the ship target's reference point are obtained. Since the ship target's reference point can be represented as a four-dimensional vector (cx, cy, w, h), this step can directly extract the two geometric parameters, width w and height h, from this four-dimensional vector.

[0047] Secondly, the diagonal modulus is determined based on the width and height. The diagonal modulus is a scalar value that characterizes the length of the diagonal of the rectangle defined by the reference point.

[0048] The formula for the diagonal modulus is as follows: in, Indicates the diagonal modulus. Let w be a preset, minimal positive value, representing the width of the reference point and h represent its height. (Introduction) The purpose is to ensure numerical stability, that is, to avoid the error of zero denominator when the width w and height h are extremely small or zero, and to ensure the normal progress of subsequent calculations.

[0049] Next, based on the diagonal magnitude, width, and height, the main diagonal direction and the secondary diagonal direction are determined, and a dynamic sampling coordinate system including the main diagonal direction and the secondary diagonal direction is constructed. The main diagonal direction and the secondary diagonal direction are two two-dimensional unit vectors, which together constitute the basis of the dynamic sampling coordinate system.

[0050] Here, the main diagonal direction The formula is: secondary diagonal direction The formula is: in, Let w represent the diagonal magnitude, h represent the width of the reference point, and h represent the height of the reference point. The components of the vector along the main diagonal direction are obtained by dividing the width w and height h by the diagonal magnitude, respectively. Essentially, this is a normalization process of the vector pointing from the center of the rectangle to one of its diagonal vertices, such as the bottom right vertex. The vector along the secondary diagonal direction is similar to the vector along the main diagonal direction, but its second component is negative, representing the other diagonal, for example, the direction from the top right corner to the bottom left corner.

[0051] In this way, a unique set of mutually orthogonal basis vectors is determined for each reference point. This constructs a dynamic sampling coordinate system with the center of the reference point as the origin and the main diagonal and secondary diagonal directions as coordinate axes.

[0052] Based on the above embodiments, step 130, which involves determining the high-dimensional response features of the main branch based on the first aggregated feature vector and determining the high-dimensional response features of the sub-branch based on the second aggregated feature vector, includes: Step 130-1: Based on the first aggregated feature vector, determine the main feature activation intensity response in the main diagonal direction; based on the second aggregated feature vector, determine the secondary feature activation intensity response in the secondary diagonal direction. Step 130-2: Based on the first aggregated feature vector and the preset query vector, determine the first semantic matching degree response feature, and based on the second aggregated feature vector and the query vector, determine the second semantic matching degree response feature; Step 130-3: Based on the main feature activation intensity response, the first semantic matching degree response feature, the diagonal modulus, and the average sampling width, determine the main branch high-dimensional response feature; the average sampling width is determined based on the first sampling width of the main diagonal sampling point and the second sampling width of the sub-diagonal sampling point. Step 130-4: Determine the high-dimensional response feature of the sub-branch based on the sub-feature activation intensity response, the second semantic matching degree response feature, the diagonal modulus, and the average sampling width.

[0053] Specifically, firstly, based on the first aggregated feature vector, the principal feature activation intensity response in the main diagonal direction is determined, and based on the second aggregated feature vector, the secondary feature activation intensity response in the sub-diagonal direction is determined. The principal feature activation intensity response in the main diagonal direction is used to quantify the salience of features in that direction. Here, the L2 norm of the first aggregated feature vector can be calculated as the principal feature activation intensity response in the main diagonal direction. The L2 norm, as a measure of vector length, generally indicates that the larger the value, the more salient the features contained within the sampling region, and the stronger the signal. Similarly, the secondary feature activation intensity response is determined based on the L2 norm of the second aggregated feature vector.

[0054] Secondly, based on the first aggregated feature vector and the preset query vector, a first semantic matching degree response feature is determined, and based on the second aggregated feature vector and the query vector, a second semantic matching degree response feature is determined. This step aims to measure the degree of semantic matching between the sampled features and the target to be detected. The preset query vector itself is a set of learnable vectors introduced in the Transformer decoder, with each query vector establishing a correspondence with a potential target in the image to be detected.

[0055] Here, the first semantic matching response feature is determined by calculating the cosine similarity between the first aggregated feature vector and the query vector. The range of the cosine similarity is [-1, 1]. The closer the value is to 1, the more consistent the first aggregated feature vector and the query vector are in direction, meaning that the sampled features are semantically more aligned with the query intent. Similarly, the second semantic matching response feature is determined based on the cosine similarity between the second aggregated feature vector and the same query vector.

[0056] Next, based on the main feature activation intensity response, the first semantic matching degree response feature, the diagonal modulus, and the average sampling width, the high-dimensional response features of the main branch are determined. The average sampling width is determined based on the average of the first sampling width of the main diagonal sampling points and the second sampling width of the sub-diagonal sampling points.

[0057] The high-dimensional response features of the main branch are obtained by concatenating the activation intensity response of the main feature, the first semantic matching degree response feature, the diagonal magnitude, and the average sampling width. Similarly, the high-dimensional response features of the sub-branch are obtained by concatenating the activation intensity response of the sub-feature, the second semantic matching degree response feature, the diagonal magnitude, and the average sampling width.

[0058] The method provided in this invention integrates geometric information such as diagonal modulus and average sampling width into the high-dimensional response features of the main branch and the sub-branch. This allows the decision-making basis of the gating network to go beyond purely feature content, taking into account the geometric context such as the target's scale and shape. This comprehensive response feature, combining physical response, semantic association, and geometric prior, provides a richer and more reliable discriminative basis for the gating network, enabling more accurate generation of main gating fusion weights and sub-gating fusion weights, thus improving the accuracy of subsequent adaptive fusion.

[0059] Based on the above embodiments, the method further includes: Step 210: Based on the query vector, the main diagonal direction, the diagonal modulus, the average sampling width, the width variation coefficient of the average sampling width, and the target area of ​​the ship target, determine the attention weight of the main sampling point in the main diagonal direction; Step 220: Based on the query vector, the sub-diagonal direction, the diagonal magnitude, the average sampling width, the width variation coefficient of the average sampling width, and the target area, determine the attention weight of the sub-sampling points in the sub-diagonal direction; Step 140, which involves aggregating and sampling the multi-scale feature map based on the main gate fusion weights, the secondary gate fusion weights, the first sampling position of the main diagonal sampling point, and the second sampling position of the secondary diagonal sampling point to obtain the target features of the image to be detected, includes: Step 141: Based on the main gating fusion weight, the secondary gating fusion weight, the main sampling point attention weight, the secondary sampling point attention weight, the first sampling position of the main diagonal sampling point, and the second sampling position of the secondary diagonal sampling point, aggregate sampling is performed on the multi-scale feature map to obtain the target features of the image to be detected.

[0060] Specifically, firstly, the attention weight of the main sampling point in the main diagonal direction can be determined based on the query vector, the main diagonal direction, the diagonal modulus, the average sampling width, the width variation coefficient of the average sampling width, and the target area of ​​the ship target.

[0061] Here, we construct the input features for an attention weight prediction network. These input features can include the query vector, the main diagonal direction (two-dimensional vector), the diagonal magnitude (scalar), the average sampling width (scalar), the coefficient of variation of the average sampling width (scalar), and the target area of ​​the ship target (scalar). Then, we feed these input features into a prediction network, such as a simple linear layer, which outputs an attention score for each main diagonal sampling point. After normalizing all scores, the attention weights for the main sampling points are obtained by applying a softmax function.

[0062] Here, the coefficient of variation of the average sampling width is obtained by dividing the standard deviation of the lateral offset of the sampling points by the average value, and is used to quantify the dispersion of the sampling point distribution. A small coefficient of variation in the average sampling width indicates that the sampling points are closely and regularly arranged; a large coefficient of variation in the average sampling width indicates that the sampling points are widely distributed. The target area can be obtained by multiplying the w and h of the reference points. The target area provides the ship detection model with prior information about the absolute size of the target.

[0063] Similarly, the attention weights of the sub-sampling points in the sub-diagonal direction can be determined based on the query vector, the sub-diagonal direction, the diagonal magnitude, the average sampling width, the coefficient of variation of the average sampling width, and the target area.

[0064] Secondly, in the final aggregation sampling step, the aforementioned attention weights are introduced. That is, based on the main gate fusion weight, the secondary gate fusion weight, the newly added main sampling point attention weight, the secondary sampling point attention weight, the first sampling position of the main diagonal sampling point, and the second sampling position of the secondary diagonal sampling point, the multi-scale feature map is aggregated and sampled to obtain the target features of the image to be detected.

[0065] The method provided in this invention, on the one hand, based on the weight allocation between the main diagonal and secondary diagonal branches, further introduces an attention mechanism that assigns weights to each sampling point within each branch, achieving a leap from macroscopic direction selection to microscopic node focusing. This enables the ship detection model not only to determine the ship's main orientation but also to identify key parts of the hull such as the bow, stern, and bridge, assigning higher attention to these information-rich areas while suppressing invalid background sampling points falling outside the hull outline. On the other hand, when calculating the attention weights of sampling points, it innovatively introduces statistical quantities such as the coefficient of variation of the sampling point width and the target area, giving the allocation of attention weights scale-aware and morphology-aware capabilities. For example, the ship detection model can adaptively adjust the concentration or dispersion of attention based on the target area and can perceive the distribution quality of sampling points through the coefficient of variation, assigning lower weights to divergent and unreliable sampling point layouts. This dual attention mechanism, with geometric awareness, ensures that the final aggregated target features have a higher signal-to-noise ratio, greatly improving the ship detection model's ability to identify details and suppress noise.

[0066] Based on the above embodiments, step 141 includes: Step 1411: Based on the main gating fusion weight and the secondary gating fusion weight, the first sampling position and the second sampling position are weighted and fused to obtain the fused sampling position; Step 1412: Based on the main gating fusion weight and the secondary gating fusion weight, the main sampling point attention weight and the secondary sampling point attention weight are weighted and fused to obtain the fused attention weight; Step 1413: Based on the fusion sampling location and the fusion attention weight, the multi-scale feature map is weighted and aggregated to obtain the target feature.

[0067] Specifically, firstly, the first and second sampling positions can be weighted and fused based on the primary gating fusion weight and the secondary gating fusion weight to obtain the fused sampling position. The fused sampling position is a new set of sampling point coordinates that incorporates information from both diagonal directions. It is calculated by weighting the sampling positions of the two branches.

[0068] Here, the formula for the fused sampling location is as follows: ; in, Indicates the fusion sampling position. Indicates the main gating fusion weight, Indicates the first sampling position. Indicates the secondary gating fusion weight, This indicates the second sampling position.

[0069] The first sampling position is the set of coordinates of the sampling points on the main diagonal, and the second sampling position is the set of coordinates of the sampling points on the secondary diagonal. This operation is equivalent to softly shifting the sampling points towards the diagonal direction where the ship's hull is more likely to be located, based on the judgment of the gating network.

[0070] Then, based on the main gating fusion weight and the secondary gating fusion weight, the attention weights of the main sampling point and the secondary sampling point can be weighted and fused to obtain the fused attention weight. Here, the fused attention weight is a new set of weight values ​​that fuses the attention of the two branches. Its calculation method is similar to that of the fusion of sampling positions, which is also a weighted average.

[0071] Here, the fused attention weight = main gating fusion weight × main sampling point attention weight + secondary gating fusion weight × secondary sampling point attention weight. This operation fuses the importance scores of each sampling point on the two branches according to the gating judgment to obtain a unified set of attention weights.

[0072] Finally, the target features can be obtained by weighted aggregation of the multi-scale feature maps based on the fused sampling locations and fused attention weights. This process is efficiently implemented by calling the underlying optimized ms_deform_attn_core_pytorch operator. The final generated features will be used for subsequent classification and bounding box regression tasks of the detection head. For the coordinates of each sampling point in the fused sampling location, interpolation sampling is performed on the multi-scale feature map using the sampling point coordinates to obtain the corresponding sampling feature vector. Then, the sampling feature vector is multiplied by the weight value of the fused attention weight corresponding to that sampling point to obtain the weighted feature vector of that sampling point. The weighted feature vectors of all sampling points are summed to generate the target features.

[0073] Based on the above embodiments, step 120, which involves generating main diagonal sampling points and secondary diagonal sampling points along the main diagonal direction and the secondary diagonal direction respectively in the dynamic sampling coordinate system, includes: Step 1201: Determine the initial offset relative to the reference point and the target sampling bandwidth; Step 1202: Adaptively converge the target sampling bandwidth and perform geometric calibration on the initial offset to obtain calibration parameters; Step 1203: Based on the calibration parameters and the reference point, generate the main diagonal sampling point and the secondary diagonal sampling point.

[0074] Specifically, first, the initial offset relative to the reference point and the target sampling bandwidth can be determined. The initial offset refers to the initial position vector of a series of sampling points relative to the origin, i.e., the center of the reference point, in the constructed dynamic sampling coordinate system. The initial offset is not fixed but is dynamically predicted and generated by a prediction network, for example, two fully connected layers, based on the input query vector and geometric features. Specifically, for each sampling point to be generated, the prediction network can predict two components: a longitudinal distance parameter along the diagonal direction and a lateral offset parameter perpendicular to the diagonal direction. The initial offsets of all sampling points collectively define the basic shape and distribution of the sampling point array before calibration.

[0075] Here, the target sampling bandwidth is a key parameter controlling the distribution range of sampling points in the direction perpendicular to the diagonal. It can be understood as the width of the sampling band. A larger bandwidth means that the sampling points are distributed wider, covering a larger area; a smaller bandwidth means that the sampling points are concentrated, forming a thinner band. The initial value of the target sampling bandwidth can also be dynamically predicted and generated by the network.

[0076] Then, the target sampling bandwidth can be adaptively narrowed, and the initial offset can be geometrically calibrated to obtain calibration parameters. Adaptive narrowing of the target sampling bandwidth refers to the process of dynamically adjusting the sampling bandwidth based on the specific attributes of the target, such as its size. The purpose is to: automatically narrow or reduce the sampling bandwidth when detecting a small target, such as a small fishing boat, so that the sampling points are more closely focused on the target body, avoiding the acquisition of excessive background noise; while when detecting a large target, such as a large cargo ship, the sampling bandwidth can be maintained or appropriately widened to ensure complete coverage of the target.

[0077] Here, geometric calibration of the initial offset refers to making a small rotational adjustment to the initial offset. Its purpose is to address the subtle angular deviation that may exist between the ship's actual orientation and the diagonal of its circumscribed rectangle. By predicting a small rotation angle and performing a corresponding rotational transformation on all initial offset vectors, the orientation of the sampling point array can be more accurately aligned with the ship's true attitude (keelline direction).

[0078] Finally, based on the calibration parameters and the reference point, main diagonal and sub-diagonal sampling points can be generated. Here, the calibration parameters in the local coordinate system are transformed into the global image coordinate system to generate the final usable sampling point coordinates. Specifically, each calibration parameter is linearly transformed through the coordinate system basis vectors and superimposed with the center coordinates (cx, cy) of the reference point. This completes the mapping from local dynamic coordinates to global image coordinates, ultimately yielding a set of main diagonal and sub-diagonal sampling points that can be directly used for sampling on multi-scale feature maps.

[0079] Based on the above embodiments, the step of determining the target sampling bandwidth includes: Step 310: Obtain the basic sampling bandwidth; Step 320: Determine the width scaling factor based on the target area of ​​the ship target and the learnable area sensitivity parameters; Step 330: Determine the target sampling bandwidth based on the base sampling bandwidth and the width scaling factor.

[0080] Specifically, the first step is to obtain the baseline sampling bandwidth. The baseline sampling bandwidth is the benchmark value used to calculate the target sampling bandwidth. It is not a fixed hyperparameter but is dynamically predicted by the network. Specifically, a linear layer can output a log-odds value based on information such as the query vector. This log-odds value is then processed by an activation function, such as the sigmoid function, to obtain a normalized baseline bandwidth coefficient. Multiplying this baseline bandwidth coefficient by the diagonal modulus of the reference point yields the baseline sampling bandwidth related to the target size.

[0081] Secondly, based on the target area of ​​the ship and a learnable area sensitivity parameter, the width scaling factor is determined. The target area can be obtained by multiplying the width w and height h of the reference point. The learnable area sensitivity parameter, denoted as λ, is a trainable parameter in the model. This parameter is automatically optimized during model training, and its value determines the sensitivity of the sampling bandwidth to changes in the target area.

[0082] Here, the width scaling factor is determined by calculating an exponential decay function, the specific formula of which is as follows: .

[0083] in, Indicates the width scaling factor. This is a learnable area sensitivity parameter, which can be initialized to 2.0. This represents the target area. The width scaling factor is used to automatically reduce the sampling bandwidth when the target area is small.

[0084] Next, the target sampling bandwidth is determined based on the base sampling bandwidth and the width scaling factor. The final target sampling bandwidth is obtained by multiplying the base sampling bandwidth by the width scaling factor. Through this mechanism, when the model detects a small target, a smaller width scaling factor is calculated, thus effectively narrowing the sampling bandwidth; conversely, when detecting a large target, the width scaling factor is increased accordingly, allowing for a wider sampling range.

[0085] Based on the above embodiments, step 1202, which involves geometrically calibrating the initial offset to obtain calibration parameters, includes: Step 1202-1: Determine the rotation angle of the ship target, and determine the rotation matrix based on the rotation angle; Step 1202-2: Based on the rotation matrix, perform coordinate transformation on the initial offset to obtain the calibration parameters.

[0086] Specifically, first, the rotation angle of the ship target is determined. This rotation angle is not measured directly from the image or requires additional annotation; rather, it is implicitly learned and predicted by the model.

[0087] The specific determination method is as follows: a prediction network, such as a linear layer, can first output an unconstrained scalar value, and then use a hyperbolic tangent function (Tanh) to map this value to a preset, small angular range, for example... The resulting angle is the rotation angle θ. The rotation angle represents the small angular deviation of the ship's actual orientation as determined by the model relative to the diagonal of its bounding box. Limiting it to a small range is based on the reasonable assumption that in most cases, the detection box can roughly frame the target, and the angle between its diagonal and the ship's main axis is usually not too large.

[0088] Secondly, the rotation matrix is ​​determined based on the rotation angle. Here, a standard two-dimensional rotation matrix R can be constructed based on the rotation angle. This rotation matrix R contains all the transformation information required to rotate a two-dimensional coordinate point about the origin by an angle θ.

[0089] Next, based on the rotation matrix, a coordinate transformation is performed on the initial offsets to obtain the calibration parameters. Here, coordinate transformation refers to applying the rotation matrix R determined in the previous step to each initial offset vector. Specifically, for each initial offset vector p_initial, its rotated new vector p_calibrated = R(θ) * p_initial is calculated through matrix multiplication. After performing such coordinate transformation on all initial offsets, the resulting set of new offset vectors is the calibration parameters.

[0090] Understandably, to address the issue of feature mismatch across multiple scales, a learnable area sensitivity parameter is introduced to construct an exponential decay function. This function dynamically calculates a width scaling factor based on the real-time predicted area of ​​the target. When a small target is detected, a smaller scaling factor is automatically calculated to narrow the sampling bandwidth; when a large target is detected, the sampling range is appropriately widened. Simultaneously, a rotation matrix is ​​constructed using the small rotation angle parameters predicted by the network to transform the coordinates of the sampling point array. This process allows the sampling points to be precisely "calibrated" in geometric space, adapting not only to the ship's aspect ratio but also to its actual orientation, thus accurately covering the main frame of a tilting ship.

[0091] The method provided in this invention first constructs a normalized main and secondary diagonal direction vector based on the geometric parameters of reference points. Then, a dual-branch sampling strategy is designed, introducing a learnable area-sensitive parameter to construct an exponential decay function, achieving adaptive convergence of the sampling bandwidth. Combined with small rotation angle predictions, the sampling points are geometrically calibrated to accurately cover the ship's skeleton. Simultaneously, this invention utilizes lightweight feature detection to calculate norm response and cosine similarity, dynamically generating branch fusion weights through a gating network to achieve soft discrimination of the ship's tilt attitude. Finally, multi-dimensional geometric attributes are integrated to calculate scale-aware attention weights, replacing traditional grid sampling for feature aggregation. This invention effectively solves the problem of sampling divergence for slender rotating targets, improving the accuracy of ship sampling in complex scenes without additional rotation annotation, thereby enhancing detection precision and robustness.

[0092] Based on any of the above embodiments Figure 2 This is a second schematic flowchart of the adaptive detection method for ship targets in remote sensing images provided by the present invention, as shown below. Figure 2 As shown, firstly, the image to be detected is fed into a backbone network, specifically a DINOv2 model with window attention. Internally, the image is converted into a sequence through block embedding and combined with positional embedding information. This sequence is then processed through N layers of window self-attention modules to extract semantically rich multi-scale feature maps. These feature maps are then dimensionally adjusted by a feature projector and fed into a decoder (M groups × N layers). The decoder receives a set of learnable query embeddings (after query selection) and sequentially performs self-attention, the core orientation-aware dual diagonal deformable cross-attention mechanism, and a feedforward network in each layer to progressively optimize the features representing candidate targets. The final target features output by the decoder are then fed into a detection head, which includes a category header for determining the target category and a bounding box header for precise localization, ultimately generating the features shown in the attached figure. Figure 2 The upper right corner shows the ship target detection results, which include the target bounding box, category, and confidence level.

[0093] Figure 2The paper further elaborates on the implementation details of the "direction-aware dual-diagonal deformable cross-attention" module: This module receives a query vector from the decoder and the corresponding reference point (cx, cy, w, h) as input. The reference point is processed by a geometric projection module to calculate geometric prior information such as diagonal direction, diagonal length, and area. This geometric information, combined with the query vector, is fed in parallel into the main diagonal branch and the secondary diagonal branch. Each branch contains an independent offset network, a width network, and a rotation network, which work together to obtain the sampling position. The feature map is sampled using the sampling positions obtained from these two branches, and the feature response is calculated through a numerical projection and response extraction module. Finally, the sampled values ​​and feature responses from the two branches are fed into the geometrically guided fusion module. The geometrically guided fusion module intelligently weights and aggregates the information from the two diagonal directions through a series of operations such as feature response extraction, fusion gating and region-aware attention, and adaptive weighted fusion, outputting highly refined target features for use by subsequent modules of the decoder.

[0094] In summary, this invention utilizes the geometric prior that the main body of a slender ship target is usually distributed near the diagonal of the detection frame, and innovatively introduces an area-sensitive adaptive bandwidth control and a learnable rotation fine-tuning mechanism. This enables the sampling points to not only densely cover the main structure of the ship, but also to automatically tighten the sampling range when processing small targets, effectively suppressing background noise interference from the sea surface, and solving the problem of sampling divergence in traditional attention mechanisms on slender rotating targets. This invention uses a "detect-response-gating" mechanism to perceive the tilt attitude of ships without the need for expensive rotating box annotation. It also incorporates attention weights that incorporate scale information such as target area and aspect ratio variation coefficient, which significantly improves the model's feature extraction accuracy and robustness for multi-scale, densely arranged, and arbitrarily oriented ship targets in complex port scenarios. It combines low annotation cost with high engineering application value.

[0095] The adaptive detection device for ship targets in remote sensing images provided by the present invention will be described below. The adaptive detection device for ship targets in remote sensing images described below can be referred to in correspondence with the adaptive detection method for ship targets in remote sensing images described above.

[0096] Based on any of the above embodiments, the present invention provides an adaptive detection device for ship targets in remote sensing images. Figure 3 This is a schematic diagram of the adaptive detection device for ship targets in remote sensing images provided by the present invention, as shown below. Figure 3 As shown, the device includes: The acquisition unit 310 is used to acquire multi-scale feature maps of the image to be detected; The generation unit 320 is used to construct a dynamic sampling coordinate system including a main diagonal direction and a secondary diagonal direction based on the reference point of the ship target, and to generate main diagonal sampling points and secondary diagonal sampling points along the main diagonal direction and the secondary diagonal direction respectively under the dynamic sampling coordinate system; The determining unit 330 samples the multi-scale feature map based on the main diagonal sampling points and the sub-diagonal sampling points to obtain a first aggregated feature vector and a second aggregated feature vector. Based on the first aggregated feature vector, it determines the high-dimensional response features of the main branch and the high-dimensional response features of the sub-branch based on the second aggregated feature vector. The high-dimensional response features of the main branch and the high-dimensional response features of the sub-branch are input into the gating network to obtain the main gating fusion weights in the main diagonal direction and the sub-gating fusion weights in the sub-diagonal direction output by the gating network. The detection unit 340 is used to aggregate and sample the multi-scale feature map based on the main gating fusion weight, the secondary gating fusion weight, the first sampling position of the main diagonal sampling point and the second sampling position of the secondary diagonal sampling point to obtain the target features of the image to be detected, and to detect the ship target based on the target features to obtain the ship target detection result.

[0097] The apparatus provided in this invention constructs a dynamic sampling coordinate system including a main diagonal direction and a secondary diagonal direction based on a reference point of the ship target. Under this dynamic sampling coordinate system, main diagonal sampling points and secondary diagonal sampling points are generated along the main diagonal and secondary diagonal directions, respectively. Based on these sampling points, a multi-scale feature map is sampled to obtain first and second aggregated feature vectors, and high-dimensional response features of the main and secondary branches are determined accordingly. Then, a gating network is used to obtain gating fusion weights for the main and secondary diagonal directions. Finally, based on the gating fusion weights and the positions of the main and secondary diagonal sampling points, the multi-scale feature map is aggregated and sampled to obtain the final target features and complete the detection. On the one hand, by constructing main diagonal and secondary diagonal directions strongly correlated with the geometric shape of the ship target based on reference points, and generating main diagonal and secondary diagonal sampling points along these two directions, the feature sampling area can be distributed along the possible slender structure of the ship target, overcoming the diffusion of traditional grid sampling strategies. On the other hand, by dynamically generating fusion weights based on the feature responses of the main diagonal and secondary diagonal directions through a gating network, the actual tilt direction of the ship's body can be adaptively determined, so that the final aggregate sampling can accurately focus on the ship itself. This effectively solves the technical problem that the distribution of sampling points is difficult to fit the ship's contour when dealing with slender and tilted ship targets, improves the feature extraction accuracy of the target's geometric structure, avoids interference from invalid background information, and ensures the accuracy and robustness of ship target detection in complex remote sensing scenarios.

[0098] Based on any of the above embodiments, the generation unit 320 is specifically used for: Obtain the width and height of the reference point of the ship target; Determine the diagonal modulus based on the width and the height; Based on the diagonal modulus, the width, and the height, the main diagonal direction and the secondary diagonal direction are determined, and a dynamic sampling coordinate system including the main diagonal direction and the secondary diagonal direction is constructed.

[0099] Based on any of the above embodiments, the determining unit 330 is specifically used for: Based on the first aggregated feature vector, the main feature activation intensity response in the main diagonal direction is determined, and based on the second aggregated feature vector, the secondary feature activation intensity response in the sub-diagonal direction is determined. Based on the first aggregated feature vector and the preset query vector, a first semantic matching degree response feature is determined, and based on the second aggregated feature vector and the query vector, a second semantic matching degree response feature is determined. Based on the main feature activation intensity response, the first semantic matching degree response feature, the diagonal modulus, and the average sampling width, the main branch high-dimensional response feature is determined; the average sampling width is determined based on the first sampling width of the main diagonal sampling point and the second sampling width of the sub-diagonal sampling point. The high-dimensional response features of the sub-branch are determined based on the activation intensity response of the sub-feature, the second semantic matching degree response feature, the diagonal modulus, and the average sampling width.

[0100] Based on any of the above embodiments, a sampling point attention weight unit is further included, wherein the sampling point attention weight unit is specifically used for: Based on the query vector, the main diagonal direction, the diagonal modulus, the average sampling width, the width variation coefficient of the average sampling width, and the target area of ​​the ship target, the attention weight of the main sampling point in the main diagonal direction is determined. Based on the query vector, the sub-diagonal direction, the diagonal magnitude, the average sampling width, the width variation coefficient of the average sampling width, and the target area, determine the attention weight of the sub-sampling points in the sub-diagonal direction; The detection unit 340 specifically includes: The aggregation sampling unit is used to aggregate and sample the multi-scale feature map based on the main gating fusion weight, the secondary gating fusion weight, the main sampling point attention weight, the secondary sampling point attention weight, the first sampling position of the main diagonal sampling point, and the second sampling position of the secondary diagonal sampling point to obtain the target features of the image to be detected.

[0101] Based on any of the above embodiments, the aggregation sampling unit is specifically used for: Based on the main gating fusion weight and the secondary gating fusion weight, the first sampling position and the second sampling position are weighted and fused to obtain the fused sampling position; Based on the main gating fusion weight and the secondary gating fusion weight, the main sampling point attention weight and the secondary sampling point attention weight are weighted and fused to obtain the fused attention weight; Based on the fusion sampling location and the fusion attention weight, the multi-scale feature map is weighted and aggregated to obtain the target feature.

[0102] Based on any of the above embodiments, the generation unit 320 specifically includes: An offset unit is determined to determine the initial offset relative to the reference point and the target sampling bandwidth. The calibration unit is used to adaptively converge the target sampling bandwidth and perform geometric calibration on the initial offset to obtain calibration parameters. A sampling point generation unit is used to generate the main diagonal sampling point and the secondary diagonal sampling point based on the calibration parameters and the reference point.

[0103] Based on any of the above embodiments, a bandwidth determination unit is further included, wherein the bandwidth determination unit is specifically used for: Obtain the basic sampling bandwidth; Based on the target area of ​​the ship target and the learnable area sensitivity parameters, the width scaling factor is determined; The target sampling bandwidth is determined based on the base sampling bandwidth and the width scaling factor.

[0104] Based on any of the above embodiments, the calibration unit is specifically used for: Determine the rotation angle of the ship target, and based on the rotation angle, determine the rotation matrix; Based on the rotation matrix, the initial offset is transformed to obtain the calibration parameters.

[0105] Figure 4 This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 4As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430, and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other through the communication bus 440. The processor 410 can call logical instructions in the memory 430 to execute an adaptive detection method for ship targets in remote sensing images. This method includes: acquiring a multi-scale feature map of the image to be detected; constructing a dynamic sampling coordinate system including a main diagonal direction and a secondary diagonal direction based on reference points of the ship target; generating main diagonal sampling points and secondary diagonal sampling points along the main diagonal direction and the secondary diagonal direction, respectively, in the dynamic sampling coordinate system; sampling the multi-scale feature map based on the main diagonal sampling points and the secondary diagonal sampling points to obtain a first aggregated feature vector and a second aggregated feature vector, and determining a target based on the first aggregated feature vector. The high-dimensional response features of the main branch are used to determine the high-dimensional response features of the sub-branch based on the second aggregated features. The high-dimensional response features of the main branch and the sub-branch are input into a gating network to obtain the main gating fusion weights in the main diagonal direction and the sub-gating fusion weights in the sub-diagonal direction output by the gating network. Based on the main gating fusion weights, the sub-gating fusion weights, the first sampling position of the main diagonal sampling point and the second sampling position of the sub-diagonal sampling point, the multi-scale feature map is aggregated and sampled to obtain the target features of the image to be detected. The ship target is detected based on the target features to obtain the ship target detection result.

[0106] Furthermore, the logical instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0107] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the adaptive detection method for ship targets in remote sensing images provided by the methods described above. This method includes: acquiring a multi-scale feature map of the image to be detected; constructing a dynamic sampling coordinate system including a main diagonal direction and a secondary diagonal direction based on reference points of the ship target; generating main diagonal sampling points and secondary diagonal sampling points along the main diagonal direction and the secondary diagonal direction, respectively, in the dynamic sampling coordinate system; and sampling the multi-scale feature map based on the main diagonal sampling points and the secondary diagonal sampling points, respectively, to obtain... A first aggregated feature vector and a second aggregated feature vector are used. Based on the first aggregated feature vector, a high-dimensional response feature of the main branch is determined. Based on the second aggregated feature vector, a high-dimensional response feature of the sub-branch is determined. The high-dimensional response features of the main branch and the sub-branch are input into a gating network to obtain the main gating fusion weights in the main diagonal direction and the sub-gating fusion weights in the sub-diagonal direction output by the gating network. Based on the main gating fusion weights, the sub-gating fusion weights, the first sampling position of the main diagonal sampling point, and the second sampling position of the sub-diagonal sampling point, the multi-scale feature map is aggregated and sampled to obtain the target features of the image to be detected. Based on the target features, the ship target is detected to obtain the ship target detection result.

[0108] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements an adaptive detection method for ship targets in remote sensing images provided by the methods described above. This method includes: acquiring a multi-scale feature map of the image to be detected; constructing a dynamic sampling coordinate system including a main diagonal direction and a secondary diagonal direction based on reference points of the ship target; generating main diagonal sampling points and secondary diagonal sampling points along the main diagonal direction and the secondary diagonal direction, respectively, in the dynamic sampling coordinate system; and sampling the multi-scale feature map based on the main diagonal sampling points and the secondary diagonal sampling points to obtain a first aggregated feature vector and a second aggregated feature vector. The system generates a feature vector and determines the high-dimensional response features of the main branch based on the first aggregated feature vector, and determines the high-dimensional response features of the sub-branch based on the second aggregated feature vector. The high-dimensional response features of the main branch and the sub-branch are then input into a gating network to obtain the main gating fusion weights in the main diagonal direction and the sub-gating fusion weights in the sub-diagonal direction output by the gating network. Based on the main gating fusion weights, the sub-gating fusion weights, the first sampling position of the main diagonal sampling point, and the second sampling position of the sub-diagonal sampling point, the multi-scale feature map is aggregated and sampled to obtain the target features of the image to be detected. The ship target is then detected based on the target features to obtain the ship target detection result.

[0109] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0110] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0111] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. An adaptive detection method for ship targets in remote sensing images, characterized in that, include: Obtain multi-scale feature maps of the image to be detected; Based on the reference point of the ship target, a dynamic sampling coordinate system including the main diagonal direction and the secondary diagonal direction is constructed. Under the dynamic sampling coordinate system, main diagonal sampling points and secondary diagonal sampling points are generated along the main diagonal direction and the secondary diagonal direction, respectively. Based on the main diagonal sampling points and the secondary diagonal sampling points, the multi-scale feature map is sampled to obtain a first aggregated feature vector and a second aggregated feature vector. The high-dimensional response features of the main branch are determined based on the first aggregated feature vector, and the high-dimensional response features of the secondary branch are determined based on the second aggregated feature vector. The high-dimensional response features of the main branch and the high-dimensional response features of the secondary branch are input into a gating network to obtain the main gating fusion weights in the main diagonal direction and the secondary gating fusion weights in the secondary diagonal direction output by the gating network. Based on the main gating fusion weight, the secondary gating fusion weight, the first sampling position of the main diagonal sampling point, and the second sampling position of the secondary diagonal sampling point, the multi-scale feature map is aggregated and sampled to obtain the target features of the image to be detected. Based on the target features, the ship target is detected to obtain the ship target detection result.

2. The adaptive detection method for ship targets in remote sensing images according to claim 1, characterized in that, The reference point based on the ship target constructs a dynamic sampling coordinate system including the main diagonal direction and the secondary diagonal direction, including: Obtain the width and height of the reference point of the ship target; Determine the diagonal modulus based on the width and the height; Based on the diagonal modulus, the width, and the height, the main diagonal direction and the secondary diagonal direction are determined, and a dynamic sampling coordinate system including the main diagonal direction and the secondary diagonal direction is constructed.

3. The adaptive detection method for ship targets in remote sensing images according to claim 2, characterized in that, The step of determining the high-dimensional response features of the main branch based on the first aggregated feature vector and determining the high-dimensional response features of the sub-branch based on the second aggregated feature vector includes: Based on the first aggregated feature vector, the main feature activation intensity response in the main diagonal direction is determined, and based on the second aggregated feature vector, the secondary feature activation intensity response in the sub-diagonal direction is determined. Based on the first aggregated feature vector and the preset query vector, a first semantic matching degree response feature is determined, and based on the second aggregated feature vector and the query vector, a second semantic matching degree response feature is determined. Based on the main feature activation intensity response, the first semantic matching degree response feature, the diagonal modulus, and the average sampling width, the main branch high-dimensional response feature is determined; the average sampling width is determined based on the first sampling width of the main diagonal sampling point and the second sampling width of the sub-diagonal sampling point. The high-dimensional response features of the sub-branch are determined based on the activation intensity response of the sub-feature, the second semantic matching degree response feature, the diagonal modulus, and the average sampling width.

4. The adaptive detection method for ship targets in remote sensing images according to claim 3, characterized in that, The method further includes: Based on the query vector, the main diagonal direction, the diagonal modulus, the average sampling width, the width variation coefficient of the average sampling width, and the target area of ​​the ship target, the attention weight of the main sampling point in the main diagonal direction is determined. Based on the query vector, the sub-diagonal direction, the diagonal magnitude, the average sampling width, the width variation coefficient of the average sampling width, and the target area, determine the attention weight of the sub-sampling points in the sub-diagonal direction; The process of aggregating and sampling the multi-scale feature map based on the main gate fusion weight, the secondary gate fusion weight, the first sampling position of the main diagonal sampling point, and the second sampling position of the secondary diagonal sampling point to obtain the target features of the image to be detected includes: Based on the main gating fusion weight, the secondary gating fusion weight, the main sampling point attention weight, the secondary sampling point attention weight, the first sampling position of the main diagonal sampling point, and the second sampling position of the secondary diagonal sampling point, the multi-scale feature map is aggregated and sampled to obtain the target features of the image to be detected.

5. The adaptive detection method for ship targets in remote sensing images according to claim 4, characterized in that, The method of aggregating and sampling the multi-scale feature map based on the main gating fusion weight, the secondary gating fusion weight, the main sampling point attention weight, the secondary sampling point attention weight, the first sampling position of the main diagonal sampling point, and the second sampling position of the secondary diagonal sampling point to obtain the target features of the image to be detected includes: Based on the main gating fusion weight and the secondary gating fusion weight, the first sampling position and the second sampling position are weighted and fused to obtain the fused sampling position; Based on the main gating fusion weight and the secondary gating fusion weight, the main sampling point attention weight and the secondary sampling point attention weight are weighted and fused to obtain the fused attention weight; Based on the fusion sampling location and the fusion attention weight, the multi-scale feature map is weighted and aggregated to obtain the target feature.

6. The adaptive detection method for ship targets in remote sensing images according to any one of claims 1 to 5, characterized in that, The process of generating main diagonal sampling points and secondary diagonal sampling points along the main diagonal direction and the secondary diagonal direction, respectively, in the dynamic sampling coordinate system, includes: Determine the initial offset relative to the reference point, and the target sampling bandwidth; The target sampling bandwidth is adaptively converged, and the initial offset is geometrically calibrated to obtain calibration parameters; Based on the calibration parameters and the reference point, the main diagonal sampling point and the secondary diagonal sampling point are generated.

7. The adaptive detection method for ship targets in remote sensing images according to claim 6, characterized in that, The step of determining the target sampling bandwidth includes: Obtain the basic sampling bandwidth; Based on the target area of ​​the ship target and the learnable area sensitivity parameters, the width scaling factor is determined; The target sampling bandwidth is determined based on the base sampling bandwidth and the width scaling factor.

8. The adaptive detection method for ship targets in remote sensing images according to claim 6, characterized in that, The geometric calibration of the initial offset to obtain calibration parameters includes: Determine the rotation angle of the ship target, and based on the rotation angle, determine the rotation matrix; Based on the rotation matrix, the initial offset is transformed to obtain the calibration parameters.

9. An adaptive detection device for ship targets in remote sensing images, characterized in that, include: The acquisition unit is used to acquire multi-scale feature maps of the image to be detected. The generation unit is used to construct a dynamic sampling coordinate system including a main diagonal direction and a secondary diagonal direction based on the reference point of the ship target, and to generate main diagonal sampling points and secondary diagonal sampling points along the main diagonal direction and the secondary diagonal direction respectively under the dynamic sampling coordinate system; The determining unit samples the multi-scale feature map based on the main diagonal sampling points and the sub-diagonal sampling points to obtain a first aggregated feature vector and a second aggregated feature vector. Based on the first aggregated feature vector, it determines the high-dimensional response features of the main branch and the high-dimensional response features of the sub-branch based on the second aggregated feature vector. The high-dimensional response features of the main branch and the high-dimensional response features of the sub-branch are input into the gating network to obtain the main gating fusion weights in the main diagonal direction and the sub-gating fusion weights in the sub-diagonal direction output by the gating network. The detection unit is used to aggregate and sample the multi-scale feature map based on the main gating fusion weight, the secondary gating fusion weight, the first sampling position of the main diagonal sampling point and the second sampling position of the secondary diagonal sampling point to obtain the target features of the image to be detected, and to detect the ship target based on the target features to obtain the ship target detection result.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the adaptive detection method for ship targets in remote sensing images as described in any one of claims 1 to 8.