SAR image ship identification method based on information token selection network

Through the sea clutter suppression module and multi-head dynamic local convolution module of the information token selection network, combined with the discriminative loss function, the problems of sea clutter interference and in-class and out-class differences in SAR ship recognition are solved, and high-precision ship target recognition is achieved.

CN120726583AActive Publication Date: 2025-09-30UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511168323.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-20
Publication Date
2025-09-30
Estimated Expiration
2045-08-20

AI Technical Summary

Technical Problem

Existing SAR ship recognition methods have problems with insufficient recognition accuracy due to sea clutter interference, intra-class differences and inter-class similarities, making it difficult to effectively focus on the ship target area.

Method used

A method based on information token selection network is adopted, including sea clutter suppression module (SCSM), multi-head dynamic local convolution module (MHDLC) and discriminative hybrid loss function. The feature extraction and discrimination are improved through the Transformer architecture to achieve sea clutter suppression and target area focusing.

Benefits of technology

The accuracy of ship recognition in SAR images is significantly improved, the model's intra-class compactness and inter-class separability are enhanced, and high-precision ship classification is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120726583A_ABST
    Figure CN120726583A_ABST
Patent Text Reader

Abstract

The invention discloses an SAR image ship identification method based on an information token selection network, and belongs to the field of synthetic aperture radar target identification. The method comprises the following steps: firstly, embedding a self-driven sea clutter suppression module in a transformer block, and guiding the model to distinguish invalid sea clutter tokens from valid target area tokens; the token selection mechanism accurately separates two types of tokens to reduce interference, the double-flow updating strategy focuses on effective tokens through differentiation calculation, model learning is forced to have feature representation with high intra-class aggregation degree and inter-class distinction degree, and the balance between model efficiency and calculation efficiency is ensured; secondly, a multi-head dynamic local convolution module is provided to enhance the feature extraction capability; according to the module, standard MSA is replaced by multi-head dynamic convolution, key features are highlighted through a spatial position dynamic weighting mechanism, kernel redundancy is reduced through channel grouping and weight sharing, and the feature discrimination ability is improved while the efficiency is kept. Through joint constraint of the CLS token and the key feature token, the accuracy of ship target identification in the SAR image is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of synthetic aperture radar (SAR) target recognition and relates to a SAR image ship recognition method based on an information token selection network. Background Art

[0002] Existing ship identification technologies primarily include visual monitoring, satellite remote sensing, and Automatic Identification System (AIS) monitoring. Visual monitoring is susceptible to weather constraints. While AIS systems offer advantages such as wide monitoring range, low cost, and high real-time performance, they are only applicable to ships equipped with AIS equipment and pose the risk of data tampering. Synthetic Aperture Radar (SAR), as a long-range remote sensing imaging technology, is unaffected by illumination, weather, and cloud cover, making it a crucial instrument in numerous remote sensing applications. Unlike optical sensors, SAR has the ability to penetrate clouds and fog, enabling successful observation even in adverse weather conditions. Against this backdrop, ship target monitoring using SAR imagery, including ship detection and identification, has become a research hotspot, with ship identification being a particularly valuable aspect. Specifically, in the civilian sector, SAR imagery ship monitoring technology not only provides comprehensive and effective support for maritime surveillance tasks such as maritime decision-making and surface traffic planning, but can also be used for search and rescue operations when vessels are in danger.

[0003] Existing SAR ship recognition methods are primarily categorized into two types: traditional algorithms and CNN algorithms. Traditional algorithms rely on manual feature extraction and classifiers, but suffer from strong subjectivity and poor scalability. CNN algorithms, while employing an end-to-end framework, have shown significant progress but can focus on ineffective areas. Recent research has attempted to integrate traditional features to improve model interpretability, but this requires SAR images with clean backgrounds. The Visual Transformer (ViT), thanks to its multi-head self-attention (MSA) mechanism, has demonstrated superior image feature extraction capabilities to CNNs and is suitable for constructing long-range information associations in SAR images. However, its application in SAR ship ATR is still in its infancy, and recent research has demonstrated its potential in this area.

[0004] Recent related research also shows that SAR ship ATR has made significant breakthroughs, but it still faces a series of challenges in further improving recognition accuracy: 1) Sea clutter interference may make it difficult for the model to focus on the discriminative ship target area; 2) Intra-class differences and inter-class similarities further increase the difficulty of recognition. Summary of the Invention

[0005] To address these challenges, this paper proposes a method for ship recognition in synthetic aperture radar (SAR) imagery using an Information Token Selection Network (ITS-ShipFormer) based on a novel Transformer architecture. Specifically, this method employs three innovative components: a sea clutter suppression module (SCSM), a multi-head dynamic local convolution module (MHDLC), and a discriminative hybrid loss function, ensuring superior SAR image ship recognition accuracy.

[0006] This paper discloses a method for ship recognition in SAR images based on an information token selection network, aiming to address the issue of insufficient ship recognition accuracy in SAR images. The method primarily comprises seven steps: dataset preparation, a multi-head dynamic local convolution module, a sea clutter suppression module, a discriminative hybrid loss function, model establishment, model testing, and model evaluation. To automatically distinguish between sea clutter and target ship regions, thereby improving feature validity and discriminability, a sea clutter suppression module (SCSM) is innovatively embedded within the transformer block. This module employs a dual-strategy mechanism to accurately distinguish informative ship tokens from invalid sea clutter tokens and a dual-stream token update mechanism for intelligently allocating computing resources. This significantly improves recognition accuracy while maintaining model efficiency. To address the challenges of both intra-class differences and inter-class similarities, a multi-head dynamic local convolution (MHDLC) module is proposed. This module uses multi-head dynamic convolution to replace the standard MSA, highlights key features through a dynamic weighting mechanism of spatial position, and reduces kernel redundancy through channel grouping and weight sharing, thereby improving feature discrimination while maintaining efficiency; in order to enhance intra-class compactness and inter-class separation, the present invention designs a discriminative hybrid loss function Ali optimization model. At the same time, the experimental results on two open SAR ship datasets (i.e., Open-SARShip dataset and FUSAR-Ship dataset) jointly show that the present invention achieves the most advanced SAR ship classification accuracy. Through a large number of comparative experiments and visual analysis, the effectiveness of each module is fully verified.

[0007] The present invention provides a method for ship recognition in synthetic aperture radar (SAR) images based on an information token selection network, which can effectively suppress the influence of sea clutter. The invention has better intra-class compactness and inter-class separability, and improves the accuracy of SAR ship classification. The method includes the following steps:

[0008] Step 1: Prepare and preprocess the ship and ocean target recognition dataset, and divide it into training and test sets;

[0009] Step 2: Establish a multi-head dynamic local convolution module to efficiently extract image features; the multi-head dynamic local convolution module processes the image through dynamic position embedding, multi-head dynamic convolution kernel, dynamic convolution, layer normalization and feedforward network to obtain multi-head dynamic convolution features;

[0010] Step 3: Establish a sea clutter suppression module based on the transformer block, and achieve invalid feature suppression and computational resource allocation through information-enriched token screening and dual-stream token update mechanism; the transformer block is stacked with multiple layers of multi-head attention and feedforward network; in the information-enriched token screening, the importance score of each token is calculated and optimized through a hybrid attention scoring strategy and a global attention evolution strategy, and information-enriched tokens and invalid tokens are screened; in the dual-stream token update mechanism, the information-enriched token is updated through a multi-layer stack of multi-head attention and feedforward network, and the importance score of the information-enriched token is updated at each layer; the invalid token is aggregated and then input into the multi-layer stack of multi-head attention and feedforward network for residual update;

[0011] Step 4: Based on a multi-head dynamic local convolution module with a set number of layers and a sea clutter suppression module with a set number of layers, a ship recognition model is established. The training set is input into the model, and the model parameters are trained using a loss function to obtain a trained ship recognition model. After testing and evaluating the trained ship recognition model, it is used in the SAR image ship recognition task.

[0012] Furthermore, the specific process of the multi-head dynamic local convolution module is as follows:

[0013] First, the input image is divided into non-overlapping blocks. After the non-overlapping blocks are dynamically embedded, residual connections are made with the non-overlapping blocks to obtain embedded features. Then, after layer normalization and 1×1 convolution, feature maps are generated. , feature map After multi-head dynamic convolution kernel Then we get the pixel-level dynamic convolution kernel, where Represents a set of real numbers, H, W, C are the width, height, and number of channels of the feature map, K is the size of the convolution kernel, and G is the number of groups in the group convolution; then the pixel-level dynamic convolution kernel is combined with the feature map The residual connection, after the dynamic convolution operation, is connected with the embedded feature residual to obtain the output feature, and finally the final multi-head dynamic convolution feature is obtained after layer normalization and feed-forward network.

[0014] Furthermore, the multi-head dynamic convolution kernel includes 1×1 convolution, 5×5 depth-separable convolution, 1×1 convolution, and tensor reshaping.

[0015] Furthermore, the information enrichment token screening adopts a hybrid attention scoring strategy and a global attention evolution strategy. The hybrid attention scoring strategy includes CLS-to-tokens and tokens-to-tokens dual branches, and the generated attention scores are recorded as and , fusion score It can be expressed as:

[0016]

[0017]

[0018]

[0019] in Query vector representing the CLS token; is the query vector of the i-th image token, N is the total number of image tokens, and λ is the hybrid weight hyperparameter; select the fusion score The top q tokens are used as information-enriched tokens, and the remaining N−q tokens are considered invalid tokens. represents the transpose of the size of the convolution kernel, for function;

[0020] Next, update the information enrichment token according to the global attention evolution strategy:

[0021] in, Indicates the The global attention score of the layer, As the first Layer-mixed attention scores, is the fusion coefficient.

[0022] Furthermore, the steps of the dual-stream token update mechanism are as follows:

[0023] First, determine the index set by sorting the global attention scores: ,in Indicates the global attention score Index operation in descending order; index in the collection The token in is selected as the informational token and recorded as the informational marker , 1:k l Represents the index range from 1 to k after the lth level is sorted; the index is located in the set The token in is classified as useless token and recorded as useless mark ;

[0024] Then mark the useless Aggregate into a representative marker , the specific method is:

[0025]

[0026] Where, for The i-th useless token in 、 Represents traversal The mth and nth useless tokens; Represents an aggregation function; subsequently, at each layer of the transformer block, the [CLS] tag, the informative tag and representative markers Input into the multi-head self-attention module MSA and the feedforward network module FFN, and record the informative tags and representative markers The residual is and For skip connections;

[0027] Useless tags Will pass The residuals are updated quickly:

[0028]

[0029] in represents the expansion function, and the subscripts (1) and (2) are used to distinguish the output results of different stages after the MSA and FFN modules are processed.

[0030] Furthermore, the loss function includes cosine margin loss and cross entropy loss, as follows:

[0031]

[0032] in, To discriminate the mixed loss function, β is a hyperparameter that balances the two losses. Represents a given input feature vector and its corresponding tags , the cosine-spaced loss applied on the CLS markers, Indicates each information tag With the corresponding label The cross entropy loss between Specifically, it includes the feature representation of k informative tokens screened out from the i-th group of samples.

[0033] Furthermore, the preprocessing specifically involves changing the image size by using an image resampling method, and adjusting each image to a set size.

[0034] The innovation of this method focuses on three dimensions: First, in the field of SAR ship automatic target recognition (ATR), the ITS-ShipFormer end-to-end model based on the Transformer architecture is pioneered. This is the first attempt to achieve sea clutter interference suppression and target area focusing only through image-level labels, opening up a new path for deeply exploring the advantages of the Transformer structure. Second, to address the difficulties of sea clutter interference and target area focusing, a sea clutter suppression module (SCSM) is embedded in the Transformer block. This module accurately distinguishes informative ship tokens from invalid sea clutter tokens through hybrid attention scoring and global attention evolution strategy, and adopts a dual-stream token update mechanism (finely updating informative tokens and simplifying the processing of interference tokens) to achieve intelligent allocation of computing resources, thereby improving recognition accuracy while ensuring model efficiency. Third, to address the problems of intra-class differences and inter-class similarities, a multi-head dynamic local convolution (MHDLC) module is designed on the one hand to enhance feature discriminability through spatial dynamic weighting and channel grouping, and on the other hand to construct a discriminative hybrid loss function to simultaneously constrain the global CLS. The proposed method combines the use of a single token with local ship feature tokens, forcing the model to learn compact intra-class and inter-class feature representations, addressing key challenges at both the feature extraction and loss optimization levels. This method achieved a recognition accuracy of 90.84% ​​on the FUSAR-Ship dataset and 84.09% in a three-class classification task on the OpenSARShip dataset.

[0035] The advantages of the present invention are that it replaces the traditional self-attention mechanism with dynamic convolution, significantly improving the model's feature extraction ability to cope with intra-class differences and inter-class similarities; adopts a dual-stream token update strategy to solve the problem of sea clutter interference in an innovative way; and by jointly constraining CLS tokens and key feature tokens, forces the model to learn feature representations with high intra-class aggregation and inter-class discrimination, thereby improving the accuracy of ship target recognition in SAR images. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 This is a flow chart of the method for ship target recognition in SAR images provided by the present invention.

[0037] Figure 2 This is the overall architecture of the model in the present invention.

[0038] Figure 3 This is a structural diagram of the MHDLC module proposed in the present invention.

[0039] Figure 4This is a structural diagram of the SCSM module proposed in the present invention. DETAILED DESCRIPTION

[0040] The present invention will be further explained below with reference to the accompanying drawings.

[0041] A ship recognition method for SAR images based on information token selection network, such as Figure 1 and Figure 2 As shown, the following steps are included:

[0042] Step 1: Prepare a dataset for ship and ocean object recognition and divide it into training and test sets.

[0043] Step 1.1: Three-category Open-SARShip dataset: Based on the Open-SARShip dataset, a small three-category OpenSARShip dataset was built for experiments, which includes bulk carriers, container ships, and tankers. A new dataset was obtained and the dataset was divided into two parts in a ratio of 7:3 to obtain the training set. and test set .

[0044] Open-SARShip is an open benchmark dataset for SAR ship and ocean target recognition and identification. It has a ship resolution of approximately 20 meters in range and azimuth, covering various ocean, land, coastal, river and island scenarios. It mainly includes three major ship categories, namely bulk carriers, container ships and tankers, which cover approximately 80% of the international shipping market, with a total of 11,346 SAR ships with AIS information.

[0045] Step 1.2: FUSAR-Ship dataset: Based on the FUSAR-Ship dataset, the order of SAR images in the FUSAR-Ship dataset is adjusted randomly, and the dataset is divided into two parts in a ratio of 7:3 to obtain the training set. and test set .

[0046] FUSAR-Ship is an open benchmark dataset for SAR ship and ocean target recognition and identification, covering various ocean, land, coastal, river and island scenarios. It mainly includes 15 main ship categories, 98 subcategories and many non-ship targets, with a total of more than 5,000 SAR ships with AIS information.

[0047] Step 2: Preprocessing of input images.

[0048] The image resampling method is used to change the image size of the training set obtained in step 1.1, and each image is adjusted to the size of 224×224 to obtain the input training set, which is recorded as .

[0049] The image resampling method is used to change the image size of the training set obtained in step 1.2, and each image is adjusted to the size of 224×224 to obtain the input training set, which is recorded as .

[0050] For the convenience of description, the above training sets are collectively referred to as .

[0051] Image resampling methods involve resampling a digital image composed of discrete data after sampling, at the desired pixel locations or pixel spacing, to construct a new image after geometric transformation. The resampling process is essentially an image restoration process. It reconstructs a two-dimensional continuous function representing the original image from the input discrete digital image, and then resamples it at the new pixel spacing and pixel locations. The mathematical process involves estimating or interpolating the values ​​of the new sampling points using the values ​​of the surrounding two-pixel points based on the reconstructed continuous function (surface). This is equivalent to performing a two-dimensional convolution operation between the sampling function and the input image.

[0052] Step 3: Establish a multi-head dynamic local convolution module to perform efficient feature extraction on the image.

[0053] like Figure 3 As shown in the figure, first, the SAR ship image is input and divided into 4×4 non-overlapping blocks, and then passes through two layers of multi-head dynamic local convolution (MHDLC) modules to use multi-head dynamic convolution for efficient feature extraction. Specifically, after the non-overlapping blocks are subjected to dynamic position embedding (DPE), residual connections are performed with non-overlapping blocks to obtain embedded features, and then layer normalization and 1×1 convolution are performed to generate feature maps. , feature map After multi-head dynamic convolution kernel Then we get the pixel-level dynamic convolution kernel, where Represents a set of real numbers, H, W, C are the width, height, and number of channels of the feature map, K is the size of the convolution kernel, and G is the number of groups in the group convolution; then the pixel-level dynamic convolution kernel is combined with the feature map Residual connection, the multi-head dynamic convolution kernel includes 1×1 convolution, 5×5 depth-separable convolution, 1×1 convolution, and tensor reshaping; then after dynamic convolution operation, it is connected with the embedded feature residual to obtain the output feature , and finally the final multi-head dynamic convolution features are obtained after layer normalization and feed-forward network.

[0054] The multi-head dynamic local convolution module proposed in this paper is a feature map generated from layer normalization and 1×1 convolution The multi-head dynamic convolution is used to simulate the multi-head self-attention (MSA) mechanism to achieve dynamic feature extraction and focus on the features with the richest information. ,and It is designed for the coordinates in the feature map X Pixels Customized K×K dynamic convolution kernel. The multi-head dynamic convolution kernel achieves feature adaptive aggregation through the following methods:

[0055]

[0056]

[0057]

[0058] where r is the channel compression ratio for efficient processing, 、 It is the feature representation of the intermediate process; represents a depth-wise separable convolution of size 5×5 pixels; Represents a standard convolution of 1×1 pixels; Represents the tensor reshaping operation. Then, to obtain the pixel-level dynamic convolution kernel After that, the corresponding output features can be generated through dynamic convolution operation :

[0059]

[0060] It represents the dynamic convolution operation of group channel weight sharing, and its specific calculation process is defined as:

[0061]

[0062] in , represents the dynamic convolution neighborhood offset, represents the dynamic convolution neighborhood offset set based on the center pixel, where is a set of integers, Represent a two-dimensional integer vector space:

[0063]

[0064] Dynamic positional embedding is a technique for adaptively encoding sequence position information. It dynamically generates positional representations through relative position encoding or learnable positional parameters, replacing traditional fixed positional encodings (such as the sine function). Its core concept is to capture relative distances between elements in a sequence (such as the distance between adjacent words and long-range dependencies) rather than absolute positions. This allows for flexible adaptation to inputs of varying lengths, improving the model's ability to model position-sensitive tasks, particularly by mitigating the problem of positional information attenuation when processing long texts.

[0065] The 5×5 depthwise separable convolution decomposes the standard convolution into two steps: depthwise convolution (each input channel independently applies a 5×5 convolution kernel to extract spatial features) and pointwise convolution (1×1 convolution to fuse information across channels). This significantly reduces the amount of computation while retaining the advantage of a large receptive field. The number of parameters is only about 1 / 9 of that of ordinary convolution, significantly improving model efficiency.

[0066] Tensor reshaping is an operation that rearranges the dimensional structure of a multidimensional array without changing the content of the data elements. By adjusting the shape of the tensor (for example, converting a 3×4 matrix into a 2×6 or 12×1 vector), it changes the logical organization of data in memory to accommodate the input format requirements of different algorithms (for example, flattening image data for input to a fully connected layer). Reshaping operations must maintain a constant total number of elements and respect memory continuity. They are commonly used in scenarios such as data dimensionality conversion, feature map splicing, and model input adaptation.

[0067] The Feed-Forward Network (FFN) consists of two fully connected layers and a nonlinear activation function (such as ReLU or GELU). It independently applies a nonlinear transformation to each position vector output by the self-attention algorithm. This function expands the feature space dimensionality and enhances the model's expressiveness. While maintaining position independence through point-by-point computation, it complements the self-attention mechanism to map low-level features to high-level semantics.

[0068] Step 4: Establish a sea clutter suppression (SCSM) module. Through information enrichment token screening and dual-stream token update mechanism, it can suppress sea clutter interference while achieving efficient allocation of computing resources.

[0069] The multi-head dynamic convolution feature obtained in step 3 is used as the input of the sea clutter suppression module. Its core architecture is as follows: Figure 4As shown in the figure, this module consists of two major components: information-enriched token screening and a dual-stream token update mechanism. It is based on a transformer block composed of a multi-layer attention mechanism. In information-enriched token screening, a hybrid attention scoring strategy (including CLS-to-tokens and tokens-to-tokens dual branches) and a global attention evolution strategy are used to calculate and optimize the importance score of each token based on the attention graph, accurately screening information-enriched tokens and invalid tokens. Figure 4 The left side adopts a dual-stream token update mechanism. Informative tokens are subjected to full multi-head attention (MSA) and feed-forward network (FFN) calculations via a slow path to finely extract features. Invalid tokens are aggregated into representative tokens via a fast path to reduce computational complexity, thereby achieving efficient allocation of computing resources while suppressing sea clutter interference.

[0070] Specifically, in the information enrichment token screening branch, a hybrid attention scoring strategy and a global attention evolution strategy are used to ensure screening accuracy. The hybrid attention scoring strategy includes two branches: CLS-to-tokens and tokens-to-tokens. The attention scores generated by the two strategies are recorded as and , fusion score It can be expressed as:

[0071]

[0072]

[0073]

[0074] in The query vector representing the CLS token, where CLS Token is a special tag used for classification and is used in the CLS-to-tokens branch to generate the global feature information required for classification; is the query vector of the i-th image token, N is the total number of image tokens, and λ is the hybrid weight hyperparameter. By calculating the fusion score , the first q tokens with the highest scores are selected as information enrichment tokens, and the remaining N−q tokens are judged as invalid tokens containing sea clutter. represents the transpose of the size of the convolution kernel, for function.

[0075] Then, the information enrichment token is updated according to the global attention evolution strategy; Transformer blocks are stacked in multiple layers, and each layer has an independent attention calculation process. Different layers transmit attention information through residual connections, and the global attention score of the previous layer will participate in the calculation of the next layer. The fusion score of different layers Residual connections are used between them to promote the flow of attention information, which can be expressed as:

[0076]

[0077] in, Indicates the The global attention score of the layer, As the first Layer-mixed attention scores, is the fusion coefficient. For each layer with token screening, only the global attention score of the selected information enrichment token is updated.

[0078] During the dual-stream token update phase, differentiated processing is implemented for two types of tokens: information-rich tokens are processed using a slow path with strong expressiveness for fine feature extraction, while invalid tokens are processed using a fast path to reduce computational complexity and suppress sea clutter interference, thereby simultaneously ensuring the effectiveness and efficiency of the ITS-ShipFormer model. The update process is as follows:

[0079] First, determine the index set by sorting the global attention scores: ,in Indicates the global attention score Index operation in descending order. Then, filter by index: put the index in the collection The token in is selected as the informational token and recorded as the informational marker , where l represents the lth layer, 1:k l Represents the index range from 1 to k after the lth level is sorted; the index is located in the set The token in is classified as useless token and recorded as useless mark . Then, the useless mark Aggregate into a representative marker , the specific method is:

[0080]

[0081] Where, for The i-th useless token in 、 Represents traversal The mth and nth useless tokens; Represents an aggregation function. Subsequently, at each layer of the transformer block, the [CLS] tag, the informative tag and representative markers Input into the multi-head self-attention module MSA and the feedforward network module FFN, and record their residuals as and For skip connections, therefore, [CLS] tag , informational markings and representative markers The update is done in a slow and careful manner. After the slow update is complete, the Will pass The residuals are updated quickly:

[0082]

[0083] in Denotes the expansion function, and the subscripts (1) and (2) are used to distinguish the output results of different stages after the MSA and FFN modules are processed, respectively representing the output of the MSA module in the first stage and the FFN module in the second stage.

[0084] Step 5: Construct a discriminative hybrid loss function to achieve better intra-class compactness and inter-class separability by imposing constraints on the entire SAR image marked with CLS and all local information marks.

[0085] Using a discriminative mixed loss function, for a given input feature vector and its corresponding tags , the cosine-spaced loss applied on the CLS marker is denoted as ; For local information tags, each information tag With the corresponding label Cross entropy (CE) loss is used between . Given information tag , Specifically, it is the feature representation of the k informative tokens selected from the i-th group of samples. Using the loss formula on the information tag, we can get ; Combining the two losses can get the final discriminant mixed loss .

[0086] Specifically, the discriminative hybrid loss of ITS-ShipFormer consists of two parts: cosine margin loss and and loss of information markings , the overall formula is:

[0087]

[0088] Where β is a hyperparameter that balances the two losses, and the cosine margin loss applied on the CLS labeling is denoted as , the information labeling loss applied on the information label is recorded as , the calculation formula of cosine interval loss can be expressed as:

[0089]

[0090] Among them, e is the representation of the exponential function, i is the index of the sample, and s is a hyperparameter used to scale the value of cosine similarity; represents the hyperparameter of the cosine interval; is the angle between the feature vector of the true category yi corresponding to sample i and the classification weight vector, is the angle between the feature vector of sample i corresponding to the non-true category j (j≠yᵢ) and the classification weight vector.

[0091] Each information tag With the corresponding label Cross entropy (CE) loss is used between them, given the information tag , the loss formula on the information label is:

[0092]

[0093] Step 6: Train the ship recognition model. Figure 2 As shown in the figure, a ship recognition model is established through a two-stage multi-head dynamic local convolution module and a two-stage sea clutter suppression module. The training set is input into the model, and the model parameters are trained using the SGD optimizer and loss function to obtain a trained ship recognition model.

[0094] Stochastic Gradient Descent (SGD) is an iterative optimization algorithm. Its core mechanism is to approximate the gradient direction of the loss function by randomly selecting single examples or mini-batches of examples, and use this to update model parameters. The specific process is: in each iteration, a sample (or mini-batch) is randomly sampled from the training set, the gradient of the loss under the current parameters is calculated, and the parameters are then updated along the negative gradient direction. Compared with traditional batch gradient descent, SGD does not need to traverse the entire data set, significantly reducing memory overhead and computational cost, making it particularly suitable for training large datasets. However, its gradient estimate is noisy due to random sampling, which causes the parameter update path to oscillate, potentially converging to a local optimum or slowly approaching the global optimum. To alleviate this problem, momentum methods (to accelerate convergence and suppress oscillations) or learning rate decay strategies (such as exponential decay and cosine annealing) are often combined to improve stability while maintaining efficient computational properties. This makes it one of the most fundamental optimizers in deep learning model training and is widely used in scenarios such as online learning and non-convex optimization.

[0095] Step 7: Test the ship recognition model;

[0096] The image resampling method is used to adjust the image size of the test set, and each image is resized to 224×224.

[0097] The obtained test set is used to test the ship recognition model obtained in step 6 using a standard classification network testing method to obtain the test results of the three test sets on the ship recognition model. The standard classification network testing method refers to performing a final test on the recognition model on the test set to obtain the recognition results of the recognition model on the test set.

[0098] Step 8: Evaluate the ship identification model;

[0099] As shown in Table 1, the recognition results of the ship recognition model obtained in step 6 are used as input, and the standard evaluation index calculation method is used to calculate the accuracy, recall rate, precision rate, three-level index and confusion matrix.

[0100] Table 1: Evaluation results on the penSARShip dataset

[0101] Predicted class True class bulk carriers container ship tanker Recall bulk carriers 256 63 9 78.42 container ship 94 697 17 86.26 tanker 10 11 125 85.62 Accuracy (%) 71.11 90.40 82.78 Accuracy rate 84.09% Level 3 indicators (%) 74.59 88.28 84.18 84.09%

[0102] Accuracy Refers to the proportion of correct results among the results predicted as positive examples. Defined as , is the number of positive samples correctly identified, is the number of negative samples correctly identified, is the number of positive samples correctly identified, is the number of missed positive samples, and the correct number of ship classifications is , the total number of all ships is ;

[0103] Recall Refers to the number of correct predictions among all positive samples. Defined as ,in, is the number of positive samples correctly identified, is the number of positive samples that are missed;

[0104] Accuracy Refers to the number of correct predictions among all the positive samples predicted. Defined as ,in, is the number of positive samples correctly identified, is the number of positive samples correctly identified;

[0105] Level 3 indicators At the same time, the accuracy of the recognition model is taken into account and recall . Level 3 indicators Defined as ,in represents the recall rate, Indicates accuracy;

[0106] The confusion matrix is ​​the most basic, intuitive, and computationally simple method for measuring the accuracy of a recognition model. It counts the number of observations that the recognition model incorrectly and correctly classifies, and then displays the results in a table.

[0107] As shown in Table 2, the accuracy achieved by the present invention on the FUSAR-Ship dataset is 90.84%, and the accuracy on the three categories of the Open-SARShip dataset is 84.09%. From the above experimental recognition results, it can be seen that the present invention achieves the highest detection accuracy among several existing technologies, indicating that the present invention can achieve high-precision ship target recognition in SAR images.

[0108] Table 2: Evaluation results on the FUSAR-Ship dataset

[0109] Predicted class True class bulk carriers container ship fishing boat Ordinary ship Other ships Other cargo ships tanker Recall bulk carriers 475 2 4 5 0 5 3 96.15 container ship 0 521 1 0 0 0 1 99.62 fishing boat 3 0 378 0 36 54 2 79.92 Ordinary ship 1 3 0 511 0 0 2 98.84 Other ships 0 1 17 0 436 58 8 83.85 Other cargo ships 4 2 24 0 56 428 7 82.15 tanker 1 0 10 0 6 11 493 94.63 Accuracy 98.14 98.49 87.10 99.03 81.65 79.98 95.54 90.84% ​​accuracy Level 3 indicators 97.14 99.05 83.35 98.94 82.73 79.48 95.08 90.84%

[0110] It will be understood that the present invention is described by way of some embodiments, and it will be appreciated by those skilled in the art that various changes or equivalent substitutions may be made to these features and embodiments without departing from the spirit and scope of the present invention. In addition, under the teachings of the present invention, these features and embodiments may be modified to adapt to specific circumstances and materials without departing from the spirit and scope of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed herein, and all embodiments falling within the scope of the claims of this application are intended to be protected by the present invention.

Claims

1. A method for ship recognition in SAR images based on information token selection network, characterized in that: The following steps are involved: Step 1: Prepare and preprocess the ship and ocean target recognition dataset, and divide it into training and test sets; Step 2: Establish a multi-head dynamic local convolution module to efficiently extract image features; the multi-head dynamic local convolution module processes the image through dynamic position embedding, multi-head dynamic convolution kernel, dynamic convolution, layer normalization and feedforward network to obtain multi-head dynamic convolution features; Step 3: Establish a sea clutter suppression module based on the transformer block, and achieve invalid feature suppression and computational resource allocation through information-enriched token screening and dual-stream token update mechanism; the transformer block is stacked with multiple layers of multi-head attention and feedforward network; in the information-enriched token screening, the importance score of each token is calculated and optimized through a hybrid attention scoring strategy and a global attention evolution strategy, and information-enriched tokens and invalid tokens are screened; in the dual-stream token update mechanism, the information-enriched token is updated through a multi-layer stack of multi-head attention and feedforward network, and the importance score of the information-enriched token is updated at each layer; the invalid token is aggregated and then input into the multi-layer stack of multi-head attention and feedforward network for residual update; Step 4: Based on a multi-head dynamic local convolution module with a set number of layers and a sea clutter suppression module with a set number of layers, a ship recognition model is established. The training set is input into the model, and the model parameters are trained using a loss function to obtain a trained ship recognition model. After testing and evaluating the trained ship recognition model, it is used in the SAR image ship recognition task.

2. The method for ship recognition in SAR images based on information token selection network according to claim 1, characterized in that: The specific process of the multi-head dynamic local convolution module is as follows: First, the input image is divided into non-overlapping blocks. After the non-overlapping blocks are dynamically embedded, residual connections are made with the non-overlapping blocks to obtain embedded features. Then, after layer normalization and 1×1 convolution, feature maps are generated. , feature map After multi-head dynamic convolution kernel Then we get the pixel-level dynamic convolution kernel, where Represents a set of real numbers, H, W, C are the width, height, and number of channels of the feature map, K is the size of the convolution kernel, and G is the number of groups in the group convolution; then the pixel-level dynamic convolution kernel is combined with the feature map The residual connection, after the dynamic convolution operation, is connected with the embedded feature residual to obtain the output feature, and finally the final multi-head dynamic convolution feature is obtained after layer normalization and feedforward network.

3. The method for ship recognition in SAR images based on information token selection network according to claim 2, characterized in that: The multi-head dynamic convolution kernel includes 1×1 convolution, 5×5 depth-separable convolution, 1×1 convolution, and tensor reshaping.

4. The method for ship recognition in SAR images based on information token selection network according to claim 3, characterized in that: The information enrichment token screening adopts a hybrid attention scoring strategy and a global attention evolution strategy. The hybrid attention scoring strategy includes CLS-to-tokens and tokens-to-tokens dual branches, and the generated attention scores are recorded as and , fusion score Expressed as: ; ; ; in Query vector representing the CLS token; is the query vector of the i-th image token, N is the total number of image tokens, and λ is the mixing weight hyperparameter; Select fusion score The top q tokens are used as information-enriched tokens, and the remaining N−q tokens are considered invalid tokens. represents the transpose of the size of the convolution kernel, for function; Next, update the information enrichment token according to the global attention evolution strategy: ; in, Indicates the The global attention score of the layer, As the first Layer-mixed attention scores, is the fusion coefficient.

5. The method for ship recognition in SAR images based on information token selection network according to claim 4, characterized in that: The steps of the dual-stream token update mechanism are as follows: First, determine the index set by sorting the global attention scores: ,in Indicates the global attention score Index operation in descending order; index in the collection The token in is selected as the informational token and recorded as the informational marker , 1:k l Represents the index range from 1 to k after the lth level is sorted; the index is located in the set The token in is classified as useless token and recorded as useless mark ; Then mark the useless Aggregate into a representative marker , the specific method is: ; Where, for The i-th useless token in 、 Represents traversal The mth and nth useless tokens; Represents an aggregation function; subsequently, at each layer of the transformer block, the [CLS] tag, the informative tag and representative markers Input into the multi-head self-attention module MSA and the feedforward network module FFN, and record the informative tags and representative markers The residual is and For skip connections; Useless tags Will pass The residuals are updated quickly: ; in represents the expansion function, and the subscripts (1) and (2) are used to distinguish the output results of different stages after the MSA and FFN modules are processed.

6. The method for ship recognition in SAR images based on information token selection network according to claim 5, characterized in that: The loss function includes cosine margin loss and cross entropy loss, which are as follows: ; in, To discriminate the mixed loss function, β is a hyperparameter that balances the two losses. Represents a given input feature vector and its corresponding tags , the cosine-spaced loss applied on the CLS markers, Indicates each information tag With the corresponding label The cross entropy loss between Specifically, it includes the feature representation of k informative tokens screened out from the i-th group of samples.

7. The method for ship recognition in SAR images based on information token selection network according to claim 6, characterized in that: The preprocessing specifically involves changing the image size by using an image resampling method, and adjusting each image to a set size.

Citation Information

Patent Citations

  • SAR image ship target detection method based on multi-attention fusion

    CN119360196A

  • Remote sensing image vessel target detection method based on bidirectional cross attention enhancement

    CN119963817A