Hyperspectral image classification method and model based on approximate double attention
By designing a dual-channel attention architecture and adaptive feature fusion unit, the problem of deterministic and uncertain feature integration in hyperspectral image classification is solved, and higher classification accuracy and accuracy are achieved, which is suitable for complex characteristic processing of hyperspectral images.
Patent Information
- Application Number
- CN202510565299.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2025-08-26
AI Technical Summary
Existing hyperspectral image classification methods are difficult to effectively integrate deterministic and uncertain features, resulting in poor classification accuracy and accuracy when dealing with complex scenarios.
The hyperspectral image classification method based on accurate dual attention is adopted, and the dual attention architecture is designed, and the deterministic and probabilistic characteristics are evaluated using Sigmoid activation function and temperature-controlled Softmax function, and feature integration is performed through adaptive feature fusion units.
It improves the accuracy and accuracy of hyperspectral image classification, especially in confusing areas and complex scenarios, and can effectively handle the complex characteristics of high-dimensional spectral data.
Smart Images

Figure CN120543906A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of hyperspectral image classification, and in particular to a hyperspectral image classification method and model based on certainty and dual attention. Background Art
[0002] In the hyperspectral image classification task, deterministic modeling refers to the construction of models that do not contain any random components. These models can clearly determine the relationship between the input image and the output classification results. Common methods include traditional machine learning methods, spectral image classification models constructed by introducing CNN models, and classification networks that introduce attention mechanisms. They are all deterministic models. Deterministic models can accurately capture significant features but have limited processing capabilities for uncertain scenes. Models built by traditional machine learning methods rely on manual feature design and are difficult to automatically extract deep features. Although CNN models have automatic feature extraction capabilities, the local receptive field limits the modeling of long-range dependencies. The attention mechanism improves feature weight distribution, but is mostly based on deterministic strategies and lacks uncertainty expression.
[0003] Therefore, in order to improve the model's ability to handle uncertain scenes, uncertainty modeling has also become an important direction in the research of hyperspectral image classification. Lei et al. (2022) proposed an active deep learning framework based on uncertainty learning. By constructing an auxiliary deep network to learn the uncertainty of unlabeled samples in the candidate data set, it effectively reduced the need for labeling. He et al. (2023) first applied Bayesian deep learning to hyperspectral image classification and established a complete uncertainty estimation framework in the feature extraction and classification stages, which not only improved the classification accuracy but also reduced the uncertainty. Bai et al. (2024) proposed a multi-strategy hyperspectral image classification scheme based on low measurement cost, combining contrastive learning, active learning and dual-threshold pseudo-active learning strategies, which can still achieve high classification accuracy under extremely small sample conditions
[44] . Transformer has shown significant potential in hyperspectral classification with its powerful long-range dependency modeling capabilities, but its computational complexity grows quadratically with the sequence length, is inefficient when processing high-dimensional spectral data, and may ignore key discriminant features. Uncertainty modeling methods are mostly separated from feature extraction and lack a unified framework, which affects the accuracy of feature extraction.
[0004] Most importantly, existing research often treats deterministic feature extraction and uncertainty modeling as independent processes, lacking effective integration. Therefore, designing a unified framework that can effectively handle both deterministic and uncertain information has become a key scientific issue that needs to be addressed. Summary of the Invention
[0005] Based on the above problems, the purpose of the present invention is to provide a hyperspectral image classification method and model based on certainty and probability dual attention. By designing a dual-path attention architecture: the deterministic path uses the Sigmoid activation function to independently evaluate features, which is good at capturing discriminative features; the probabilistic path introduces a temperature-controlled Softmax function to establish a competitive probability distribution, realizing controllable modeling of uncertainty, and then adaptively fusing the deterministic features and probabilistic features, ultimately improving the accuracy of hyperspectral image classification.
[0006] This application is achieved through the following technical solutions:
[0007] On the one hand, the present application provides a hyperspectral image classification method based on certainty dual attention, which includes:
[0008] S10: performing deterministic attention processing on the original features of the hyperspectral image to obtain deterministic attention features;
[0009] S11: Perform probabilistic attention processing on the original features of the hyperspectral image to obtain probabilistic attention features;
[0010] S20: Adaptively fuse the deterministic attention features and the probabilistic attention features to obtain fused features;
[0011] S30: Classify the fused features to obtain classification prediction results.
[0012] Furthermore, the step S10 specifically includes:
[0013] S101: performing feature transformation on the original features of the hyperspectral image according to a discriminant feature transformation matrix to obtain discriminant features of the spectral dimension;
[0014] S102: performing deterministic attention weight processing on the discriminative features to obtain deterministic weighted attention;
[0015] S103A: performing feature enhancement on the original feature according to the deterministic weighted attention and a spectral scaling parameter to obtain an enhanced deterministic spectral dimension feature;
[0016] S103B: performing feature enhancement on the original feature according to the deterministic weighted attention and a spatial scaling parameter to obtain an enhanced deterministic spatial dimension feature;
[0017] S104: Concatenate the enhanced deterministic spectral dimension features and the deterministic enhanced spatial dimension features to obtain a deterministic attention feature.
[0018] Furthermore, the step S11 specifically includes:
[0019] S111: performing feature transformation on the original features of the hyperspectral image according to a probabilistic feature transformation matrix to obtain probabilistic features of the spectral dimension;
[0020] S112: performing probabilistic attention weight processing on the probabilistic feature according to a temperature parameter to obtain probabilistic weighted attention;
[0021] S113A: Performing feature enhancement on the original feature according to the probabilistic weighted attention and an uncertainty spectrum scaling parameter to obtain an enhanced uncertainty spectrum dimension feature;
[0022] S113B: performing feature enhancement on the original feature according to the deterministic weighted attention and an uncertainty space scaling parameter to obtain an enhanced uncertainty space dimension feature;
[0023] S114: Concatenate the enhanced uncertainty spectral dimension features and the enhanced uncertainty spatial dimension features to obtain probabilistic attention features.
[0024] Furthermore, the probabilistic weighted attention is calculated by the following formula:
[0025] A p =softmax(BN(Conv(X p )) / τ)
[0026] Among them, τ is the temperature parameter, which is used to control the smoothness of the probability distribution, X p is the probabilistic feature of the spectral dimension, BN represents batch normalization, Conv represents convolution operation, and softmax is the normalized exponential function.
[0027] Furthermore, the step S20 includes:
[0028] S201: Concatenate the deterministic attention feature and the probabilistic attention feature to obtain a concatenated feature;
[0029] S202: Calculate adaptive attention weights on the concatenated features in the channel dimension to obtain adaptive weights;
[0030] S203: Perform weighted fusion on the spliced features according to the adaptive weights to obtain fused features.
[0031] Furthermore, in step S202, the adaptive attention weight is calculated using the following formula:
[0032] W fusion =FC(Pool(F cat ))
[0033] Among them, F catis the concatenated feature, Pool is the global pooling operation, and FC is the fully connected layer processing.
[0034] Furthermore, in step S203, weighted fusion is performed by the following formula:
[0035] F fused =Conv fusion (F cat ⊙W fusion )
[0036] Among them, F cat is the concatenated feature, W fusion is the adaptive attention weight, ⊙ represents element-wise multiplication, Conv fusion It is fused convolution processing.
[0037] On the other hand, the present application also provides a hyperspectral image classification model based on certainty and dual attention, which includes:
[0038] The deterministic attention unit is used to perform deterministic attention processing on the original features of the hyperspectral image to obtain deterministic attention features;
[0039] The probabilistic attention unit is used to perform probabilistic attention processing on the original features of the hyperspectral image to obtain probabilistic attention features;
[0040] An adaptive feature fusion unit is used to perform adaptive feature fusion on the deterministic attention features and the probabilistic attention features to obtain the fused features;
[0041] The classifier is used to classify the fused features and obtain classification prediction results.
[0042] Furthermore, the deterministic attention unit includes:
[0043] The discriminant feature extraction subunit is used to perform feature transformation on the original features of the hyperspectral image according to a discriminant feature transformation matrix to obtain discriminant features of the spectral dimension;
[0044] Deterministic weighted attention calculation subunit: used to perform deterministic attention weight processing on the discriminative features to obtain deterministic weighted attention;
[0045] A deterministic spectral dimension feature calculation subunit is configured to perform feature enhancement on the original feature according to the deterministic weighted attention and a spectral scaling parameter to obtain an enhanced deterministic spectral dimension feature;
[0046] A deterministic spatial dimension feature calculation subunit is configured to perform feature enhancement on the original feature according to the deterministic weighted attention and a spatial scaling parameter to obtain an enhanced deterministic spatial dimension feature;
[0047] The first feature splicing subunit is used to splice the enhanced deterministic spectral dimension features and the deterministic enhanced spatial dimension features to obtain the deterministic attention features.
[0048] Furthermore, the probabilistic attention unit includes:
[0049] The probabilistic feature extraction subunit is used to perform feature transformation on the original features of the hyperspectral image according to a probabilistic feature transformation matrix to obtain probabilistic features of the spectral dimension;
[0050] The probabilistic weighted attention calculation subunit performs probabilistic attention weight processing on the probabilistic feature according to a temperature parameter to obtain probabilistic weighted attention;
[0051] The uncertainty spectrum dimension feature calculation subunit is used to enhance the original feature according to the probabilistic weighted attention and an uncertainty spectrum scaling parameter to obtain an enhanced uncertainty spectrum dimension feature;
[0052] The uncertainty space dimension feature calculation subunit performs feature enhancement on the original feature according to the deterministic weighted attention and an uncertainty space scaling parameter to obtain an enhanced uncertainty space dimension feature;
[0053] The second feature splicing subunit: splices the enhanced uncertainty spectral dimension features and the enhanced uncertainty spatial dimension features to obtain probabilistic attention features.
[0054] The present invention provides a hyperspectral image classification method and model based on deterministic and probabilistic dual attention, which aims at the limitations of existing hyperspectral classification methods in processing deterministic and uncertain features. A hyperspectral image classification method is proposed based on a deterministic-probabilistic dual-path parallel attention architecture. The deterministic attention branch uses a Sigmoid activation function to independently evaluate features and is good at capturing discriminative features. The probabilistic attention branch introduces a temperature-controlled Softmax function to establish a competitive probability distribution, realizes controllable modeling of uncertainty, breaks the limitations of traditional attention mechanisms, improves the accuracy of complex feature data processing, captures data characteristics through global pooling in the adaptive feature fusion unit, and dynamically adjusts the dual-path feature contribution with channel attention, solves the problems of poor performance of deterministic models in confused areas and lack of feature focus of probabilistic models, realizes data-driven intelligent feature integration, further improves the quality of fused features, and ultimately improves the classification accuracy and precision of the hyperspectral image classification method.
[0055] For better understanding and implementation, the present invention is described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 This is a structural diagram of the hyperspectral image classification model based on certainty and dual attention provided by the present invention;
[0057] Figure 2 for Figure 1 The execution flow chart of the hyperspectral image classification model based on certainty dual attention is shown;
[0058] Figure 3 This is a structural block diagram of the deterministic attention unit of the present invention;
[0059] Figure 4 To execute Figure 3 Flowchart of the deterministic attention unit shown;
[0060] Figure 5 : is a structural block diagram of the probabilistic attention unit of the present invention;
[0061] Figure 6 To execute Figure 5 Flowchart of the probabilistic attention unit shown. DETAILED DESCRIPTION
[0062] Because traditional attention mechanisms are based on a single deterministic function, they struggle to simultaneously process both deterministic and uncertain features in hyperspectral data. Therefore, this paper designs a dual-path attention architecture to extract deterministic and uncertain features separately. The deterministic path first captures discriminative features and uses a Sigmoid activation function to independently evaluate the weighted proportions of these features, ensuring that the calculated deterministic attention is already weighted. The probabilistic path introduces a temperature-controlled Softmax function to establish a competitive probability distribution, enabling controllable modeling of uncertainty. This design overcomes the limitations of traditional attention mechanisms and provides new insights for processing complex feature data.
[0063] Existing fusion methods use fixed weights or simple splicing, making it impossible to adjust the contributions of deterministic and uncertain features from different spectral images. Therefore, the present invention further designs an adaptive feature fusion unit based on global context. This unit captures data characteristics through global pooling and dynamically adjusts dual-path feature contributions using channel attention. This solves the problems of poor performance of deterministic models in confusing regions and lack of feature focus in probabilistic models, achieving data-driven intelligent feature integration. These designs form a model that effectively handles the complex characteristics of hyperspectral data, providing a new technical approach for solving high-dimensional data classification problems.
[0064] Based on the above analysis, this paper proposes a hyperspectral image classification method and model based on certainty and dual attention. Figure 1The model includes: a deterministic attention unit 10, a probabilistic attention unit 11, an adaptive feature fusion unit 20, and a classifier 30 for classifying hyperspectral images. The working process of each component of the hyperspectral image classification model based on deterministic and probabilistic dual attention is as follows: Figure 2 As shown, it specifically includes:
[0065] The deterministic attention unit 10 is used to execute step S10: performing deterministic attention processing on the original features of the hyperspectral image to obtain deterministic attention features.
[0066] Given hyperspectral input data X∈R B×L×H×W , where B is the batch size, L is the number of spectral bands, and H×W is the spatial dimension. The deterministic attention unit is designed to capture deterministic patterns in hyperspectral data; see Figure 3 , which includes:
[0067] The discriminative feature extraction subunit 101 is configured to execute step S101: performing feature transformation on the original features of the hyperspectral image according to a discriminative feature transformation matrix to obtain discriminative features of the spectral dimension.
[0068] This subunit can project the input data into the feature space and capture the discriminative features in the spectral dimension through the discriminative feature transformation matrix, which is specifically implemented by the following formula:
[0069] X d =W d X
[0070] Among them, W d ∈R L×L is a learnable discriminant feature transformation matrix. This transformation matrix implements the linear projection of high-dimensional spectral data and effectively extracts discriminative features in the spectral dimension.
[0071] The deterministic weighted attention calculation subunit 102 is used to execute step S102: performing deterministic attention weight processing on the discriminative features to obtain deterministic weighted attention. This subunit calculates the deterministic weighted attention using the following formula:
[0072] A d =σ(BN(Conv(X d )))
[0073] Where σ represents the Sigmoid activation function, BN represents batch normalization, and Conv represents the convolution operation. The Sigmoid function ensures that the attention weights are in the range [0, 1]. This deterministic design assigns importance weights to each feature independently, rather than competing probability distributions.
[0074] The deterministic spectral dimension feature calculation subunit 103A is used to perform step S103A: enhance the original feature according to the deterministic weighted attention and a spectral scaling parameter to obtain an enhanced deterministic spectral dimension feature. The specific formula is as follows
[0075] F d,s =a s ·X⊙A d
[0076] Among them, α s is the spectrum scaling parameter, X is the original feature, ⊙ represents element-wise multiplication, A d is the deterministic weighted attention.
[0077] The deterministic spatial dimension feature calculation subunit 103B is used to perform step S103B: enhance the original feature according to the deterministic weighted attention and a spatial scaling parameter to obtain an enhanced deterministic spatial dimension feature. The specific formula is as follows:
[0078] F d,p =a p ·X⊙A d
[0079] Among them, α p is the spatial scaling parameter, X is the original feature, ⊙ represents element-wise multiplication, A d is the deterministic weighted attention.
[0080] The first feature concatenation subunit 104 is used to execute step S104: concatenate the enhanced deterministic spectral dimension feature and the enhanced deterministic spatial dimension feature to obtain a deterministic attention feature. The specific formula is as follows:
[0081] F d =F d,s +F d,p
[0082] Among them, F d It is a deterministic attention feature.
[0083] The deterministic spectral dimension feature calculation subunit, the deterministic spatial dimension feature calculation subunit, and the first feature concatenation subunit achieve joint spectral-spatial enhancement, adjusting the contribution of different dimensions. The deterministic attention mechanism uses the deterministic decision boundary of the Sigmoid activation function to learn and reinforce features that are crucial for classification. This provides clear judgment of feature importance and is suitable for capturing significant feature patterns in hyperspectral data.
[0084] The probabilistic attention unit 11 is used to execute step S11: perform probabilistic attention processing on the original features of the hyperspectral image to obtain probabilistic attention features.
[0085] The probabilistic attention unit is designed to model the uncertainty in hyperspectral data. It has a similar structure to the deterministic attention branch, but has key differences. Figure 5 、 Figure 6 Specifically include:
[0086] The probabilistic feature extraction subunit 111 is configured to execute step S111: performing feature transformation on the original features of the hyperspectral image according to a probabilistic feature transformation matrix to obtain probabilistic features of the spectral dimension.
[0087] This subunit can project the input data into the feature space, capture the probability distribution on the spectral dimension through the probabilistic feature transformation matrix, and extract feature representations suitable for probabilistic modeling, which is specifically achieved through the following formula:
[0088] X p =W p X
[0089] Among them, W p ∈R L×L is a learnable probabilistic feature transformation matrix. This transformation matrix is specifically used to extract feature representations suitable for probabilistic modeling.
[0090] The probabilistic weighted attention calculation subunit 112 is used to execute step S112: perform probabilistic attention weight processing on the probabilistic feature according to a temperature parameter to obtain probabilistic weighted attention. This subunit calculates the probabilistic weighted attention using the following formula:
[0091] A p =softmax(BN(Conv(X p )) / τ)
[0092] Among them, τ is the temperature parameter, which is used to control the smoothness of the probability distribution, X p is the probabilistic feature of the spectral dimension, BN represents batch normalization, Conv represents convolution operation, and softmax is the normalized exponential function.
[0093] Compared with the deterministic weighted attention calculation subunit, the probabilistic weighted attention calculation subunit uses the softmax function as the activation function to form competing probability distributions, and introduces a temperature parameter τ to adjust the entropy of the distribution: a lower τ produces a sharper probability distribution (low entropy), and a higher τ produces a smoother distribution (high entropy), thereby realizing controllable modeling of uncertainty.
[0094] The uncertainty spectrum dimension feature calculation subunit 113A is used to perform step S113A: feature enhancement of the original feature according to the probabilistic weighted attention and an uncertainty spectrum scaling parameter to obtain an enhanced uncertainty spectrum dimension feature. The specific formula is as follows:
[0095] F p,s =β s ·X⊙A p
[0096] Among them, β s is the uncertainty spectrum scaling parameter, X is the original feature, ⊙ represents element-wise multiplication, A p is the probabilistic weighted attention.
[0097] The uncertainty space dimension feature calculation subunit 113B is used to perform step S113B: based on the deterministic weighted attention and an uncertainty space scaling parameter, the original feature is enhanced to obtain an enhanced uncertainty space dimension feature. The specific formula is as follows:
[0098] F p,p =β p ·X⊙a p
[0099] Among them, β p is the uncertainty space scaling parameter, X is the original feature, ⊙ represents element-wise multiplication, a p is the probabilistic weighted attention.
[0100] The second feature concatenation subunit 114 is used to execute step S114: concatenate the enhanced uncertainty spectrum dimension feature and the enhanced uncertainty space dimension feature to obtain a probabilistic attention feature. The specific formula is as follows:
[0101] F p =F p,s +F p,p
[0102] Among them, F p is a probabilistic attention feature.
[0103] The core innovation of probabilistic attention lies in the use of softmax plus temperature design, which allows the model to find a balance between certainty and exploration by adjusting the τ value, effectively modeling the uncertainty factors in hyperspectral data, such as spectral confusion of similar objects and blurred boundary areas.
[0104] Deterministic and probabilistic attention form a complementary feature extraction paradigm. Deterministic attention captures discriminative features by independently assigning weights to each feature using a sigmoid function. Probabilistic attention effectively models uncertainty by creating a competitive weight distribution using a softmax function controlled by a temperature parameter. This design enables the model to simultaneously identify salient features and process ambiguous information, making it particularly well-suited for the coexistence of clear and mixed pixel regions in hyperspectral data. The temperature parameter, acting as an uncertainty regulator, achieves an adaptive balance between deterministic decision-making and exploratory search, improving the model's adaptability to complex scenarios.
[0105] The adaptive feature fusion unit 20 is used to perform step S20: adaptively fuse the deterministic attention features and the probabilistic attention features after splicing to obtain fused features. Step S20 includes:
[0106] S201: Concatenate the deterministic attention features and the probabilistic attention features to obtain concatenated features.
[0107] F cat =[F d ||F p ]
[0108] Among them, F d is the deterministic attention feature, F p is the probabilistic attention feature, and || represents the feature concatenation operation. The concatenation preserves the complete information of the two features and provides a basis for subsequent adaptive weight allocation.
[0109] S202: Calculate the adaptive attention weight of the spliced features in the channel dimension to obtain the adaptive weight. The adaptive attention weight is calculated specifically by the following formula:
[0110] W fusion =FC(Pool(F cat ))
[0111] Among them, F cat The concatenated features, Pool, and FC are global pooling operations, respectively. Global pooling compresses spatial dimensions to obtain channel-level features, while fully connected layers learn the relationships between channels and ultimately generate adaptive attention weights.
[0112] S203: Perform weighted fusion on the spliced features according to the adaptive weights to obtain fused features. Specifically, the weighted fusion calculation is performed using the following formula:
[0113] F fused =Conv fusion (F cat ⊙W fusion)
[0114] Among them, F cat is the concatenated feature, W fusion is the adaptive attention weight, ⊙ represents element-wise multiplication, Conv fusion It is fused convolution processing.
[0115] The adaptive fusion mechanism dynamically adjusts the contribution of deterministic and probabilistic features according to the input data, optimizes the complementarity between the two, and enhances the model's adaptability to different data characteristics.
[0116] The classifier 30 is used to execute step S30: classify the fused features to obtain a classification prediction result.
[0117] The fused features are mapped to the category space through global average pooling and fully connected layers:
[0118] Y=softmax(FC(GlobalAvgPool(F fused )))
[0119] GlobalAvgPool is the global average pooling, FC is the fully connected layer, and softmax is the normalized exponential function.
[0120] Global average pooling reduces the spatial dimension, reduces the number of parameters and enhances position invariance. The fully connected layer realizes the mapping of features to category space. The softmax function converts the output into a probability distribution, and finally obtains the classification prediction result.
[0121] The present invention provides a hyperspectral image classification method and model based on deterministic and probabilistic dual attention, which aims at the limitations of existing hyperspectral classification methods in processing deterministic and uncertain features. A hyperspectral image classification method is proposed based on a deterministic-probabilistic dual-path parallel attention architecture. The deterministic attention branch uses a Sigmoid activation function to independently evaluate features and is good at capturing discriminative features. The probabilistic attention branch introduces a temperature-controlled Softmax function to establish a competitive probability distribution, realizes controllable modeling of uncertainty, breaks the limitations of traditional attention mechanisms, improves the accuracy of complex feature data processing, captures data characteristics through global pooling in the adaptive feature fusion unit, and dynamically adjusts the dual-path feature contribution with channel attention, solves the problems of poor performance of deterministic models in confused areas and lack of feature focus of probabilistic models, realizes data-driven intelligent feature integration, further improves the quality of fused features, and ultimately improves the classification accuracy and precision of the hyperspectral image classification method.
[0122] The present invention also conducts model experimental verification and performance evaluation on three standard hyperspectral datasets (Indian Pines, Pavia University, and Salinas Valley).
[0123] The Indian Pines dataset, acquired by NASA's AVIRIS (Airborne Visible / Infrared Imaging Spectrometer) sensor in northwestern Indiana, contains hyperspectral imagery of an agricultural area. The dataset has a spatial resolution of 145×145 pixels and originally contains 220 bands. Twenty water absorption bands were removed, leaving 200 spectral bands for analysis. The dataset contains 16 feature classes, primarily crops, forests, and built-up areas. It is characterized by high spectral similarity between classes and an uneven sample distribution, with some classes having very few samples (for example, "Oats" has only 20 samples). This provides a good testing platform for evaluating algorithm performance under small sample conditions.
[0124] The Pavia University dataset was acquired by the ROSIS (Reflected Optical Imaging Spectral Sensor) over the University of Pavia, Italy. The dataset has a spatial resolution of 610×340 pixels and contains 103 spectral bands. The dataset is annotated with nine typical urban feature categories: asphalt, grass, gravel, trees, metal sheets, bare soil, asphalt felt, bricks, and shadows. This dataset represents a typical urban environment, with a relatively complex feature distribution, distinct spatial structure, and clear category boundaries. It provides a benchmark for evaluating the performance of algorithms in urban scenarios.
[0125] The Salinas Valley dataset, also collected by the AVIRIS sensor, is located in Salinas Valley, California. The dataset has a spatial resolution of 512 × 217 pixels and contains 224 spectral bands. After removing the water absorption band, 204 valid bands remain. The dataset includes 16 fine-grained crop categories, such as various vegetables (such as lettuce and celery), vineyards in different cultivation states, and bare soil. This dataset is characterized by its fine classification of crop categories, with different growth stages of the same crop being classified into different categories (for example, lettuce is divided into four different growth cycles). The spectral characteristics of these categories are extremely similar, with only slight differences, posing a challenge for testing the algorithm's ability to make fine distinctions.
[0126] These three datasets represent different application scenarios and challenges in hyperspectral image classification, including agricultural monitoring, urban analysis, and fine-grained crop identification, providing a good basis for comprehensively evaluating the performance and generalization ability of the proposed algorithm.
[0127] 1. Experimental setup and parameter configuration
[0128] This study evaluated the model on three public benchmark datasets: Indian Pines (trained with 11% of the sample), Pavia University, and Salinas (both trained with 5% of the sample). All data was normalized to the interval [0, 1]. The experiments used uniform training parameters: batch size 64, initial learning rate 0.001, weight decay 0.0005, and Adam optimizer for up to 500 epochs with early stopping (patience parameter 50, minimum change threshold 10^-6). The learning rate was annealed using a cosine annealing strategy with a five-epoch warmup (starting at 10^-6), a minimum learning rate of 10^-7, and a decay factor of 0.1 every 30 epochs. Performance was evaluated using the overall accuracy (OA), average accuracy (AA), and Kappa coefficient. All experiments were conducted on a workstation equipped with an NVIDIA RTX4090 GPU.
[0129] 2. Comparison method
[0130] In order to comprehensively evaluate the performance of the proposed hyperspectral image classification model based on certainty and dual attention, this paper selected a variety of representative convolutional neural networks and attention mechanism models as comparison models. First, a series of architectures from basic CNN to complex variants were selected, representing the technical evolution path of deep learning in hyperspectral image classification; second, a variety of mainstream attention mechanism models were included. These models have achieved remarkable results in the field of computer vision and can effectively verify the superiority of the dual attention framework proposed in this paper; third, the selected methods cover different technical paradigms such as spatial feature extraction, channel feature enhancement, and long-range dependency modeling, which can evaluate the performance advantages of the hyperspectral image classification model based on certainty and dual attention from multiple dimensions. Specifically, these comparison models include:
[0131] Basic CNN model:
[0132] (1)cnn_basic: uses the basic model of the standard three-layer CNN structure as the benchmark for performance evaluation to verify the basic effectiveness of deep learning in hyperspectral classification.
[0133] (2) cnn_deep: A deeper version of cnn_basic, containing five convolutional layers, which improves feature extraction capabilities by increasing network depth. Dropout is added after each convolution layer to enhance generalization performance, and the last two layers use smaller convolution kernels (1×1) for channel dimensionality reduction.
[0134] (3)cnn_inception: A multi-scale feature extraction network based on the Inception module. In each Inception module, 1×1, 3×3, and 5×5 convolution kernels are used in parallel to extract multi-scale features. Information under different receptive fields is integrated through feature splicing, which is particularly suitable for capturing multi-scale spatial-spectral features in hyperspectral data.
[0135] (4)cnn_resnet: A deep network based on residual connections, consisting of four residual blocks. Each residual block contains two layers of convolution operations and skip connections, which effectively alleviates the gradient vanishing problem of deep networks and improves the efficiency of feature propagation.
[0136] (5)cnn_efficientnetv2: A lightweight network based on the EfficientNetV2 architecture, combining the MBConv and FusedMBConv modules. It achieves parameter-efficient feature extraction by dynamically adjusting the network width, depth, and resolution, pursuing high classification performance while maintaining low computational complexity.
[0137] Attention mechanism model:
[0138] (1)ATN_cbam: A Convolutional Block Attention Module (CBAM) network that integrates channel attention and spatial attention. By applying the channel attention and spatial attention mechanisms successively, it achieves adaptive weight distribution of feature maps in the channel dimension and spatial dimension, and enhances the key feature representation.
[0139] (2)ATN_eca: A network based on the Efficient Channel Attention (ECA) mechanism, which uses one-dimensional convolution to achieve cross-channel information interaction. Compared with the SE module, it greatly reduces the number of parameters while maintaining the effectiveness of channel attention. It is particularly suitable for processing high-dimensional spectral data.
[0140] (3)ATN_se: A network that integrates the Squeeze-and-Excitation (SE) module, compresses spatial information through global average pooling, and then uses a two-layer fully connected network to explicitly model the dependencies between channels, assigning importance weights to each channel, effectively improving feature discrimination.
[0141] (4) ATN_nonlocal: A network that introduces the Non-local module captures long-range dependencies based on the self-attention mechanism and implements global context modeling by calculating the correlation between all positions in the feature map. It is particularly suitable for capturing long-range spatial-spectral correlations in hyperspectral data.
[0142] (5)ATN_bam: A network that integrates the Bottleneck Attention Module (BAM) and generates a three-dimensional attention map through parallel processing of channel attention and spatial attention branches, achieving fine-grained recalibration of features and effectively improving feature expression capabilities while maintaining low computational complexity.
[0143] All baseline methods use the same training parameter settings and data processing pipeline to ensure fair and reliable experimental comparisons. These methods represent the technological evolution from traditional CNN to modern attention mechanisms, providing a comprehensive comparative benchmark for evaluating the proposed hyperspectral image classification model based on certainty dual attention.
[0144] The above models and the hyperspectral image classification model based on certainty and dual attention proposed in this invention were used to perform classification tasks on the Indian Pines agricultural dataset, and the following data table was obtained:
[0145]
[0146] (Table 1) Comparison of classification accuracy provided by different methods on the Indian Pines agricultural dataset (unit / percentage)
[0147] As can be seen, on the Indian Pines agricultural dataset, the proposed hyperspectral image classification model based on certainty dual attention achieved an overall accuracy (OA) of 96.94%, an average accuracy (AA) of 94.38%, and a Kappa coefficient of 96.51%. These performances are significantly improved compared to the best baseline model cnn_basic (96.32% OA) and the optimal attention model ATN_bam (91.55% OA). Particularly noteworthy is the excellent performance of the hyperspectral image classification model based on certainty dual attention on low-sample categories such as "Grass-pasture-mowed" (100%) and "Alfalfa" (82.93%), far surpassing other methods and demonstrating its robustness in imbalanced sample scenarios. The classification diagram shows that the results generated by the hyperspectral image classification model based on deterministic-probabilistic dual attention show higher spatial consistency and clearer object boundaries, especially in distinguishing between the "Corn" and "Soybeans" categories with severe spectral confusion, with classification accuracies reaching 99.53% and 97.35% respectively. This fully verifies the superiority of the deterministic-probabilistic dual attention mechanism in processing spectrally similar objects, and also shows that the model can effectively extract discriminative features from high-dimensional spectral data, providing a high-precision solution for crop classification in complex agricultural scenarios.
[0148] To verify the performance of the hyperspectral image classification model based on certainty and dual attention in urban environment hyperspectral image classification, this study conducted a detailed analysis of the Pavia University dataset. The above various models and the hyperspectral image classification model based on certainty and dual attention proposed in this paper performed classification tasks on the Pavia University dataset, and the following data table was obtained:
[0149]
[0150]
[0151] (Table 2) Comparison of classification accuracy provided by different methods on the Pavia University dataset (unit / percentage)
[0152] The hyperspectral image classification model based on the concept of dual attention achieved an overall accuracy of 98.39%, an average precision of 96.92%, and a Kappa coefficient of 97.87% on the Pavia University urban dataset, with an overall accuracy slightly lower than the optimal model, cnn_basic (98.79% OA). Although the overall accuracy of the hyperspectral image classification model based on the concept of dual attention is slightly lower than that of cnn_basic, the classification plot and the distribution of accuracy per category show that the hyperspectral image classification model based on the concept of dual attention outperformed most attention models, such as ATN_cbam (66.05%) and ATN_eca (1.05%), in handling the 'Gravel' category (83.50%), which has severe spectral aliasing, and achieved higher classification accuracy in categories such as 'Trees' and 'Shadows'. Specifically, the hyperspectral image classification model based on the concept of dual attention achieved an accuracy exceeding 99% in five of the nine urban feature categories, and achieved a perfect classification of 100% in the "Metal Sheets" category. It is particularly noteworthy that the classification map generated by the hyperspectral image classification model based on certainty dual attention has more precise boundaries, especially in the "Bricks" (97.26%) area with complex textures and the "Bitumen" (95.01%) area with easy confusion, with less noise and more coherent spatial distribution. This shows that the model has advantages in processing complex spatial structures, can effectively integrate the spectral information and spatial context information of urban objects, and shows good classification stability and generalization ability in highly heterogeneous urban environments.
[0153] To further evaluate the classification capability of the hyperspectral image classification model based on certainty dual attention in precision agriculture scenarios, this study conducted in-depth experiments on the Salinas Valley dataset with complex crop distribution; the following data table was obtained:
[0154]
[0155]
[0156] (Table 3) Comparison of classification accuracy provided by different methods on the Salinas Valley dataset (unit / percentage)
[0157] On the Salinas Valley precision agriculture dataset, the hyperspectral image classification model based on the dual attention algorithm achieved an overall accuracy of 97.08%, an average precision of 98.34%, and a Kappa coefficient of 96.75%, comprehensively surpassing all compared methods, including the baseline CNN model (up to 95.80% OA) and various attention models (up to 95.78% OA). It is worth noting that the hyperspectral image classification model based on the dual attention algorithm achieved 100% accuracy in 4 of the 16 crop categories, and an accuracy of more than 99% in another 7 categories, demonstrating its excellent discriminative ability in handling precision agriculture scenarios. Specifically, for crop categories with similar spectral characteristics, such as the "Lettuce-romaine" series (4 weeks to 7 weeks), the deterministic-probabilistic dual-attention hyperspectral image classification model achieved high recognition accuracy exceeding 98%. While the accuracy for the most challenging "Vineyard-untrained" category was relatively low (86.37%), it still outperformed most of the comparison methods, with the exception of ATN_bam (93.96%). Classification plots show that the deterministic-probabilistic dual-attention hyperspectral image classification model accurately preserves the spatial morphology and boundary characteristics of different crop plots, reducing fragmented classification results. It exhibits particularly strong stability in areas with complex planting patterns and variable spectral responses, further confirming the applicability and advanced nature of the deterministic-probabilistic dual-attention framework for highly complex and sophisticated agricultural monitoring scenarios.
[0158] Experimental analysis of three representative hyperspectral datasets reveals a clear correlation between the architecture design and classification performance of different methods. Traditional CNN architectures exhibit a nonlinear relationship between structural complexity and performance: simple structures such as cnn_basic perform well on certain datasets (up to 98.79%), while complex networks such as cnn_efficientnetv2 generally perform poorly (81.16%-96.21%). This suggests that the high-dimensional nature of hyperspectral data makes it unsuitable to directly apply deep architectures from the natural image domain. Attention mechanism methods show a strong correlation between mechanism design and performance: single-dimensional attention, such as ATN_eca, performs unstable on various datasets (80.89%-90.89%), and is particularly ineffective on categories such as "Gravel" from Pavia University (1.05%). Spatial and channel-combined attention, such as ATN_cbam, performs relatively better (91.18%-95.75%), but its deterministic design has limitations when dealing with the uncertainty characteristics of hyperspectral data. Global dependency attention, such as ATN_nonlocal, can capture long-range relationships (92.33%-95.97%) but fails to effectively handle complex correlations between spectral dimensions. In contrast, the hyperspectral image classification model based on deterministic and probabilistic dual attention proposed in this paper achieves optimal performance in different classification scenarios through a deterministic-probabilistic dual attention framework.
[0159] In summary, the experimental results fully verify that HDP-Net successfully solves the key challenge of simultaneously processing deterministic and uncertain features in hyperspectral classification through the innovative design of the deterministic-probabilistic dual attention framework, achieving a dual improvement in classification accuracy and robustness.
[0160] Based on the same inventive concept described above, the present application also provides an electronic device, which can be a terminal device such as a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet computer, a netbook, etc.). The device includes one or more processors and a memory, wherein the processor is used to execute a program to implement the aforementioned hyperspectral image classification method based on certainty and dual attention; and the memory is used to store a computer program executable by the processor.
[0161] Based on the same inventive concept, the present application also provides a computer-readable storage medium, corresponding to the embodiment of the aforementioned hyperspectral image classification method based on definite dual attention, wherein the computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the hyperspectral image classification method based on definite dual attention recorded in any of the above embodiments.
[0162] The present application may take the form of a computer program product implemented on one or more storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing program code. Computer-usable storage media include permanent and non-permanent, removable and non-removable media, and information storage can be achieved by any method or technology. The information can be computer-readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
[0163] The above-described embodiments merely represent several implementations of the present invention. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art would be able to make numerous modifications and improvements without departing from the spirit of the present invention, and the present invention is intended to encompass such modifications and variations.
Claims
1. Hyperspectral image classification method based on certainty dual attention, characterized by: include: S10: performing deterministic attention processing on the original features of the hyperspectral image to obtain deterministic attention features; S11: Perform probabilistic attention processing on the original features of the hyperspectral image to obtain probabilistic attention features; S20: Adaptively fuse the deterministic attention features and the probabilistic attention features to obtain fused features; S30: Classify the fused features to obtain classification prediction results.
2. The hyperspectral image classification method based on certainty and dual attention according to claim 1 is characterized in that The step S10 specifically includes: S101: performing feature transformation on the original features of the hyperspectral image according to a discriminant feature transformation matrix to obtain discriminant features of the spectral dimension; S102: performing deterministic attention weight processing on the discriminative features to obtain deterministic weighted attention; S103A: performing feature enhancement on the original feature according to the deterministic weighted attention and a spectral scaling parameter to obtain an enhanced deterministic spectral dimension feature; S103B: performing feature enhancement on the original feature according to the deterministic weighted attention and a spatial scaling parameter to obtain an enhanced deterministic spatial dimension feature; S104: Concatenate the enhanced deterministic spectral dimension features and the deterministic enhanced spatial dimension features to obtain a deterministic attention feature.
3. The hyperspectral image classification method based on certainty dual attention according to claim 2 is characterized in that The step S11 specifically includes: S111: performing feature transformation on the original features of the hyperspectral image according to a probabilistic feature transformation matrix to obtain probabilistic features of the spectral dimension; S112: performing probabilistic attention weight processing on the probabilistic feature according to a temperature parameter to obtain probabilistic weighted attention; S113A: Performing feature enhancement on the original feature according to the probabilistic weighted attention and an uncertainty spectrum scaling parameter to obtain an enhanced uncertainty spectrum dimension feature; S113B: performing feature enhancement on the original feature according to the deterministic weighted attention and an uncertainty space scaling parameter to obtain an enhanced uncertainty space dimension feature; S114: Concatenate the enhanced uncertainty spectral dimension features and the enhanced uncertainty spatial dimension features to obtain probabilistic attention features.
4. The hyperspectral image classification method based on certainty dual attention according to claim 3 is characterized in that The probabilistic weighted attention is calculated using the following formula: A p =softmax(BN(Conv(X p )) / τ) Among them, τ is the temperature parameter, which is used to control the smoothness of the probability distribution, X p is the probabilistic feature of the spectral dimension, BN represents batch normalization, Conv represents convolution operation, and softmax is the normalized exponential function.
5. The hyperspectral image classification method based on certainty and dual attention according to claim 4 is characterized in that: The step S20 includes: S201: Concatenate the deterministic attention feature and the probabilistic attention feature to obtain a concatenated feature; S202: Calculate adaptive attention weights on the concatenated features in the channel dimension to obtain adaptive weights; S203: Perform weighted fusion on the spliced features according to the adaptive weights to obtain fused features.
6. The hyperspectral image classification method based on certainty and dual attention according to claim 5 is characterized in that: In step S202, the adaptive attention weight is calculated using the following formula: W fusion =FC(Pool(F cat )) Among them, F cat is the concatenated feature, Pool is the global pooling operation, and FC is the fully connected layer processing.
7. The hyperspectral image classification method based on certainty and dual attention according to claim 6 is characterized in that: In step S203, weighted fusion is performed using the following formula: F fused =Conv fusion (F cat ⊙W fusion ) Among them, F cat is the concatenated feature, W fusion is the adaptive attention weight, ⊙ represents element-wise multiplication, Conv fusion It is fused convolution processing.
8. A hyperspectral image classification model based on certainty dual attention, characterized by: include: The deterministic attention unit is used to perform deterministic attention processing on the original features of the hyperspectral image to obtain deterministic attention features; The probabilistic attention unit is used to perform probabilistic attention processing on the original features of the hyperspectral image to obtain probabilistic attention features; An adaptive feature fusion unit is used to perform adaptive feature fusion on the deterministic attention features and the probabilistic attention features to obtain the fused features; The classifier is used to classify the fused features and obtain classification prediction results.
9. The hyperspectral image classification model based on certainty dual attention according to claim 8 is characterized in that The deterministic attention unit includes: The discriminant feature extraction subunit is used to perform feature transformation on the original features of the hyperspectral image according to a discriminant feature transformation matrix to obtain discriminant features of the spectral dimension; Deterministic weighted attention calculation subunit: used to perform deterministic attention weight processing on the discriminative features to obtain deterministic weighted attention; A deterministic spectral dimension feature calculation subunit is configured to perform feature enhancement on the original feature according to the deterministic weighted attention and a spectral scaling parameter to obtain an enhanced deterministic spectral dimension feature; A deterministic spatial dimension feature calculation subunit is configured to perform feature enhancement on the original feature according to the deterministic weighted attention and a spatial scaling parameter to obtain an enhanced deterministic spatial dimension feature; The first feature splicing subunit is used to splice the enhanced deterministic spectral dimension features and the deterministic enhanced spatial dimension features to obtain the deterministic attention features.
10. The hyperspectral image classification model based on certainty dual attention according to claim 9 is characterized in that The probabilistic attention unit includes: The probabilistic feature extraction subunit is used to perform feature transformation on the original features of the hyperspectral image according to a probabilistic feature transformation matrix to obtain probabilistic features of the spectral dimension; The probabilistic weighted attention calculation subunit performs probabilistic attention weight processing on the probabilistic feature according to a temperature parameter to obtain probabilistic weighted attention; The uncertainty spectrum dimension feature calculation subunit is used to enhance the original feature according to the probabilistic weighted attention and an uncertainty spectrum scaling parameter to obtain an enhanced uncertainty spectrum dimension feature; The uncertainty space dimension feature calculation subunit performs feature enhancement on the original feature according to the deterministic weighted attention and an uncertainty space scaling parameter to obtain an enhanced uncertainty space dimension feature; The second feature splicing subunit: splices the enhanced uncertainty spectral dimension features and the enhanced uncertainty spatial dimension features to obtain probabilistic attention features.