A SAR image ship identification method based on information token selection network
By selecting the sea clutter suppression module and multi-head dynamic local convolution module of the information token selection network, and combining them with a discriminative hybrid loss function, the problems of sea clutter interference and in-class/out-of-class differences in SAR ship identification are solved, thereby improving the identification accuracy.
Patent Information
- Application Number
- CN202511168323.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-20
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2045-08-20
AI Technical Summary
Existing SAR ship identification methods suffer from insufficient identification accuracy due to sea clutter interference and intra-class differences and inter-class similarities, making it difficult to effectively focus on the target ship area.
An information token-based network selection approach is adopted, including a Sea Clutter Suppression Module (SCSM), a Multi-Head Dynamic Local Convolutional Module (MHDLC), and a discriminative hybrid loss function. The ITS-ShipFormer model is designed to improve feature extraction and discriminative power through a Transformer architecture.
It significantly improves the accuracy of ship identification in SAR images, achieves better intra-class compactness and inter-class separability, and improves the recognition accuracy.
Smart Images

Figure CN120726583B_ABST
Abstract
Description
Technical Field
[0001] This 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 mainly include visual surveillance, satellite remote sensing, and Automatic Identification System (AIS) monitoring. Visual surveillance is susceptible to weather conditions; while AIS systems offer advantages such as wide monitoring range, low cost, and strong real-time performance, they are only applicable to ships equipped with AIS equipment and are subject to data tampering risks. Synthetic Aperture Radar (SAR), as a long-range remote sensing imaging technology, is unaffected by lighting, weather, and cloud cover, and has become an important device in many remote sensing applications. Unlike optical sensors, SAR has the ability to penetrate clouds and fog, enabling it to successfully complete observation tasks even under adverse weather conditions. Against this backdrop, ship target surveillance technology using SAR images, including ship detection and identification, has gradually become a research hotspot, with ship identification being a particularly valuable application. Specifically, in the civilian sector, SAR image ship surveillance technology can not only provide comprehensive and effective support for maritime decision-making and maritime traffic planning, but also be used for search and rescue operations when ships encounter danger.
[0003] Existing SAR ship identification methods are mainly divided into two categories: traditional algorithms and CNN algorithms. Traditional algorithms rely on manual feature extraction and classifiers, but suffer from drawbacks such as strong subjectivity and poor scalability. CNN algorithms adopt an end-to-end framework and, although they have made significant progress, may focus on ineffective regions. Recent research has attempted to integrate traditional features to improve model interpretability, but this requires SAR images with clean backgrounds. Visual transformers (ViTs), due to their multi-head self-attention (MSA) mechanism, have shown superior capabilities to CNNs in image feature extraction, making them suitable for constructing long-range information associations in SAR images. However, their application in the field of SAR ship ATR is still in its early stages, although recent research results have demonstrated their potential in this area.
[0004] Recent studies have shown that SAR ship ATR has made significant breakthroughs, but there are still a series of challenges in further improving the recognition accuracy: 1) Sea clutter interference may make it difficult for the model to focus on discriminative ship target areas; 2) Intra-class differences and inter-class similarities further increase the recognition difficulty. Summary of the Invention
[0005] To address the aforementioned issues, this invention proposes a method for ship identification from synthetic aperture radar (SAR) images based on a novel Transformer architecture Information Token Selection Network (ITS-ShipFormer). Specifically, it is a SAR image ship identification method based on an Information Token Selection Network. This invention innovatively proposes three components—a Sea Clutter Suppression Module (SCSM), a Multi-Head Dynamic Local Convolutional Module (MHDLC), and a discriminative hybrid loss function—ensuring superior ship identification accuracy from SAR images.
[0006] This invention discloses a ship recognition method for SAR images based on information token selection networks (STCNs) to address the problem of insufficient ship recognition accuracy in SAR images. The method mainly comprises seven parts: dataset preparation, a multi-head dynamic local convolution module, a sea clutter suppression module, a discriminative hybrid loss function, ship recognition model establishment, ship recognition model testing, and ship recognition model evaluation. To automatically distinguish between sea clutter regions and ship target regions, thereby improving feature effectiveness and discriminative power, a sea clutter suppression module (SCSM) is innovatively embedded in the transformer block. This module accurately distinguishes between informative ship tokens and invalid sea clutter tokens through a dual-strategy mechanism and employs a dual-stream token update mechanism to achieve intelligent allocation of computational resources, significantly improving recognition accuracy while ensuring model efficiency. To address the challenges of intra-class differences and inter-class similarity, a multi-head dynamic local convolution (MHDLC) module is proposed. This module employs multi-head dynamic convolution to replace standard MSA, highlighting key features through a spatial location-based dynamic weighting mechanism and reducing kernel redundancy through channel grouping and weight sharing, thus improving feature discriminative power while maintaining efficiency. To enhance intra-class compactness and inter-class separability, this invention designs a discriminative hybrid loss function optimization model. Furthermore, experimental results on two open SAR ship datasets (i.e., the Open-SARShip dataset and the FUSAR-Ship dataset) jointly demonstrate that this invention achieves state-of-the-art SAR ship classification accuracy. Extensive comparative experiments and visualization analysis fully validate the effectiveness of each module.
[0007] This invention provides a method for ship identification based on synthetic aperture radar (SAR) images using an information token selection network. This method effectively suppresses the influence of sea clutter and offers better intra-class compactness and inter-class separability, thus improving the accuracy of SAR ship classification. The method includes the following steps:
[0008] Step 1: Prepare and preprocess the ship and marine 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 a transformer block. Invalid feature suppression and computational resource allocation are achieved through information enrichment token filtering and a dual-stream token update mechanism. The transformer block consists of a multi-layered stacked multi-head attention and feedforward network. In the information enrichment token filtering, a hybrid attention scoring strategy and a global attention evolution strategy are used to calculate and optimize the importance score of each token, filtering information enrichment tokens from invalid tokens. In the dual-stream token update mechanism, the information enrichment tokens are updated through a multi-layered stacked multi-head attention and feedforward network, with each layer updating the importance score of the information enrichment tokens. Invalid tokens are aggregated and then input into the multi-layered stacked multi-head attention and feedforward network for residual update.
[0011] Step 4: Based on the multi-head dynamic local convolution module with a set number of layers and the sea clutter suppression module with a set number of layers, establish a ship identification model, input the training set into the model, use the loss function to train the model parameters, and obtain the trained ship identification model; after testing and evaluating the trained ship identification model, use it in SAR image ship identification tasks.
[0012] Furthermore, the specific process of the multi-head dynamic local convolution module is as follows:
[0013] First, the input image is segmented into non-overlapping patches. After dynamic position embedding, the non-overlapping patches are residually connected 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, pixel-level dynamic convolution kernels are obtained, where Let H represent the set of real numbers, W, and C be the width, height, and number of channels of the feature map, respectively, K be the size of the convolution kernel, and G be the number of groups in the group convolution; then, the pixel-level dynamic convolution kernel is applied to the feature map. The residual connection, after dynamic convolution operation, is connected with the embedded feature residual to obtain the output feature. Finally, after layer normalization and feedforward network, the final multi-head dynamic convolution feature is obtained.
[0014] Furthermore, the multi-head dynamic convolution kernel includes 1×1 convolution, 5×5 depthwise separable convolution, 1×1 convolution, and tensor reshaping.
[0015] Furthermore, the information enrichment token filtering employs a hybrid attention scoring strategy and a global attention evolution strategy. The hybrid attention scoring strategy includes two branches: CLS-to-tokens and tokens-to-tokens, and the resulting attention scores are denoted as follows: and , fusion score It can be represented as:
[0016]
[0017]
[0018]
[0019] in The query vector representing the CLS token; Let λ be the query vector for the i-th image token, N be the total number of image tokens, and λ be the fusion weight hyperparameter; select the fusion score. The top q tokens are used as information enrichment tokens, while the remaining N-q tokens are determined to be invalid tokens; This represents the transpose of the convolution kernel size. for function;
[0020] Next, the information enrichment token is updated according to the global attention evolution strategy:
[0021] in, Indicates the first The global attention score of the layer, As the first Layered attention score This is the fusion coefficient.
[0022] Furthermore, the specific steps of the dual-stream token update mechanism are as follows:
[0023] First, the index set is determined by sorting the global attention scores: ,in Indicates global attention score Index operations for descending order; placing the index in the set The token selected in the middle is an informational token, denoted as the informational token. ,1:k l This represents the index range from 1 to k after sorting at level l; the index is located in the set. The tokens in the list are classified as useless tokens and are marked as useless tokens. ;
[0024] Then use useless tags Aggregate into a representative marker The specific method is as follows:
[0025]
[0026] In the formula, for The i-th useless token in the middle, , Indicates traversal The m-th and n-th useless tokens in the middle; This represents an aggregate function; subsequently, at each level of the transformer block, the [CLS] tag and informational tag are added. and representative marks The input is fed into the multi-head self-attention module (MSA) and the feedforward network module (FFN), and informational tags are recorded. and representative marks The residual is and For use in skip connections;
[0027] useless markers Will pass The residuals are updated quickly:
[0028]
[0029] in The extension function is indicated by the subscripts (1) and (2), which are used to distinguish the output results of different stages after processing by the MSA and FFN modules.
[0030] Furthermore, the loss function includes cosine interval loss and cross-entropy loss, as detailed below:
[0031]
[0032] in, To determine the mixed loss function, β is a hyperparameter balancing the two losses. Represents a given input feature vector and their corresponding tags Cosine interval loss applied to the CLS marker, Represents each information tag With corresponding tags Cross-entropy loss between information tags Specifically, this includes the feature representations of the k informative tokens selected from the i-th sample group.
[0033] Furthermore, the preprocessing specifically involves using an image resampling method to change the image size, adjusting each image to a set size.
[0034] The innovation of this method focuses on three dimensions: First, in the field of Automatic Target Recognition (ATR) for SAR ships, it pioneered the ITS-ShipFormer end-to-end model based on the Transformer architecture. This is the first attempt to achieve sea clutter interference suppression and target region focusing solely through image-level labeling, opening up a new path for deeply exploring the advantages of the Transformer structure. Second, addressing the challenges of sea clutter interference and target region focusing, a Sea Clutter Suppression Module (SCSM) is embedded in the Transformer block. This module accurately distinguishes between informative ship tokens and invalid sea clutter tokens through a hybrid attention scoring and global attention evolution strategy. It also employs a dual-stream token update mechanism (fine-grained updating of informative tokens and simplified processing of interference tokens) to achieve intelligent allocation of computational resources, improving recognition accuracy while ensuring model efficiency. Third, addressing the issues of intra-class differences and inter-class similarity, on the one hand, a Multi-Head Dynamic Local Convolution (MHDLC) module is designed to enhance feature discriminative power through spatial dynamic weighting and channel grouping. On the other hand, a discriminative hybrid loss function is constructed to simultaneously constrain the global CLS. By combining tokens with local ship features, the model is forced to learn compact intra-class and separable inter-class feature representations, thus addressing the core challenges from both the feature extraction and loss optimization perspectives. This invention achieves a recognition accuracy of 90.84% on the FUSAR-Ship dataset and 84.09% on the three-class classification task of the OpenSARShip dataset.
[0035] The advantages of this invention are that by replacing the traditional self-attention mechanism with dynamic convolution, the model's ability to extract features that address intra-class differences and inter-class similarities is significantly improved; a dual-stream token update strategy is adopted to solve the problem of sea clutter interference in an innovative way; and by jointly constraining the CLS token and the key feature token, the model is forced to learn feature representations with high intra-class aggregation and inter-class discriminativeness, thereby improving the accuracy of ship target identification in SAR images. Attached Figure Description
[0036] Figure 1 This is a flowchart illustrating the ship target identification method in SAR images provided by the present invention.
[0037] Figure 2 This is the overall architecture of the model in this invention.
[0038] Figure 3 This is a schematic diagram of the structure of the MHDLC module proposed in this invention.
[0039] Figure 4This is a schematic diagram of the SCSM module proposed in this invention. Detailed Implementation
[0040] The invention will be further explained below with reference to the accompanying drawings.
[0041] A method for ship identification based on SAR images using an 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 marine target recognition, and divide it into training and test sets.
[0043] Step 1.1: Three-class Open-SARShip dataset; A small three-class Open-SARShip dataset was built based on the Open-SARShip dataset for experiments, including bulk carriers, container ships, and tankers. The new dataset was obtained and divided into two parts in a 7:3 ratio to obtain the training set. and test set .
[0044] Open-SARShip is an open benchmark dataset for SAR vessel and marine target identification and recognition. It has a vessel resolution of approximately 20 meters in both distance and bearing, covering various marine, land, coastal, river, and island scenarios. It mainly includes three vessel categories: bulk carriers, container ships, and tankers, covering approximately 80% of the international shipping market, with a total of 11,346 SAR vessels with AIS information.
[0045] Step 1.2: FUSAR-Ship Dataset; Based on the FUSAR-Ship dataset, the order of SAR images in the dataset is randomly adjusted, and the dataset is divided into two parts in a 7:3 ratio to obtain the training set. and test set .
[0046] FUSAR-Ship is an open benchmark dataset for SAR vessel and marine target identification and recognition. It covers various marine, land, coastal, river and island scenarios, mainly including 15 major vessel categories, 98 subcategories and many non-vessel targets, with a total of more than 5,000 SAR vessels with AIS information.
[0047] Step 2: Preprocessing of the input image.
[0048] The training set obtained in step 1.1 is resized using an image resampling method, adjusting each image to 224×224 pixels to obtain the input training set, denoted as . .
[0049] The training set obtained in step 1.2 is resized using an image resampling method, adjusting each image to 224×224 pixels to obtain the input training set, denoted as . .
[0050] For ease of description, the above training sets are collectively referred to as... .
[0051] The image resampling method refers to resampling a digital image composed of discrete data after sampling according to the required pixel positions 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 samples according to the new pixel spacing and pixel positions. Mathematically, it estimates or interpolates the values of the new sampling points using the values of the surrounding two pixels based on the reconstructed continuous function (surface), which 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 from the image.
[0053] like Figure 3 As shown, firstly, the input SAR ship image is segmented into 4×4 non-overlapping patches. Then, it passes through two layers of Multi-Head Dynamic Local Convolution (MHDLC) modules, utilizing multi-head dynamic convolution for efficient feature extraction. Specifically, after dynamic position embedding (DPE) of the non-overlapping patches, a residual connection is made with the non-overlapping patches to obtain embedded features. These features are then normalized and subjected to 1×1 convolution to generate a feature map. Feature map After multi-head dynamic convolution kernel Then, pixel-level dynamic convolution kernels are obtained, where Let H represent the set of real numbers, W, and C be the width, height, and number of channels of the feature map, respectively, K be the size of the convolution kernel, and G be the number of groups in the group convolution; then, the pixel-level dynamic convolution kernel is applied to the feature map. The residual connection, wherein the multi-head dynamic convolution kernel includes 1×1 convolution, 5×5 depthwise 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. Finally, after layer normalization and a feedforward network, the final multi-head dynamic convolutional features are obtained.
[0054] The multi-head dynamic local convolution module proposed in this invention generates feature maps from layer normalization and 1×1 convolution. This invention employs multi-head dynamic convolution to simulate the multi-head self-attention (MSA) mechanism, achieving dynamic feature extraction and focusing on the most informative features. The invention designs a multi-head dynamic convolution kernel. ,and It is specifically designed for coordinates in feature map X. pixel Customized K×K dynamic convolution kernels. Multi-head dynamic convolution kernels achieve adaptive feature aggregation in the following way:
[0055]
[0056]
[0057]
[0058] Where r is the channel compression ratio used for efficient processing. , This represents the characteristics of the intermediate process; This represents a depth-separable convolution with a size of 5×5 pixels; This represents a standard convolution of 1×1 pixels; This represents the tensor reshaping operation. Then, pixel-level dynamic convolution kernels are obtained. Then, the corresponding output features can be generated through dynamic convolution operations. :
[0059]
[0060] The dynamic convolution operation representing the sharing of channel weights among groups is specifically defined as follows:
[0061]
[0062] in , This represents the offset of the dynamic convolution neighborhood. Represents the set of dynamic convolutional neighborhood offsets based on the center pixel, where It is a set of integers. Representing a two-dimensional integer vector space:
[0063]
[0064] Dynamic position embedding is an adaptive technique for encoding positional information in sequences. It dynamically generates positional representations through relative positional encoding or learnable positional parameters, replacing traditional fixed positional encoding (such as sine functions). Its core idea is to capture the relative distance relationships between elements in a sequence (such as the spacing between adjacent words, long-range dependencies), rather than absolute positions. This allows for flexible adaptation to inputs of different lengths, improving the model's ability to model position-sensitive tasks, and especially reducing the problem of positional information decay 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 fuses information across channels). While retaining the advantage of a large receptive field, it significantly reduces the amount of computation. Its number of parameters is only about 1 / 9 of that of ordinary convolution, which significantly improves the efficiency of the model.
[0066] Tensor reshaping is an operation that rearranges the dimensional structure of a multidimensional array without changing the content of its data elements. It alters the shape of the tensor (e.g., transforming a 3×4 matrix into a 2×6 or 12×1 vector) to change the logical organization of the data in memory, adapting it to the input format requirements of different algorithms (e.g., flattening image data before inputting it into a fully connected layer). The reshaping operation must maintain a constant total number of elements and pay attention to memory continuity. It is commonly used in scenarios such as data dimensionality transformation, feature map stitching, or 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), which independently performs a nonlinear transformation on each position vector of the self-attention output. Its function is to expand the feature space dimension, enhance the model's expressive power, and maintain positional independence through point-by-point computation. It complements the self-attention mechanism, jointly completing the mapping from low-order features to high-order semantics.
[0068] Step 4: Establish a Sea Clutter Suppression (SCSM) module. Through information enrichment token filtering and dual-stream token update mechanism, sea clutter interference can be suppressed while achieving efficient allocation of computing resources.
[0069] The multi-head dynamic convolutional features obtained in step 3 are used as input to the sea clutter suppression module, and its core architecture is as follows: Figure 4As shown, this module comprises two main components: information-enriched token filtering and a dual-stream token update mechanism, based on a transformer block composed of multi-layered attention mechanisms. In the information-enriched token filtering, 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 filtering information-enriched tokens from invalid tokens; while... Figure 4 The left side employs a dual-stream token update mechanism. Informational tokens undergo full multi-head attention (MSA) and feedforward network (FFN) computation via a slow path to extract features in detail. 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] In detail, the information-enriched token filtering branch employs a hybrid attention scoring strategy and a global attention evolution strategy to ensure filtering 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 denoted as follows: and , fusion score It can be represented as:
[0071]
[0072]
[0073]
[0074] in The query vector represents the CLS token, where the CLS token is a special token used for classification and is used in the CLS-to-tokens branch to generate the global feature information required for classification. Let be the query vector for the i-th image token, N be the total number of image tokens, and λ be the fusion weight hyperparameter. The fusion score is calculated... The top q tokens with the highest scores are selected as information enrichment tokens, while the remaining N-q tokens are determined to be invalid tokens containing sea clutter. This represents the transpose of the convolution kernel size. for function.
[0075] Next, the information enrichment token is updated according to the global attention evolution strategy; the Transformer block exists in multiple stacked layers, each with an independent attention calculation process. Different layers pass attention information through residual connections, and the global attention score of the previous layer participates in the calculation of the next layer, with the scores from different layers being fused. Residual connections are used to facilitate the flow of attentional information, which can be expressed by the formula:
[0076]
[0077] in, Indicates the first The global attention score of the layer, As the first Layered attention score is the fusion coefficient. For each layer containing token filtering, only the global attention score of the selected information-enriched token is updated.
[0078] During the dual-stream token update phase, differentiated processing is implemented for the two types of tokens—for information-rich tokens, a slow path with strong expressive power is used for fine feature extraction, while for invalid tokens, a fast path is used 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, the index set is determined by sorting the global attention scores: ,in Indicates global attention score Index operations in descending order. Then, filtering is performed based on the index: the index is located in the set. The token selected in the middle is an informational token, denoted as the informational token. Where l represents the l-th layer, 1:k l This represents the index range from 1 to k after sorting at level l; the index is located in the set. The tokens in the list are classified as useless tokens and are marked as useless tokens. Then, the useless markers were removed. Aggregate into a representative marker The specific method is as follows:
[0080]
[0081] In the formula, for The i-th useless token in the middle, , Indicates traversal The m-th and n-th useless tokens in the middle; This represents an aggregate function. Subsequently, at each level of the transformer block, the [CLS] tag and informational tags are added. and representative marks The inputs are fed into the multi-head self-attention module (MSA) and the feedforward network module (FFN), and their residuals are recorded. and Used for skip connections, hence the [CLS] tag. Informational markers and representative marks Updates will be performed slowly and meticulously. After the slow update is complete, useless tags will be removed. Will pass The residuals are updated quickly:
[0082]
[0083] in The extension function is indicated by the subscripts (1) and (2), which are used to distinguish the output results of different stages after processing by the MSA and FFN modules, respectively representing the output of the first stage MSA module and the second stage FFN module.
[0084] Step 5: Construct a discriminative hybrid loss function. By imposing constraints on the entire SAR image labeled with CLS and all local information labels, better intra-class compactness and inter-class separability can be achieved.
[0085] A discriminative mixture loss function is used for a given input feature vector. and their corresponding tags The cosine interval loss applied to the CLS label is denoted as For local information tags, each information tag With corresponding tags Cross-entropy (CE) loss is used between them. Given information tags , Specifically, the feature representations of the k informative tokens selected from the i-th sample group can be obtained using the loss formula on information tokens. Combining the two losses yields the final discriminant mixed loss. .
[0086] Specifically, the discriminative hybrid loss of ITS-ShipFormer consists of two parts: the cosine interval loss and the non-cosine interval loss. and loss on information labeling The overall formula is:
[0087]
[0088] In the formula, β is a hyperparameter balancing the two losses, and the cosine interval loss applied on the CLS notation is denoted as... The information labeling loss applied to information labeling is denoted as The formula for calculating the cosine interval loss can be expressed as:
[0089]
[0090] Where 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 the cosine similarity. Hyperparameters representing cosine intervals; Let be the angle between the feature vector and the classification weight vector corresponding to the true class yi of sample i. Let be the feature vector of sample i corresponding to the non-true category j (j≠yᵢ), and the angle between it and the classification weight vector.
[0091] Each information tag With corresponding tags Cross-entropy (CE) loss is used between the information labels. The loss formula for information labeling is:
[0092]
[0093] Step 6: Train the ship recognition model. For example... Figure 2 As shown, a ship identification 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 the trained ship identification model.
[0094] Stochastic Gradient Descent (SGD) is an iterative optimization algorithm whose core mechanism is to approximate the gradient direction of the loss function by randomly selecting a single sample or a mini-batch of samples, and then update the model parameters accordingly. Specifically, in each iteration, a sample (or mini-batch) is randomly sampled from the training set, the loss gradient under the current parameters is calculated, and then the parameters are updated along the negative gradient direction. Compared to traditional batch gradient descent, SGD does not require traversing the entire dataset, significantly reducing memory overhead and computational costs, making it particularly suitable for training large-scale datasets. However, its gradient estimation is noisy due to random sampling, causing oscillations in the parameter update path, which may lead to convergence to a local optimum or a slow approximation of the global optimum. To mitigate 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 retaining efficient computational characteristics, making it one of the most fundamental optimizers in deep learning model training, widely used in online learning, non-convex optimization, and other scenarios.
[0095] Step 7: Test the ship recognition model;
[0096] The image resampling method was used to resize the test set images, resizing each image to 224×224.
[0097] The obtained test set is used to test the ship recognition model obtained in step 6 using the standard classification network testing method, resulting in test results for the ship recognition model on three test sets. 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 ship identification model obtained in step 6 is used as the input, and the accuracy, recall, precision, three-level index and confusion matrix are calculated using the standard evaluation index calculation method.
[0100] Table 1: Evaluation results on the penSARShip dataset
[0101] Predictive Class Real Class Bulk carriers Container ships tanker Recall rate Bulk carriers 256 63 9 78.42 Container ships 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 Accuracy refers to the percentage of correct predictions out of all predicted positive results. Defined as , This represents the number of positive samples that were correctly identified. This represents the number of negative samples that were correctly identified. This represents the number of positive samples that were correctly identified. The number of underreported positive samples is [value], and the number of correctly classified ships is [value]. The total number of all ships is ;
[0103] Recall rate Recall refers to the number of correctly predicted samples out of all positive samples. Defined as ,in, This represents the number of positive samples that were correctly identified. This represents the number of positive samples that were missed.
[0104] Accuracy Precision refers to the number of correctly predicted samples out of all predicted positive samples. Defined as ,in, This represents the number of positive samples that were correctly identified. This represents the number of positive samples that were correctly identified.
[0105] Level 3 indicators It also takes into account the accuracy of the recognition model. and recall rate Level 3 indicators Defined as ,in Indicates recall rate, Indicate precision;
[0106] The confusion matrix is the most basic, intuitive, and simplest method for measuring the accuracy of a recognition model. The confusion matrix is created by counting the number of observations misclassified and correctly classified by the recognition model, and then displaying the results in a table.
[0107] As shown in Table 2, the accuracy achieved by this invention on the FUSAR-Ship dataset is 90.84%, and the accuracy on the three classes of the Open-SARShip dataset is 84.09%. These experimental results demonstrate that this invention achieves the highest detection accuracy among several existing technologies, indicating that it can achieve high-precision ship target identification in SAR images.
[0108] Table 2: Evaluation results on the FUSAR-Ship dataset
[0109] Predictive Class Real Class Bulk carriers Container ships fishing boat ordinary boat Other ships Other cargo ships tanker Recall rate Bulk carriers 475 2 4 5 0 5 3 96.15 Container ships 0 521 1 0 0 0 1 99.62 fishing boat 3 0 378 0 36 54 2 79.92 ordinary boat 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 Accuracy rate: 90.84% Level 3 indicators 97.14 99.05 83.35 98.94 82.73 79.48 95.08 90.84%
[0110] It is understood that the present invention has been described through some embodiments, and those skilled in the art will recognize that various changes or equivalent substitutions can be made to these features and embodiments without departing from the spirit and scope of the invention. Furthermore, under the teachings of the present invention, these features and embodiments can be modified to adapt to specific situations and materials without departing from the spirit and scope of the 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 within the protection scope of the present invention.
Claims
1. A method for ship identification in SAR images based on an information token selection network, characterized in that, Includes the following steps: Step 1: Prepare and preprocess the ship and marine 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 a transformer block. Invalid feature suppression and computational resource allocation are achieved through information enrichment token filtering and a dual-stream token update mechanism. The transformer block consists of a multi-layered stacked multi-head attention and feedforward network. In the information enrichment token filtering, a hybrid attention scoring strategy and a global attention evolution strategy are used to calculate and optimize the importance score of each token, filtering information enrichment tokens from invalid tokens. In the dual-stream token update mechanism, the information enrichment tokens are updated through a multi-layered stacked multi-head attention and feedforward network, with each layer updating the importance score of the information enrichment tokens. Invalid tokens are aggregated and then input into the multi-layered stacked multi-head attention and feedforward network for residual update. Step 4: Based on a set number of multi-head dynamic local convolutional modules and a set number of sea clutter suppression modules, establish a ship identification model, input the training set into the model, use the loss function to train the model parameters, and obtain the trained ship identification model; after testing and evaluating the trained ship identification model, use it in SAR image ship identification tasks. The specific process of the multi-head dynamic local convolution module is as follows: First, the input image is segmented into non-overlapping patches. After dynamic position embedding, the non-overlapping patches are regressively connected 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, pixel-level dynamic convolution kernels are obtained, where Let H represent the set of real numbers, W, and C be the width, height, and number of channels of the feature map, respectively, K be the size of the convolution kernel, and G be the number of groups in the group convolution; then, the pixel-level dynamic convolution kernel is applied to the feature map. The residual connection, after dynamic convolution operation, is connected with the embedded feature residual to obtain the output feature. Finally, after layer normalization and feedforward network, the final multi-head dynamic convolution feature is obtained.
2. The SAR image ship identification method based on an information token selection network according to claim 1, characterized in that, The multi-head dynamic convolution kernels include 1×1 convolution, 5×5 depthwise separable convolution, 1×1 convolution, and tensor reshaping.
3. The SAR image ship identification method based on an information token selection network according to claim 2, characterized in that, The information enrichment token filtering employs a hybrid attention scoring strategy and a global attention evolution strategy. The hybrid attention scoring strategy includes two branches: CLS-to-tokens and tokens-to-tokens, and the resulting attention scores are denoted as follows: and , fusion score Represented as: ; ; ; in The query vector representing the CLS token; Let be the query vector for the i-th image token, N be the total number of image tokens, and λ be the hybrid weight hyperparameter. Select fusion score The top q tokens are used as information enrichment tokens, while the remaining Nq tokens are determined to be invalid tokens; This represents the transpose of the convolution kernel size. for function; Next, the information enrichment token is updated according to the global attention evolution strategy: ; in, Indicates the first The global attention score of the layer, As the first Layered attention score This is the fusion coefficient.
4. The SAR image ship identification method based on an information token selection network according to claim 3, characterized in that, The specific steps of the dual-stream token update mechanism are as follows: First, the index set is determined by sorting the global attention scores: ,in Indicates global attention score Index operations for descending order; placing the index in the set The token selected in the middle is an informational token, denoted as the informational token. ,1:k l This represents the index range from 1 to k after sorting at level l; the index is located in the set. The tokens in the list are classified as useless tokens and are marked as useless tokens. ; Then use useless tags Aggregate into a representative tag The specific method is as follows: ; In the formula, for The i-th useless token in the middle, , express The m-th and n-th useless tokens in the middle; This represents an aggregate function; subsequently, at each level of the transformer block, the [CLS] tag and informational tag are added. and representative marks The input is fed into the multi-head self-attention module (MSA) and the feedforward network module (FFN), and informational tags are recorded. and representative marks The residual is and For use in skip connections; useless markers Will pass The residuals are updated quickly: ; in The extension function is indicated by the subscripts (1) and (2), which are used to distinguish the output results of different stages after processing by the MSA and FFN modules.
5. The SAR image ship identification method based on an information token selection network according to claim 4, characterized in that, The loss function includes cosine margin loss and cross-entropy loss, as detailed below: ; in, To determine the mixed loss function, β is a hyperparameter balancing the two losses. Represents a given input feature vector and their corresponding tags Cosine interval loss applied to the CLS marker, Represents each information tag With corresponding tags Cross-entropy loss between information tags Specifically, this includes the feature representations of the k informative tokens selected from the i-th sample group.
6. The SAR image ship identification method based on an information token selection network according to claim 5, characterized in that, The preprocessing specifically involves using an image resampling method to change the image size, 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