Small sample SAR image classification method based on attention enhancement and robust prototype calculation
By introducing attention enhancement and robust prototype computation in small-sample SAR image classification, the problems of insufficient feature extraction and poor robustness of prototype representation in SAR image classification under different SNR noise environments are solved, achieving efficient feature discrimination and stable classification, which is suitable for low-resource platforms such as embedded radar terminals.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 58TH RES INST OF CETC
- Filing Date
- 2026-04-22
- Publication Date
- 2026-07-24
AI Technical Summary
Existing small-sample SAR image classification methods suffer from insufficient feature extraction, poor robustness of prototype representation, low classification accuracy, and insufficient stability under different SNR noise environments, making it difficult to adapt to noise interference and insufficient feature discriminativeness in SAR images.
We adopt a few-sample SAR image classification method based on attention enhancement and robust prototype computation. By constructing a ResNet feature extraction network and integrating a dual attention mechanism, we perform feature extraction. We generate robust class prototypes through 3σ outlier removal, intra-class variance normalization, and L2 norm normalization. Combined with similarity calculation and training strategies adapted to different SNR noise environments, we improve the model's noise resistance and generalization performance.
It significantly improves the feature discrimination and noise resistance of SAR image classification, enhances the robustness of prototype representation, and improves the stability, classification accuracy, adaptability, and training stability of the model under different noise environments. It is suitable for low-resource platforms such as embedded radar terminals.
Smart Images

Figure CN122454256A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image data processing technology, and specifically relates to a small-sample SAR image classification method based on attention enhancement and robust prototype computation. Background Technology
[0002] In recent years, synthetic aperture radar (SAR) has been widely used in military reconnaissance and civilian remote sensing due to its all-weather, all-day imaging capabilities and strong penetration. Few-shot learning, as a key technology to solve the problem of scarce SAR target annotation data, has become an important research direction in SAR image classification. Among them, ProtoNet has become one of the mainstream methods due to its simple structure and adaptability to small-sample scenarios.
[0003] However, in practical applications, SAR images are susceptible to electromagnetic interference and propagation attenuation, often facing problems such as noise pollution and fluctuations in noise intensity. Specifically, classification accuracy decreases significantly under different noise intensities, and data samples are scarce under small sample conditions, leading to the following core shortcomings of existing methods: (1) Insufficient effectiveness of feature extraction: Traditional ProtoNet uses basic CNN feature extractors (such as simple convolution stacking), does not design enhancement mechanisms for the unique phase and texture features of SAR images, and lacks attention guidance, making it difficult to distinguish target features from noise interference. In different SNR noise environments, the feature discrimination is extremely poor, and the classification accuracy is difficult to guarantee.
[0004] (2) Poor robustness of prototype calculation: Traditional methods directly calculate the class prototype by taking the mean of the support set features, without considering the interference of feature outliers caused by noise, and without normalizing the intra-class variance, which easily causes the class prototype to deviate from the true class center. The model is sensitive to noise of different intensities and has poor classification stability.
[0005] (3) Insufficient SAR adaptability: Existing data augmentation (such as random flipping and rotation) is not designed for the characteristics of SAR image phase sensitivity and speckle noise, and cannot simulate phase shift and scale change in real different SNR noise environments, resulting in weak model generalization ability; at the same time, the temperature coefficient adopts a fixed value or simple linear decay, which cannot adapt to the differences in feature distribution under different noise intensities.
[0006] (4) Insufficient training stability: In small sample episode training, existing methods lack strategies such as gradient accumulation and reasonable learning rate scheduling, which easily lead to gradient explosion / vanishing. Furthermore, the loss function is not optimized for different SNR noise environments, making it difficult for the model to converge in different SNR scenarios. Even in scenarios with weak noise interference, the classification accuracy exhibits saturation.
[0007] Currently, there is no integrated solution that balances the effectiveness of feature extraction, prototype robustness, and training stability to address the performance bottleneck of SAR classification under the dual constraints of "small sample size + different SNR noise". There is an urgent need to propose a small sample SAR radar image classification method based on channel-spatial attention and robust prototype computation. By co-optimizing feature enhancement, prototype computation, and training strategies, the noise resistance and generalization performance of small sample SAR classification can be improved. Summary of the Invention
[0008] The purpose of this invention is to provide a small-sample SAR image classification method based on attention enhancement and robust prototype computation. This invention addresses the problems of insufficient feature extraction, poor robustness of prototype representation, low classification accuracy, and insufficient stability in existing small-sample SAR image classification methods under different SNR noise environments. It achieves robust classification across noise intensities and significantly improves the performance of SAR radar image classification in small-sample scenarios.
[0009] To address the aforementioned technical problems, this invention provides a small-sample SAR image classification method based on attention enhancement and robust prototyping, comprising: By acquiring the dataset and configuring the parameters, we can ensure the learning effectiveness of the model under the constraint of small sample size. By preprocessing and enhancing SAR images, high-quality input can be provided for subsequent feature extraction. By constructing a ResNet feature extraction network and integrating a dual attention mechanism, the accurate extraction of highly discriminative features under different SNR noise environments can be achieved. The ResNet feature extraction network consists of an initial feature extraction layer, four attention-enhanced residual block layers, a global pooling layer, and a feature projection layer. Through the collaboration of each layer, progressive learning from low-level edge features to high-level semantic features can be achieved. By using a collaborative operation based on episode support set features, 3σ outlier removal, intra-class variance normalization and L2 norm normalization, a robust class prototype generation mechanism under different noise interference intensities is constructed to ensure the stability and discriminativeness of the prototype representation, thereby solving the problems of easy shift and poor stability of class prototypes under different SNR noise environments. By designing similarity calculation mechanisms and training strategies adapted to different SNR noise environments, efficient model convergence and accurate classification can be achieved, thereby solving the problems of low similarity calculation discrimination and unstable training under different SNR noise environments. By constructing a multi-scenario noise verification system, we can comprehensively evaluate the robustness and classification performance of the model in complex noise environments.
[0010] Preferably, the data acquisition and parameter configuration operations include: Dataset definition: The training dataset is obtained by acquiring a small sample of SAR images. With the test dataset ,in The number of training samples. For the number of test samples, The sample size is 88×88, and the sample category label is... , The preset total number of categories is used to adapt to typical target classification scenarios in SAR radar images; The few-sample parameter configuration adopts a few-sample training paradigm with N-WAY=5 classes, K-SHOT=5 support sets for each class, and Q-QUERY=15 query sets for each class, in order to construct an episode training unit containing support sets and query sets.
[0011] Preferably, the preprocessing and enhancement operations on the SAR image include: Adaptive normalization operation to calculate the 1% quantile of SAR images. and 99th percentile This crops the image pixel values to the [0,1] range. A simulated noise injection mechanism is introduced to control the noise intensity through a precise ratio of signal power to noise power, in order to adapt to different SNR noise environments. Specifically, this is achieved by calculating the signal power... With noise power , generate obey Gaussian noise is added and superimposed on the normalized image, and finally cropped to the range of [-5.0, 5.0] to ensure that the noise injection does not destroy the recognizability of the core features of the image; Preferably, the initial feature extraction layer includes: firstly, performing a convolution operation using a 3×3 kernel, setting the number of output channels to 64, and specifying the stride and padding values. The value is 1 and no bias term is introduced; then the batch normalization layer BatchNorm2d and the ReLU activation function are sequentially connected; finally, the max pooling operation is performed, and the feature map is downsampled through a 2×2 max pooling layer with a stride of 2. A SAR-specific data augmentation strategy is introduced, which involves performing augmentation operations on the training dataset, including random phase shift, random flip transformation, small-angle rotation enhancement, and adaptive adjustment of grayscale characteristics, to improve the model's generalization ability and geometric deformation adaptability against noise of different intensities.
[0012] The attention-enhanced residual block layer includes a residual block body, an enhanced channel attention module, and a spatial attention module connected in sequence. Each residual block body consists of two 3×3 standard convolutional layers, with the number of channels increasing sequentially according to the layer. By embedding the enhanced channel attention module and the spatial attention module, a dual attention enhancement mechanism is formed. At the same time, the effective propagation of gradients is ensured through shortcut connections, and the Dropout2d layer is embedded to suppress overfitting. The feature projection layer comprises: firstly, compressing the multidimensional feature map into a 1×1×1024 one-dimensional feature vector through global adaptive average pooling; then performing feature mapping through two fully connected layers; and finally, after each layer, connecting a batch normalization layer (BatchNorm1d), a ReLU activation function, and a Dropout layer to obtain the projected feature vector. Finally, the projected feature vector Perform L2 norm normalization; the normalization formula is: in Using the L2 norm, the discriminative eigenvectors are obtained after normalization. The feature set of the training dataset is denoted as The feature set of the test dataset is denoted as .
[0013] Preferably, the channel attention calculation process of the channel attention module includes: Output characteristics of the residual block First, perform global average pooling. and global max pooling : in For the number of channels, Indicates feature map in channel c ,Location( i,j The eigenvalue at position ) For the feature map size, the pooling results are independently fed into a shared fully connected layer with shared parameters for feature transformation. The shared fully connected layer adopts a compression-recovery structure. The feature transformation process performed by the shared fully connected layer includes: The C channel features are compressed to C / r channels by compression ratio r through the first linear layer, in order to improve generalization ability in conjunction with the ReLU activation function and the Dropout layer; The features are restored to the original C channel through a second linear layer to ensure dimension matching; By fusing the outputs of the two pooled features after passing through the shared fully connected layer element-wise, and finally generating channel attention weights through Sigmoid activation: in For the Sigmoid function, fc (·) represents a compressed-recovery fully connected layer with shared parameters; features enhanced by channel attention. for: in This indicates multiplication by channel.
[0014] Preferably, the spatial attention calculation process of the spatial attention module includes: The channel attention-enhanced features Perform average pooling along the channel dimension and max pooling ; After concatenation, spatial weights are generated through 3×3 convolution and sigmoid activation: Final Dual Attention Enhancement Features for: .
[0015] Preferably, the robust class prototype generation mechanism includes: The episode construction process involves randomly selecting N-WAY class samples from the training dataset, extracting K-SHOT samples from each class to form a support set and Q-QUERY samples to form a query set, thus forming a complete episode training unit; the feature matrix of the support set is denoted as... The category labels of the support set are denoted as ; Outlier removal involves calculating the mean and standard deviation of each support set feature to specifically remove outliers caused by noise interference under different SNR noise environments. in For the first cls Number of feature samples in the class support set For the first i In-class support set features, and The first cls The mean and standard deviation vectors of the class support set features are obtained, and the 3σ principle is applied: Used to filter effective feature samples, eliminate abnormal features caused by noise interference, ensure the consistency of intra-class features, and provide highly discriminative feature inputs for robust prototype generation; Robust class prototype generation uses the mean of the effective features within a class after outlier removal as the initial prototype to reduce the interference of outliers on the prototype under different SNR noise environments. in This represents the number of valid feature samples for each class after removing outliers. For the first i Effective features within each class; enhanced prototype discriminativeness through intra-class variance normalization to offset the impact of differences in intra-class feature dispersion under different SNR noise environments: in The mean variance of the effective features within a class is calculated by first calculating the variance of each effective feature within a class relative to the initial prototype. The variance of the prototype vectors is calculated, and then the mean of all variances is taken to offset the impact of intra-class feature dispersion on the classification effect, ensuring that the prototypes maintain stable discriminative ability under different SNR noise environments. Finally, L2 norm normalization is performed on the prototype vectors to generate the class prototype matrix. The normalization formula is: The normalized prototype further improves the prototype stability under different SNR noise environments, ensures the distinguishability between prototypes, and lays the foundation for subsequent similarity classification.
[0016] Preferably, the similarity calculation mechanism and training strategy adapted to different SNR noise environments include: The adaptive temperature coefficient calculation dynamically adjusts the temperature coefficient using a cubic attenuation strategy to adapt to the changing feature distribution patterns under different SNR noise environments during training. The initial temperature 0.3~0.5, final temperature 0.03~0.07, For the current training round, the total number of training rounds is [number missing]. By gradually attenuating the temperature coefficient, the classification confidence and gradient magnitude are dynamically adjusted to keep the model stable in noisy environments and improve the discrimination accuracy in high signal-to-noise ratio environments. Similarity calculation and classification prediction, using query set features Expand to Dimensions, class prototype matrix Expand to Dimension, using the cosine similarity formula to calculate the similarity measure between two objects: in For a single query set feature, For a single class prototype; divide the similarity result by the temperature coefficient. Obtain the final similarity matrix ,Right now: Converted to a class probability distribution using the Softmax function: The category corresponding to the highest probability is selected as the predicted label for the query set sample: ; Training strategy optimization includes: The loss function is configured using cross-entropy loss, with a label smoothing coefficient of 0.05. To alleviate the overfitting problem in small-sample training under different SNR noise environments, the loss function formula is as follows: in This represents the total number of query set samples in a single episode. For indicator functions, To query the true labels of the sample set, To query the features of the sample set, Indicates the label smoothing coefficient; Accuracy calculation: During training and validation, classification accuracy is calculated as the ratio of the number of correctly predicted samples to the total number of samples. The formula for classification accuracy is: Where M is the total number of test samples in the current noisy scenario. For the first m Predicted labels for each query set sample. The true label is used, and the accuracy value ranges from [0,1]. The closer the value is to 1, the better the classification performance. For the optimizer selection, the AdamW optimizer was used, with an initial learning rate of 0.0003, a weight decay coefficient of 5e-5, betas parameters of (0.9, 0.999), and eps parameters of 1e-8. Learning rate scheduling is performed using the CosineAnnealingWarmRestarts learning rate scheduler, with T0=15 and T... mult =2、eta min =5e-7, where T0 is the initial annealing cycle length, T mult eta is the periodic multiplication factor. min To minimize the learning rate decay, the learning rate update formula is: in The initial learning rate, For the rounds within the current cycle, This represents the total length of the current cycle. The gradient optimization mechanism employs an 8-step gradient accumulation strategy to reduce the impact of gradient fluctuations on convergence during small-sample training under varying SNR noise environments; simultaneously, gradient clipping is implemented, with the gradient clipping formula as follows: in For the original gradient, It is the gradient after clipping. This is the maximum norm of the gradient, to prevent gradient explosion.
[0017] Preferably, the construction of the multi-scenario noise verification system includes: Signal-to-noise ratio definition: Noise power calculation: Noise standard deviation calculation: Numerical stability handling: Set an upper limit for the noise standard deviation: in Signal-to-noise ratio is expressed in decibels. This represents the SAR image signal power, which is the mean of the squared pixel values in the image. The power of injected Gaussian noise, The standard deviation of Gaussian noise. This is the preprocessed SAR image.
[0018] This invention also provides a few-sample SAR image classification system based on attention enhancement and robust prototyping, which performs a few-sample SAR image classification method based on attention enhancement and robust prototyping as described above, including: The SAR image preprocessing and enhancement module provides a noise-resistant foundation for feature extraction through adaptive normalization and noise injection. The ResNet feature extraction module, which integrates channel and spatial attention, filters key feature channels through channel attention and focuses on target regions through spatial attention, thereby enhancing the discriminative power and noise resistance of SAR image features. The robust prototype calculation module eliminates feature outliers by introducing the 3σ principle, normalizes intra-class variance, and normalizes L2 norm, thereby suppressing the interference of noisy samples on the class prototype and generating stable class centers. The training and classification modules adapt to different SNR noise environments. They optimize similarity calculation through a temperature attenuation strategy to adapt to the noise environment, thus jointly solving the dual constraints of small sample size and different SNR noise.
[0019] Compared with the prior art, the present invention has the following beneficial effects: 1. Significantly improved feature discrimination and noise resistance: The channel-space dual attention module specifically captures key features of SAR image channels and spatial target regions, effectively suppressing noise and redundant information interference, and solving the problem that traditional methods have difficulty distinguishing targets from noise.
[0020] 2. Robust prototype representation: The synergistic effect of 3σ outlier removal, intra-class variance normalization and L2 norm normalization effectively avoids prototype shift caused by noise, reduces the interference of outlier samples on the prototype class, improves the stability and reliability of the prototype class, and enhances the model's tolerance to noise.
[0021] 3. Excellent adaptability to noise environments: The SAR-specific data augmentation and cubic temperature attenuation strategy work together to adapt to noise environments of different intensities, significantly improving the model's generalization ability and solving the problem of poor adaptability of traditional methods.
[0022] 4. High training stability and convergence efficiency: The integrated strategy of gradient accumulation, cosine annealing scheduling, gradient clipping and label smoothing effectively solves the problems of gradient oscillation and slow convergence in small sample training, and achieves efficient convergence.
[0023] 5. Low computational complexity and high deployability: The additional overhead of attention module and robust prototype computation is controllable, balancing accuracy and inference efficiency. It can be deployed on low-resource platforms such as embedded radar terminals, expanding application scenarios. Attached Figure Description
[0024] Figure 1 This is an overall framework diagram of a small-sample SAR image classification system based on attention enhancement and robust prototype computation, provided in an embodiment of the present invention.
[0025] Figure 2A flowchart of a small-sample SAR image classification method based on attention enhancement and robust prototype computation provided in an embodiment of the present invention. Detailed Implementation
[0026] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. The advantages and features of the present invention will become clearer from the following description. It should be noted that the drawings are all in a very simplified form and use non-precise proportions, and are only used to facilitate and clarify the illustration of the embodiments of the present invention.
[0027] like Figure 1 As shown, this embodiment of the invention specifically provides a small-sample SAR image classification system based on channel-spatial attention and robust prototyping computation. The overall framework consists of five core modules: a SAR image preprocessing and enhancement module, a ResNet feature extraction module incorporating channel-spatial attention, a robust prototyping computation module, and a training and classification module adapted to different SNR noise environments. The preprocessing module provides a noise-resistant foundation for feature extraction through adaptive normalization and noise injection. The attention mechanism fused in ResNet focuses on target features to improve discriminativity. Robust prototyping computation generates stable class centers based on the purified features, and a temperature decay strategy optimizes similarity calculation to adapt to noisy environments, jointly solving the dual constraints of small sample size and different SNR noise levels.
[0028] like Figure 2 As shown in the figure, the present invention specifically provides a small-sample SAR radar image classification method based on channel-spatial attention and robust prototype computation, which includes the following steps: Step 1: Dataset acquisition and parameter configuration; Dataset definition: Obtain a small sample SAR image training dataset With the test dataset ,in The number of training samples. For the number of test samples, The preferred resolution is 88×88 (which can be adjusted to 64×64~128×128 according to the actual SAR imaging resolution without affecting the core mechanism of this invention), sample category label. , The preset total number of categories is used to adapt to typical target classification scenarios in SAR radar images.
[0029] (2) Small sample parameter configuration: The small sample training paradigm of N-WAY=5 (number of categories in each training episode), K-SHOT=5 (number of support sets corresponding to each class of samples) and Q-QUERY=15 (number of query sets corresponding to each class of samples) is adopted. By constructing episode training units of "support set + query set", the application conditions of scarce SAR image annotation samples in real scene are simulated to ensure the learning effectiveness of the model under small sample constraints.
[0030] Step 2: SAR image preprocessing and enhancement; Addressing the inherent characteristics of SAR images, such as phase sensitivity and speckle noise, and considering the adaptation requirements for different SNR noise environments, data preprocessing and enhancement operations are performed to provide high-quality input for subsequent feature extraction. (1) Adaptive normalization processing: Calculate the 1% quantile of the SAR image and 99th percentile The normalization transformation is performed using the following formula: (1) Pixel values are cropped to the [0,1] range. This operation aims to preserve the core texture and phase features of the image while suppressing interference from extreme noise values and avoiding the loss of details caused by global normalization.
[0031] (2) Simulated noise injection mechanism: Electromagnetic interference and propagation attenuation during real SAR imaging are simulated to generate Gaussian noise adapted to image characteristics. The noise intensity is controlled by a precise ratio of signal power to noise power to adapt to different SNR noise environments. This is specifically achieved by calculating the signal power and noise power. (2) (3) Formula 2 is used to avoid numerical overflow, where The mean of the squared pixel values in Formula 3 is represented by the average of the squared pixel values in the image. This represents the power ratio of the signal to the noise. It is generated using Equation 2-3, which follows... Gaussian noise is added and superimposed on the normalized image, and finally cropped to the range of [-5.0, 5.0] to ensure that the noise injection does not destroy the recognizability of the core features of the image.
[0032] (3) SAR-specific data augmentation strategy: Perform the following augmentation operations only on the training set to improve the model's generalization ability and geometric deformation adaptation ability against noise of different intensities: 1) Random phase shift: Randomly shift the image along the X-axis or Y-axis. The shift amount is preferably ±2 pixels to adapt to the phase sensitivity characteristics of SAR images and simulate the phase fluctuation during the imaging process under different SNR noise environments. 2) Random flip transformation: Perform horizontal or vertical flip operation on the image with a probability of 0.3 to reduce the model's over-reliance on the target orientation and enhance its adaptability to changes in target pose. 3) Small-angle rotation enhancement: The image is rotated at a small angle, preferably ±3 degrees. The rotation boundary is processed using a reflection fill mode, which effectively eliminates edge artifacts and improves the robustness of the model to small changes in the target pose. 4) Adaptive adjustment of grayscale characteristics: Fine-tuning and optimization of image contrast and brightness, wherein the contrast adjustment coefficient is preferably 0.95 to 1.05, and the brightness offset is preferably -0.02 to 0.02. By limiting the fine-tuning range, the image feature recognition is enhanced while avoiding damage to the inherent texture and phase information of the SAR image, and preventing feature distortion caused by over-adjustment.
[0033] Step 3: ResNet feature extraction with fused channel-spatial attention; A ResNet feature extraction network is constructed and a dual attention mechanism is integrated to achieve accurate extraction of highly discriminative features under different SNR noise environments: (1) Overall network architecture configuration: The number of input channels is set to 1 (to adapt to SAR grayscale image input), and the final output feature dimension is preferably 512 dimensions (which can be adjusted to 256 dimensions or 1024 dimensions according to device storage / computation constraints). The main body of the network consists of an initial feature extraction layer, four attention-enhanced residual block layers, a global pooling layer, and a feature projection layer. Each layer works together to achieve progressive learning from low-level edge features to high-level semantic features.
[0034] (2) Initial Feature Extraction Layer: This layer first performs convolution operations using a 3×3 kernel, with 64 output channels, padding of 1, and no bias term introduced. Then, a batch normalization (BatchNorm2d) layer and a ReLU activation function are sequentially applied. Finally, a 2×2 max pooling layer with a stride of 2 is used to downsample the feature map. The convolution operation formula is: (4) in For the input image, The kernel is 3×3; the maximum pooling operation formula is: (5) (3) Attention-enhanced residual block design: Each residual block consists of two 3×3 standard convolutional layers, with the number of channels increasing sequentially according to the layer level, preferably 64, 128, 256, 512 and 1024 (which can be adjusted to similar layer configurations according to feature extraction requirements). Between the convolutional layers, an enhanced channel attention module and a spatial attention module are embedded to form a dual attention enhancement mechanism. At the same time, a shortcut connection is used to ensure effective gradient propagation, and a Dropout2d layer (dropout rate 0.05) is embedded to suppress overfitting.
[0035] ① Channel attention calculation: Output features of residual blocks First, perform global average pooling ( ) and global max pooling ( ): (6) (7) in For the number of channels, Indicates feature map in channel c ,Location( i,j The eigenvalue at position ) To determine the feature map size, the pooling results are independently fed into a fully connected layer with shared parameters for feature transformation. The shared fully connected layer employs a compression-restore structure: first, the first linear layer compresses the C-channel features to C / r channels at a compression ratio r, using ReLU activation and a Dropout layer to improve generalization; then, the second linear layer restores the features to the original C channels, ensuring dimensionality matching. The outputs of the two pooled features after passing through the shared fully connected layer are element-wise added and fused, finally generating channel attention weights via Sigmoid activation. (8) in For the Sigmoid function, fc (·) represents a compressed-recovery fully connected layer with shared parameters; the features after attention enhancement are: (9) in This indicates multiplication by channel.
[0036] ② Spatial attention calculation: Features after channel enhancement Perform average pooling along the channel dimension ( ) and max pooling ( ) (10) (11) After concatenation, spatial weights are generated through 3×3 convolution and sigmoid activation: (12) The final dual-attention enhancement feature is: (13) (4) Feature projection and normalization: The multidimensional feature map is compressed into a 1×1×1024 one-dimensional feature vector through global adaptive average pooling. Then, it is mapped through two fully connected layers (dimensions are 1024→2048→512 respectively). Each layer is followed by a batch normalization layer, a ReLU activation function and a dropout layer (dropout rate 0.05) to obtain the feature projection result. Finally, this projection feature vector Performing L2 norm normalization eliminates feature scale differences and enhances feature robustness. The normalization formula is as follows: (14) in It is the L2 norm. After normalization, the discriminative eigenvectors are obtained. The feature set of the training set is denoted as... The feature set of the test set is denoted as .
[0037] Step 4: Robust prototype calculation; Based on the features of the episode support set, a robust class prototype generation mechanism is constructed under noise interference of different intensities to ensure the stability and discriminativeness of the prototype representation, and to solve the problems of easy shift and poor stability of class prototypes under different SNR noise environments. (1) Episode Construction Process: Randomly select N-WAY class samples from the training set, extract K-SHOT samples from each class to form the support set, and Q-QUERY samples to form the query set, thus forming a complete training episode unit. The feature matrix of the support set is denoted as... Support set category labels are denoted as This ensures that the support set can fully cover the core features of each category, while also covering samples under different SNR noise environments, thereby improving the prototype's adaptability to different noise intensities.
[0038] (2) Feature outlier removal: For each type of support set feature, calculate the feature mean and standard deviation, and selectively remove feature outliers caused by noise interference under different SNR noise environments: (15) (16) in The number of feature samples in each support set. For the first i Each class has its own support set features. The 3σ principle is also applied. (17) Used to filter effective feature samples, eliminate abnormal features caused by noise interference, ensure the consistency of intra-class features, and provide highly discriminative feature inputs for robust prototype generation.
[0039] (3) Robust class prototype generation: For the effective features within the class after removing outliers, the mean is calculated as the initial prototype to reduce the interference of outliers on the prototype under different SNR noise environments. (18) in This represents the number of valid feature samples for each class after removing outliers. For the first i Effective features within each class; enhanced prototype discriminativeness through intra-class variance normalization to offset the impact of differences in intra-class feature dispersion under different SNR noise environments: (19) in The mean variance of the effective features within a class is calculated first, i.e., the variance of each effective feature within a class relative to the initial prototype is calculated. The variance of the prototype vectors is calculated, and then the mean of all variances is taken to offset the impact of intra-class feature dispersion on the classification effect, ensuring that the prototypes maintain stable discriminative ability under different SNR noise environments. Finally, L2 norm normalization is performed on the prototype vectors to generate the class prototype matrix. The normalization formula is: (20) Normalized prototypes can further improve prototype stability under different SNR noise environments, ensure the distinguishability between prototypes, and lay the foundation for subsequent similarity classification.
[0040] Step 5: Similarity classification and training optimization of temperature decay; We designed similarity calculation mechanisms and training strategies to adapt to different SNR noise environments, achieving efficient model convergence and accurate classification, and solving the problems of low discrimination and unstable training in similarity calculation under different SNR noise environments. (1) Adaptive temperature coefficient calculation: The temperature coefficient is dynamically adjusted using a cubic attenuation strategy to adapt to the feature distribution changes under different SNR noise environments during training, i.e.: (twenty one) The initial temperature (Adjustable within the range of 0.3~0.5), final temperature (Can be adjusted within the range of 0.03~0.07) For the current training round, the total number of training rounds is [number missing]. (This can be adjusted according to the size of the dataset). By gradually decaying the temperature coefficient, the classification confidence and gradient magnitude are dynamically adjusted to keep the model stable in noisy environments and improve the discrimination accuracy in high signal-to-noise ratio environments.
[0041] (2) Similarity calculation and classification prediction: Query set features Expand to Dimensions, class prototype matrix Expand to Dimension, using the cosine similarity formula to calculate the similarity measure between two objects: (twenty two) in For a single query set feature, For a single class prototype; divide the similarity result by the temperature coefficient. Obtain the final similarity matrix ,Right now: (twenty three) Converted to a class probability distribution using the Softmax function: (twenty four) The category corresponding to the highest probability is selected as the predicted label for the query set sample: (25) (3) Training strategy optimization: In order to adapt to the training requirements under different SNR noise environments and improve the model convergence stability, the following optimization strategies are adopted: 1) Loss function configuration: The cross-entropy loss function is adopted, and a label smoothing coefficient of 0.05 is introduced. To alleviate the overfitting problem in small-sample training under different SNR noise environments, the loss function formula is as follows: (26) in This represents the total number of query set samples in a single episode. For indicator functions, To query the true labels of the sample set, To query the features of the sample set, This represents the label smoothing coefficient.
[0042] Accuracy Calculation: During training and validation, classification accuracy is calculated as the ratio of correctly predicted samples to the total number of samples. The formula is: (27) Where M is the total number of test samples in the current noisy scenario. For the first m Predicted labels for each query set sample. The true label is used, and the accuracy value ranges from [0,1]. The closer the value is to 1, the better the classification performance.
[0043] Optimizer selection: The AdamW optimizer was used, with an initial learning rate of 0.0003, a weight decay coefficient of 5e-5, betas parameters of (0.9, 0.999), and eps parameters of 1e-8. Learning rate scheduling: The CosineAnnealingWarmRestarts learning rate scheduler is used, with T0=15 and T... mult =2、eta min =5e-7, where T0 is the initial annealing cycle length (15 training rounds), T mult eta is the periodic multiplication factor (the length of the next cycle doubles after each cycle is completed). min To minimize the learning rate decay (not less than 5e-7), the learning rate update formula is: (28) in The initial learning rate, For the rounds within the current cycle, This represents the total length of the current cycle.
[0044] Gradient optimization mechanism: An 8-step gradient accumulation strategy is adopted to reduce the impact of gradient fluctuations on convergence during small-sample training under different SNR noise environments; simultaneously, gradient clipping (maximum norm 0.5) is implemented, and the gradient clipping formula is as follows: (29) in For the original gradient, It is the gradient after clipping. This is the maximum norm of the gradient, to prevent gradient explosion.
[0045] Step 6: Noise environment verification.
[0046] Construct a multi-scenario noise verification system to comprehensively evaluate the robustness and classification performance of the model in complex noise environments: (1) Validation environment setup: Build an SNR noise validation scenario ranging from -35dB to 35dB to cover the noise interference that may be encountered in real SAR imaging.
[0047] (2) Noise power ratio calculation: By adjusting the noise power, the noise interference conditions in real applications are simulated. The specific calculation formula is derived based on the definition of signal-to-noise ratio (SNR). The core formula is as follows: ①Signal-to-noise ratio (dB): (30) ② Noise power calculation: This can be derived from formula 30: (31) ③ Calculation of noise standard deviation: The standard deviation of Gaussian noise satisfies the following formula with respect to noise power: (32) ④ Numerical stability processing: To avoid numerical explosion caused by extreme negative SNR (≤-30dB), a minimum value is set for the signal power: (33) Set an upper limit for the noise standard deviation: (34) in This represents the SAR image signal power (i.e., the mean of the squared pixel values of the image). The power of injected Gaussian noise, The standard deviation of Gaussian noise, This is the preprocessed SAR image.
[0048] (5) Performance evaluation index: The classification accuracy is used as the core evaluation index. The classification accuracy under each SNR scenario is calculated as shown in Formula 27.
[0049] As a further explanation of the embodiments of the present invention, in addition to the above-described embodiments, some technical details in the technical solution of the present invention can be replaced by the following alternative solutions: Attention module: Channel attention can be replaced with SE attention (low overhead) or CA attention (strong location correlation); spatial attention can be replaced with CBAM attention (enhanced overall feature extraction).
[0050] Prototype calculation: The 3σ principle for outlier removal can be replaced by median filtering (high real-time performance) or the isolated forest algorithm (strong nonlinear anomaly identification); the prototype mean can be replaced by class weights or sample confidence weighted mean.
[0051] Temperature and training strategies: Temperature decay can be replaced with cosine annealing, linear or adaptive decay; optimizer can be replaced with SGD or RAdam; learning rate scheduling can be replaced with ReduceLROnPlateau (adapted to loss fluctuation scenarios).
[0052] Data augmentation: Phase shift can be replaced with elastic deformation; small-angle rotation can be replaced with 0.9~1.1 times random scaling; noise injection can introduce a texture adaptive adjustment mechanism.
[0053] Feature and noise handling: Feature dimensions can be adjusted as needed, and normalization can be replaced with L1 normalization; noise control can be replaced with traditional variance method or noise whitening processing.
[0054] In summary, this invention solves the problems of weak feature discriminative power, poor robustness of prototype computation, insufficient adaptability to different SNR noise environments, and low training stability in existing small-sample SAR image classification methods. Specifically, it includes: Design a channel-space dual attention enhancement module: By filtering key feature channels through channel attention and focusing on target areas through spatial attention, the discriminative power and noise resistance of SAR image features are enhanced, solving the problems of insufficient feature extraction and difficulty in distinguishing targets from noise in traditional methods.
[0055] A robust prototype computation mechanism is proposed: the 3σ principle is introduced to remove feature outliers, intra-class variance is normalized, and L2 norm is normalized to suppress the interference of noisy samples on the prototype, improve the stability and reliability of the prototype representation, and avoid the prototype from deviating from the true class center due to noise of different intensities.
[0056] Construct a dedicated SAR adaptation system: Design SAR data enhancement strategies such as phase shift and mild geometric transformation, and combine them with a cubic attenuation temperature coefficient strategy to adapt to feature distributions under different noise intensities and improve the model's generalization ability in different SNR environments.
[0057] Optimize training stability strategy: Integrate cosine annealing learning rate scheduling, gradient accumulation, label smoothing and gradient clipping to solve the problems of gradient oscillation and slow convergence in small sample training, and achieve efficient convergence under different SNR noise environments.
[0058] We construct an integrated framework of "preprocessing-attention feature extraction-robust prototype-temperature classification" to significantly improve the classification accuracy and performance stability of small sample SAR radar images under different SNR environments, and expand the application scenarios of prototype networks in the field of SAR target recognition.
[0059] This method has three core advantages: 1) Noise environment adaptation: It can maintain a relatively stable classification ability in different noise environments within the SNR range of -35dB to 35dB, taking into account both noise resistance and classification accuracy. 2) Small sample adaptation: Supports 3-way 5-shot small sample configuration, requiring no large amount of labeled data, adapting to scenarios where SAR image annotation costs are high and samples are scarce; 3) Low computational overhead: Based on a lightweight enhanced ResNet design, it balances accuracy and inference efficiency, facilitating engineering deployment. It can be widely used in scenarios such as border defense and security SAR target recognition, military reconnaissance SAR ship / armor classification, civilian remote sensing monitoring ground feature classification, and embedded radar system target discrimination, and can also be extended to other remote sensing image classification fields with small samples and high noise.
[0060] The above description is merely a description of preferred embodiments of the present invention and is not intended to limit the scope of the present invention in any way. Any changes or modifications made by those skilled in the art based on the above disclosure shall fall within the protection scope of the claims.
Claims
1. A few-sample SAR image classification method based on attention enhancement and robust prototype computation, characterized in that, include: By acquiring the dataset and configuring the parameters, we can ensure the learning effectiveness of the model under the constraint of small sample size. By preprocessing and enhancing SAR images, high-quality input can be provided for subsequent feature extraction. By constructing a ResNet feature extraction network and integrating a dual attention mechanism, the accurate extraction of highly discriminative features under different SNR noise environments can be achieved. The ResNet feature extraction network consists of an initial feature extraction layer, four attention-enhanced residual block layers, a global pooling layer, and a feature projection layer. Through the collaboration of each layer, progressive learning from low-level edge features to high-level semantic features can be achieved. By using a collaborative operation based on episode support set features, 3σ outlier removal, intra-class variance normalization and L2 norm normalization, a robust class prototype generation mechanism under different noise interference intensities is constructed to ensure the stability and discriminativeness of the prototype representation, thereby solving the problems of easy shift and poor stability of class prototypes under different SNR noise environments. By designing similarity calculation mechanisms and training strategies adapted to different SNR noise environments, efficient model convergence and accurate classification can be achieved, thereby solving the problems of low similarity calculation discrimination and unstable training under different SNR noise environments. By constructing a multi-scenario noise verification system, we can comprehensively evaluate the robustness and classification performance of the model in complex noise environments.
2. The few-sample SAR image classification method based on attention enhancement and robust prototype computation as described in claim 1, characterized in that, The operations of acquiring and configuring parameters for the dataset include: Dataset definition: The training dataset is obtained by acquiring a small sample of SAR images. With the test dataset ,in The number of training samples. For the number of test samples, The sample size is 88×88, and the sample category label is... , The preset total number of categories is used to adapt to typical target classification scenarios in SAR radar images; The few-sample parameter configuration adopts a few-sample training paradigm with N-WAY=5 classes, K-SHOT=5 support sets for each class, and Q-QUERY=15 query sets for each class, in order to construct an episode training unit containing support sets and query sets.
3. The few-sample SAR image classification method based on attention enhancement and robust prototype computation as described in claim 1, characterized in that, The preprocessing and enhancement operations for SAR images include: Adaptive normalization operation to calculate the 1% quantile of SAR images. and 99th percentile This crops the image pixel values to the [0,1] range. A simulated noise injection mechanism is introduced to control the noise intensity through a precise ratio of signal power to noise power, in order to adapt to different SNR noise environments. Specifically, this is achieved by calculating the signal power... With noise power , generate obey Gaussian noise is added and superimposed on the normalized image, and finally cropped to the range of [-5.0, 5.0] to ensure that the noise injection does not destroy the recognizability of the core features of the image; A SAR-specific data augmentation strategy is introduced, which involves performing augmentation operations on the training dataset, including random phase shift, random flip transformation, small-angle rotation enhancement, and adaptive adjustment of grayscale characteristics, to improve the model's generalization ability and geometric deformation adaptability against noise of different intensities.
4. The few-sample SAR image classification method based on attention enhancement and robust prototype computation as described in claim 1, characterized in that, The initial feature extraction layer includes: firstly, performing a convolution operation using a 3×3 convolution kernel, setting the number of output channels to 64, and specifying the stride and padding values. The value is 1 and no bias term is introduced; then the batch normalization layer BatchNorm2d and the ReLU activation function are sequentially connected; finally, the max pooling operation is performed, and the feature map is downsampled through a 2×2 max pooling layer with a stride of 2. The attention-enhanced residual block layer includes a residual block body, an enhanced channel attention module, and a spatial attention module connected in sequence. Each residual block body consists of two 3×3 standard convolutional layers, with the number of channels increasing sequentially according to the layer. By embedding the enhanced channel attention module and the spatial attention module, a dual attention enhancement mechanism is formed. At the same time, the effective propagation of gradients is ensured through shortcut connections, and the Dropout2d layer is embedded to suppress overfitting. The feature projection layer comprises: firstly, compressing the multidimensional feature map into a 1×1×1024 one-dimensional feature vector through global adaptive average pooling; then performing feature mapping through two fully connected layers; and finally, after each layer, connecting a batch normalization layer (BatchNorm1d), a ReLU activation function, and a Dropout layer to obtain the projected feature vector. Finally, the projected feature vector Perform L2 norm normalization; the normalization formula is: in Using the L2 norm, the discriminative eigenvectors are obtained after normalization. The feature set of the training dataset is denoted as The feature set of the test dataset is denoted as .
5. A few-sample SAR image classification method based on attention enhancement and robust prototype computation as described in claim 4, characterized in that, The channel attention calculation process of the channel attention module includes: Output characteristics of the residual block First, perform global average pooling. and global max pooling : in For the number of channels, Indicates feature map in channel c ,Location( i,j The eigenvalue at position ) For the feature map size, the pooling results are independently fed into a shared fully connected layer with shared parameters for feature transformation. The shared fully connected layer adopts a compression-recovery structure. The feature transformation process performed by the shared fully connected layer includes: The C channel features are compressed to C / r channels by compression ratio r through the first linear layer, in order to improve generalization ability in conjunction with the ReLU activation function and the Dropout layer; The features are restored to the original C channel through a second linear layer to ensure dimension matching; By fusing the outputs of the two pooled features after passing through the shared fully connected layer element-wise, and finally generating channel attention weights through Sigmoid activation: in For the Sigmoid function, fc (·) represents a compressed-recovery fully connected layer with shared parameters; features enhanced by channel attention. for: in This indicates multiplication by channel.
6. The few-sample SAR image classification method based on attention enhancement and robust prototype computation as described in claim 5, characterized in that, The spatial attention calculation process of the spatial attention module includes: The channel attention-enhanced features Perform average pooling along the channel dimension and max pooling ; After concatenation, spatial weights are generated through 3×3 convolution and sigmoid activation: Final Dual Attention Enhancement Features for: 。 7. The few-sample SAR image classification method based on attention enhancement and robust prototype computation as described in claim 2, characterized in that, The robust class prototype generation mechanism includes: The episode construction process involves randomly selecting N-WAY class samples from the training dataset, extracting K-SHOT samples from each class to form a support set and Q-QUERY samples to form a query set, thus forming a complete episode training unit; the feature matrix of the support set is denoted as... The category labels of the support set are denoted as ; Outlier removal involves calculating the mean and standard deviation of each support set feature to specifically remove outliers caused by noise interference under different SNR noise environments. in For the first cls Number of feature samples in the class support set For the first i In-class support set features, and The first cls The mean and standard deviation vectors of the class support set features are obtained, and the 3σ principle is applied: Used to filter effective feature samples, eliminate abnormal features caused by noise interference, ensure the consistency of intra-class features, and provide highly discriminative feature inputs for robust prototype generation; Robust class prototype generation uses the mean of the effective features within a class after outlier removal as the initial prototype to reduce the interference of outliers on the prototype under different SNR noise environments. in This represents the number of valid feature samples for each class after removing outliers. For the first i Effective features within each class; enhanced prototype discriminativeness through intra-class variance normalization to offset the impact of differences in intra-class feature dispersion under different SNR noise environments: in The mean variance of the effective features within a class is calculated by first calculating the variance of each effective feature within a class relative to the initial prototype. The variance of the prototype vectors is calculated, and then the mean of all variances is taken to offset the impact of intra-class feature dispersion on the classification effect, ensuring that the prototypes maintain stable discriminative ability under different SNR noise environments. Finally, L2 norm normalization is performed on the prototype vectors to generate the class prototype matrix. The normalization formula is: The normalized prototype further improves the prototype stability under different SNR noise environments, ensures the distinguishability between prototypes, and lays the foundation for subsequent similarity classification.
8. The few-sample SAR image classification method based on attention enhancement and robust prototype computation as described in claim 1, characterized in that, The similarity calculation mechanism and training strategy adapted to different SNR noise environments include: The adaptive temperature coefficient calculation dynamically adjusts the temperature coefficient using a cubic attenuation strategy to adapt to the changing feature distribution patterns under different SNR noise environments during training. The initial temperature 0.3~0.5, final temperature 0.03~0.07, For the current training round, the total number of training rounds is [number missing]. By gradually attenuating the temperature coefficient, the classification confidence and gradient magnitude are dynamically adjusted to keep the model stable in noisy environments and improve the discrimination accuracy in high signal-to-noise ratio environments. Similarity calculation and classification prediction, using query set features Expand to Dimensions, class prototype matrix Expand to Dimension, using the cosine similarity formula to calculate the similarity measure between two objects: in For a single query set feature, For a single class prototype; divide the similarity result by the temperature coefficient. Obtain the final similarity matrix ,Right now: Converted to a class probability distribution using the Softmax function: The category corresponding to the highest probability is selected as the predicted label for the query set sample: ; Training strategy optimization includes: The loss function is configured using cross-entropy loss, with a label smoothing coefficient of 0.
05. To alleviate the overfitting problem in small-sample training under different SNR noise environments, the loss function formula is as follows: in This represents the total number of query set samples in a single episode. For indicator functions, To query the true labels of the sample set, To query the features of the sample set, Indicates the label smoothing coefficient; Accuracy calculation: During training and validation, classification accuracy is calculated as the ratio of the number of correctly predicted samples to the total number of samples. The formula for classification accuracy is: Where M is the total number of test samples in the current noisy scenario. For the first m Predicted labels for each query set sample. The true label is used, and the accuracy value ranges from [0,1]. The closer the value is to 1, the better the classification performance. For the optimizer selection, the AdamW optimizer was used, with an initial learning rate of 0.0003, a weight decay coefficient of 5e-5, betas parameters of (0.9, 0.999), and eps parameters of 1e-8. Learning rate scheduling is performed using the CosineAnnealingWarmRestarts learning rate scheduler, with T0=15, Tmult=2, and etamin=5e-7, where T0 is the initial annealing period length, Tmult is the period multiplication factor, and etamin is the minimum learning rate decay. The learning rate update formula is as follows: in The initial learning rate, For the rounds within the current cycle, This represents the total length of the current cycle. The gradient optimization mechanism employs an 8-step gradient accumulation strategy to reduce the impact of gradient fluctuations on convergence during small-sample training under varying SNR noise environments; simultaneously, gradient clipping is implemented, with the gradient clipping formula as follows: in For the original gradient, It is the gradient after clipping. This is the maximum norm of the gradient, to prevent gradient explosion.
9. A few-sample SAR image classification method based on attention enhancement and robust prototype computation as described in claim 3, characterized in that, The construction of the multi-scenario noise verification system includes: Signal-to-noise ratio definition: Noise power calculation: Noise standard deviation calculation: Numerical stability handling: Set an upper limit for the noise standard deviation: in Signal-to-noise ratio is expressed in decibels. This represents the SAR image signal power, which is the mean of the squared pixel values in the image. The power of injected Gaussian noise, The standard deviation of Gaussian noise, This is the preprocessed SAR image.
10. A few-sample SAR image classification system based on attention enhancement and robust prototype computation, performing a few-sample SAR image classification method based on attention enhancement and robust prototype computation as described in any one of claims 1 to 9, characterized in that, include: The SAR image preprocessing and enhancement module provides a noise-resistant foundation for feature extraction through adaptive normalization and noise injection. The ResNet feature extraction module, which integrates channel and spatial attention, filters key feature channels through channel attention and focuses on target regions through spatial attention, thereby enhancing the discriminative power and noise resistance of SAR image features. The robust prototype calculation module eliminates feature outliers by introducing the 3σ principle, normalizes intra-class variance, and normalizes L2 norm, thereby suppressing the interference of noisy samples on the class prototype and generating stable class centers. The training and classification modules adapt to different SNR noise environments. They optimize similarity calculation through a temperature attenuation strategy to adapt to the noise environment, thus jointly solving the dual constraints of small sample size and different SNR noise.