Hyperspectral image classification method based on spectrum enhanced cyclic consistency Transform

By designing a spectrum-enhanced cycle consistency Transformer model in hyperspectral image classification, and combining spectral and spatial feature extraction, the receptive field and computational complexity problems of the convolutional neural network and Transformer methods in classification are solved, and higher classification is achieved. accuracy and robustness.

CN118781384AActive Publication Date: 2024-10-15HOHAI UNIV

Patent Information

Application Number
CN202410740781.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-07
Publication Date
2024-10-15
Estimated Expiration
2044-06-07

AI Technical Summary

Technical Problem

Existing hyperspectral image classification methods cannot effectively obtain long-distance pixel spatial relationships due to the limited receptive field of the convolution kernel of the convolutional neural network, and the Transformer-based method cannot distinguish between pixels that are beneficial or useless for classification during feature aggregation, resulting in The classification robustness and accuracy are insufficient, and the computational complexity is high.

Method used

Design a hyperspectral image classification method based on the spectral enhancement cycle consistency Transformer. The spectrum enhancement module extracts spectral features, the cycle consistency Transformer module extracts global spatial features, and the two-dimensional convolution module extracts local spatial features and fuses them to improve classification. accuracy.

Benefits of technology

It improves the accuracy and robustness of hyperspectral image classification, reduces computational cost and memory consumption, and effectively utilizes global and local spatial information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118781384A_ABST
    Figure CN118781384A_ABST
Patent Text Reader

Abstract

The invention discloses a hyperspectral image classification method based on a spectrum enhanced cyclic consistency Transform. The method comprises the following steps: firstly, designing a spectrum enhancement module, and introducing three-dimensional convolution to extract image enhanced spectrum features; secondly, designing a global spatial feature extraction module, introducing a cyclic consistency thought into a hyperspectral image classification Transform model, and encoding global features by aggregating related context information of images to obtain global spatial features of the images; then, in order to make up for the defect that local spatial information of the hyperspectral image is easy to lose, a local spatial feature extraction module is constructed, and spatial association between local pixels is obtained through two-dimensional convolution; and finally, designing a feature fusion and classification module, fusing the global features and the local features, and predicting the ground feature category of each pixel by using a Softmax classifier. The method designed by the invention can fully extract spectral and spatial information of the hyperspectral image, and has good performance in hyperspectral image classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of remote sensing image processing, and in particular relates to a hyperspectral image classification method based on spectrally enhanced cycle-consistent Transformer. Background Art

[0002] Hyperspectral image classification is an important research topic in the field of remote sensing and can be widely used in many fields such as land use and analysis, environmental monitoring, military defense, etc. Traditional hyperspectral image classification methods are based on machine learning models, and representative algorithms include support vector machines, k-nearest neighbors, sparse representation, random forests, etc. However, these methods are extremely dependent on manually extracted low-level features, have poor generalization, and often require different parameter settings for different data sets.

[0003] In recent years, deep learning has made significant breakthroughs in many computer vision tasks. Deep learning can extract different levels of features from raw hyperspectral images through a series of hierarchical structures, and has strong data fitting and representation capabilities. At present, hyperspectral image classification methods based on deep learning mainly include classification methods based on stacked autoencoders, classification methods based on convolutional neural networks, and classification methods based on Transformers.

[0004] The hyperspectral image classification method combining pyramid multi-scale convolution and self-attention proposed in Publication No. CN116310572A includes: segmenting the hyperspectral image based on data cube; extracting the image spectral feature map using a spectral feature extraction network from the segmented image; further extracting the image spatial feature map using a spatial feature extraction network based on the spectral feature map; and generating classification results from the spatial feature map through a classification network. This method directly uses a convolutional neural network for feature extraction. Due to the limited receptive field of the convolution kernel, it is impossible to effectively obtain the long-distance pixel spatial relationship of the hyperspectral image, which ultimately limits the classification performance.

[0005] Zhang et al. published a paper titled "Hyperspectral image classification method based on hierarchical transformer network" in Acta Geodaetica et Cartographica Sinica in 2023. The paper proposed a hierarchical fusion hyperspectral image classification network based on self-attention mechanism, designed a skip-layer self-attention module for feature learning, and used self-attention mechanism to make feature learning more focused on effective information. However, this method did not take targeted measures to focus on features that are beneficial to classification. Therefore, it performed generally in terms of robustness and accuracy of hyperspectral image classification.

[0006] In summary, the current hyperspectral image classification methods have many limitations, mainly manifested in:

[0007] (1) The convolutional neural network convolution kernel has a limited receptive field and cannot focus on the long-distance relationship between distant pixels. The weight sharing feature of the convolution kernel results in the same weight for each convolution kernel during the convolution process, so the boundary capture capability is weak in the feature extraction stage.

[0008] (2) When hyperspectral training samples are extremely limited, the network model needs to pay more attention to pixels that are beneficial to classification. However, the existing Transformer method does not consider distinguishing pixels that are beneficial or not beneficial to classification during feature aggregation through attention, resulting in poor classification robustness. At the same time, the self-attention mechanism in the Transformer has high computational complexity, and the complexity increases exponentially when the sequence length increases. When applied to hyperspectral image classification tasks, if spectral and spatial features are extracted at the same time, the length of the input sequence will be very large, resulting in a significant increase in computational cost and memory consumption. Finally, the current Transformer-based model only establishes global dependencies, while ignoring local spatial information that is also useful for classification.

[0009] To solve the above problems, the present invention proposes a hyperspectral image classification method based on spectrally enhanced cycle-consistent Transformer. The method designs a spectral enhancement module to enhance the spectral features of the image; constructs a cycle-consistent Transformer module to extract long-distance spatial features; designs a local spatial feature extraction module based on two-dimensional convolution to extract local spatial features; finally, the global and local features are fused to accurately predict the ground object category of each pixel. Summary of the invention

[0010] Purpose of the invention: The present invention provides a hyperspectral image classification method based on spectrally enhanced cycle-consistent Transformer, which is used to solve the problems that when existing convolutional neural networks and Transformer-based methods are used in hyperspectral image classification tasks, they do not explicitly filter or ignore pixels that are useless for classification or even cause interference, and the computational complexity is high and the characteristic mode is relatively single, which limits the classification performance.

[0011] Technical solution: To achieve the purpose of the present invention, the present invention adopts the following technical solution:

[0012] The hyperspectral image classification method based on spectrally enhanced cycle-consistent Transformer proposed in the present invention comprises the following steps:

[0013] (1) Construct a hyperspectral image classification dataset and divide it into training set, validation set and test set; design a principal component analysis preprocessing module to perform band dimensionality reduction on the original hyperspectral image to reduce redundant spectral bands;

[0014] (2) Build a spectral enhancement cycle consistency Transformer model, which mainly includes four parts: spectral enhancement module, global spatial feature extraction module, local spatial feature extraction module, and feature fusion and classification module;

[0015] (3) inputting the training set and the validation set in step (1) into the spectral enhancement module in step (2) and extracting image-enhanced spectral features using three-dimensional convolution;

[0016] (4) Design a global spatial feature extraction module, introduce the cycle consistency idea into the hyperspectral image classification Transformer model, encode the global features by aggregating the relevant context information of the image, and obtain the global spatial features of the image;

[0017] (5) In order to make up for the defect that local spatial information of hyperspectral images is easily lost, a local spatial feature extraction module is constructed to obtain the spatial correlation between local pixels through two-dimensional convolution;

[0018] (6) Designing a feature fusion and classification module to fuse the global features obtained in step (4) with the local features obtained in step (5), and the fused features are used to train the entire spectrally enhanced cycle-consistent Transformer network model;

[0019] (7) Input the test set into the network model trained in step (6), use the Softmax classifier to predict the object category of each pixel, and obtain the final classification result.

[0020] The method of constructing a hyperspectral image classification data set and designing a principal component analysis preprocessing module in step (1) is as follows:

[0021] (1.1) Obtain the original hyperspectral image dataset from a public website and construct a training sample set as follows: For this dataset, select a labeled pixels for each class;

[0022] (1.2) A total of m (m = N × a, where N represents the number of sample categories) labeled pixels selected from all classes are used as a training set to train the network model, and the same number of labeled pixels are used as a validation set to further adjust the model parameters, while all unlabeled sample pixels are used as a test set;

[0023] (1.3) Design the principal component analysis preprocessing module for the original hyperspectral image (where H is height, W is width, and B is the number of original bands) to perform band dimensionality reduction. The image after dimensionality reduction is represented as (Z represents the number of bands after dimensionality reduction, and Z<B).

[0024] Among them, in step (2), building a spectral enhancement cycle consistency Transformer model mainly includes four parts: spectral enhancement module, global spatial feature extraction module, local spatial feature extraction module, feature fusion and classification module.

[0025] In step (3), the method of building a spectrum enhancement module and extracting image enhanced spectrum features using three-dimensional convolution is as follows:

[0026] (3.1) For the Process it and divide it into several image blocks of size P×P for feature extraction in the subsequent three-dimensional convolutional layer;

[0027] (3.2) Define a three-dimensional convolution layer 1, whose convolution kernel size is 1×1×5 and stride is 1; then set a batch normalization layer and an activation function layer, where the activation function is set to ReLU;

[0028] (3.3) Define a three-dimensional convolution layer 2, whose convolution kernel size is 1×1×3 and step size is 1; then set a batch normalization layer and an activation function layer, where the activation function is set to ReLU;

[0029] (3.4) The output features obtained by (3.2) and the output features obtained by (3.3) are connected through the concatenate function to form a feature map, which serves as the input of the three-dimensional convolution layer 3 in (3.5);

[0030] (3.5) Define a three-dimensional convolution layer 3, whose convolution kernel size is 1×1×3 and step size is 1; then set a batch normalization layer and an activation function layer, where the activation function is set to ReLU; get the output feature map of the final spectral enhancement module Among them, P, P, D, and C represent the width, height, depth, and number of channels of the feature map respectively.

[0031] Among them, in step (4), a global spatial feature extraction module is designed, and the cycle consistency idea is introduced into the hyperspectral image classification Transformer model. The global features are encoded by aggregating the relevant context information of the image to obtain the global spatial features of the image as follows:

[0032] (4.1) The output result H of step (3) SPE Flatten and linearly map to transform into a sequence vector Where U = D × C represents the dimension of the feature; X seqInput cycle consistency Transformer module to extract global spatial features;

[0033] (4.2) The cycle-consistent Transformer module in step (4.1) includes a self-alignment submodule and a traditional ViT encoder. The self-alignment submodule can selectively receive information from contexts that are more consistent with the target pixel, thereby effectively aggregating the global context and enhancing the effectiveness of the features. The design idea of ​​the self-alignment module is as follows:

[0034] (4.2.1) First, calculate the consistent pixels and attention weights that are beneficial to the information aggregation of the target pixel. The specific formula is as follows:

[0035] Δ=f(Q+C)

[0036] A=g(Q+C)

[0037] in, represents the predicted consistent pixels, represents the attention weight, P represents the number of aggregated pixels, Q represents the query vector in Transformer, and C represents the position encoding information; f(·) and g(·) represent two fully connected layers, which are used to predict the offset and attention weight values ​​respectively;

[0038] (4.2.2) Calculate the self-attention in the self-alignment module. The specific formula is as follows:

[0039]

[0040] Among them, r∈{0, 1, ..., HW} represents the index of the flattened feature, V represents the numerical vector in Transformer, and ζ represents the Softmax function;

[0041] (4.2.3) Calculate multi-head attention based on self-attention And perform layer normalization to obtain The specific formula is as follows:

[0042] H MSA =concat(PredAtten(Q1, V1),..., PredAtten(Q HW , V HW ))

[0043] H LN =LN(H MSA )

[0044] Among them, LN(·) represents layer normalization processing;

[0045] (4.2.4) The H obtained in step (4.2.3)MSA The input feature X of the self-alignment module obtained in step (4.1) seq Perform element-wise addition in the following form to obtain the output features of the self-alignment module

[0046] H OUT =LN(MLP(X seq +H LN ))+X seq +H LN

[0047] Where MLP(·) represents a multi-layer perceptron;

[0048] (4.3) The feature H obtained by the self-alignment module OUT After passing through the traditional ViT encoder, the output features of the cycle-consistent Transformer module are obtained. The present invention uses two cycle-consistent Transformer modules with the same structure to extract global spatial features, and finally obtains the global spatial features of the image.

[0049] Among them, in step (5), in order to make up for the defect that local spatial information of hyperspectral images is easily lost, a local spatial feature extraction module is constructed, and the method of obtaining the spatial correlation between local pixels through two-dimensional convolution is as follows:

[0050] (5.1) Design a two-dimensional convolution layer 1 with a convolution kernel size of 3×3 and a stride of 1; then set a batch normalization layer and an activation function layer, where the activation function is set to ReLU;

[0051] (5.2) Design a two-dimensional convolution layer 2 with a convolution kernel size of 3×3 and a step size of 1; then set a batch normalization layer and an activation function layer, where the activation function is set to ReLU;

[0052] (5.3) Design a two-dimensional convolution layer 3, whose convolution kernel size is 3×3 and step size is 1; then set a batch normalization layer and an activation function layer, where the activation function is set to ReLU; get the final local spatial feature map Among them, P, P, C represent the feature map H LSA The width, height, and number of channels.

[0053] Among them, in step (6), the method of designing a feature fusion and classification module, fusing the global features obtained in step (4) with the local features obtained in step (5), and using the fused features to train the entire spectral enhanced cycle consistency Transformer network model is as follows:

[0054] (6.1) The global spectral spatial feature H output from step (4)GSA Perform dimension conversion processing and transform it into a three-dimensional form with the same spatial size as the original image block through matrix reshaping Where P, P, C′ represent the feature map H ′GSA The width, height, and number of channels;

[0055] (6.2) H′ GSA And the local spatial feature H obtained in step (5) LSA Connect them through the concatenate function to get the fusion features

[0056] H ffusion =concat(H′ GSA , H LSA )

[0057] (6.3) The fused feature H obtained from (6.2) fusion After flattening, it is sent to two fully connected layers for nonlinear feature extraction to further integrate feature information. The specific formula is as follows:

[0058] H out =W2ReLU(W1flatten(H fusion )+b1)+b2

[0059] in, are the weight matrices of the two fully connected layers, fl = P × P × (C + C′), r represents the dimensionality reduction ratio, N represents the number of sample categories, b1 and b2 represent biases, and flatten(·) represents the flattening operation.

[0060] Among them, in step (7), the method for constructing a Softmax classifier is as follows:

[0061]

[0062] Among them, y i ,y j represents the i-th and j-th samples in the input feature, e represents a constant, N represents the number of sample categories, S i It represents the probability that the input sample belongs to the i-th category.

[0063] Compared with the prior art, the present invention adopts the above technical solution and has the following technical effects:

[0064] This paper proposes a spectral enhancement cycle-consistent Transformer model for the hyperspectral image classification problem. The model first designs a spectral enhancement module to effectively extract discriminative spectral features, then constructs a cycle-consistent Transformer module to extract global spatial features, then designs a local spatial feature extraction module based on two-dimensional convolution to extract local features, and finally fuses local features with global features for accurate classification. Experiments show that the model proposed in this paper performs well when applied to hyperspectral image classification tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] Figure 1 It is a framework diagram of the method of the present invention;

[0066] Figure 2 Schematic diagram of the cycle-consistent Transformer module. DETAILED DESCRIPTION

[0067] The effects of the present invention are further described in detail below with reference to the accompanying drawings and specific embodiments.

[0068] like Figure 1 As shown, the specific implementation steps of the hyperspectral image classification method based on spectral enhanced cycle consistency Transformer of the present invention are as follows:

[0069] (1) Construct a hyperspectral image classification dataset and divide it into training set, validation set and test set. Design a principal component analysis preprocessing module to perform band dimensionality reduction on the original hyperspectral image to reduce redundant spectral bands.

[0070] (1.1) The public hyperspectral image classification dataset XuZhou is selected for the experiment. This dataset contains 9 types of ground objects, with a size of 500×260 and 436 available spectral bands. The training sample set is constructed as follows: for this dataset, 5 labeled pixels are selected for each class;

[0071] (1.2) A total of 45 labeled pixels from all classes are selected as training sets to train the network model, and the same number of labeled pixels are used as validation sets to further adjust the model parameters, while all unlabeled sample pixels are used as test sets;

[0072] (1.3) Design the principal component analysis preprocessing module for the original hyperspectral image Perform band dimensionality reduction, and the image after dimensionality reduction is represented as

[0073] (2) Build a spectral enhancement cycle consistency Transformer model, which mainly includes four parts: spectral enhancement module, global spatial feature extraction module, local spatial feature extraction module, and feature fusion and classification module;

[0074] (3) inputting the training set and the validation set in step (1) into the spectral enhancement module in step (2) and extracting image-enhanced spectral features using three-dimensional convolution;

[0075] (3.1) For the Process it and divide it into several image blocks of size P×P (P=9) for feature extraction in the subsequent three-dimensional convolutional layer;

[0076] (3.2) Define a three-dimensional convolution layer 1, whose convolution kernel size is 1×1×5 and stride is 1; then set a batch normalization layer and an activation function layer, where the activation function is set to ReLU;

[0077] (3.3) Define a three-dimensional convolution layer 2, whose convolution kernel size is 1×1×3 and step size is 1; then set a batch normalization layer and an activation function layer, where the activation function is set to ReLU;

[0078] (3.4) The output features obtained by (3.2) and the output features obtained by (3.3) are connected through the concatenate function to form a feature map, which serves as the input of the three-dimensional convolution layer 3 in (3.5);

[0079] (3.5) Define a three-dimensional convolution layer 3, whose convolution kernel size is 1×1×3 and step size is 1; then set a batch normalization layer and an activation function layer, where the activation function is set to ReLU; get the output feature map of the final spectral enhancement module Among them, P, P, D, and C represent the width, height, depth, and number of channels of the feature map respectively.

[0080] (4) Design a global spatial feature extraction module, introduce the cycle consistency idea into the hyperspectral image classification Transformer model, encode the global features by aggregating the relevant context information of the image, and obtain the global spatial features of the image;

[0081] (4.1) The output result H of step (3) SPE Flatten and linearly map to transform into a sequence vector Where U = D × C represents the dimension of the feature; X seq Input cycle consistency Transformer module to extract global spatial features;

[0082] (4.2) As attached Figure 2As shown in Figure 4, the cycle-consistent Transformer module in step (4.1) includes a self-alignment submodule and a traditional ViT encoder. The self-alignment submodule can selectively receive information from contexts that are more consistent with the target pixel, thereby effectively aggregating the global context and enhancing the effectiveness of the features. The design idea of ​​the self-alignment module is as follows:

[0083] (4.2.1) First, calculate the consistent pixels and attention weights that are beneficial to the information aggregation of the target pixel. The specific formula is as follows:

[0084] Δ=f(Q+C)

[0085] A=g(Q+C)

[0086] in, represents the predicted consistent pixels, represents the attention weight, P represents the number of aggregated pixels, Q represents the query vector in Transformer, and C represents the position encoding information; f(·) and g(·) represent two fully connected layers, which are used to predict the offset and attention weight values ​​respectively;

[0087] (4.2.2) Calculate the self-attention in the self-alignment module. The specific formula is as follows:

[0088]

[0089] Among them, r∈{0, 1,..., HW} represents the index of the flattened feature, V represents the numerical vector in Transformer, and ζ represents the Softmax function;

[0090] (4.2.3) Calculate multi-head attention based on self-attention And perform layer normalization to obtain The specific formula is as follows:

[0091] H MSA =concat(PredAtten(Q1,V1),...,PredAtten(Q HW , V HW ))

[0092] H LN =LN(H MSA )

[0093] Among them, LN(·) represents layer normalization processing;

[0094] (4.2.4) The H obtained in step (4.2.3) MSA The input feature X of the self-alignment module obtained in step (4.1) seqPerform element-wise addition in the following form to obtain the output features of the self-alignment module

[0095] H OUT =LN(MLP(X seq +H LN ))+X seq +H LN

[0096] Where MLP(·) represents a multi-layer perceptron;

[0097] (4.3) The feature H obtained by the self-alignment module OUT After passing through the traditional ViT encoder, the output features of the cycle-consistent Transformer module are obtained. The present invention uses two cycle-consistent Transformer modules with the same structure to extract global spatial features, and finally obtains the global spatial features of the image.

[0098] (5) In order to make up for the defect that local spatial information of hyperspectral images is easily lost, a local spatial feature extraction module is constructed to obtain the spatial correlation between local pixels through two-dimensional convolution;

[0099] (5.1) Design a two-dimensional convolution layer 1 with a convolution kernel size of 3×3 and a stride of 1; then set a batch normalization layer and an activation function layer, where the activation function is set to ReLU;

[0100] (5.2) Design a two-dimensional convolution layer 2 with a convolution kernel size of 3×3 and a step size of 1; then set a batch normalization layer and an activation function layer, where the activation function is set to ReLU;

[0101] (5.3) Design a two-dimensional convolution layer 3, whose convolution kernel size is 3×3 and step size is 1; then set a batch normalization layer and an activation function layer, where the activation function is set to ReLU; get the final local spatial feature map Among them, P, P, C represent the feature map H LSA The width, height, and number of channels.

[0102] (6) Designing a feature fusion and classification module to fuse the global features obtained in step (4) with the local features obtained in step (5), and the fused features are used to train the entire spectrally enhanced cycle-consistent Transformer network model;

[0103] (6.1) The global spectral spatial feature H output from step (4) GSA Perform dimension conversion processing and transform it into a three-dimensional form with the same spatial size as the original image block through matrix reshaping Where P, P, C′ represent the feature map H′ respectively.GSA The width, height, and number of channels;

[0104] (6.2) H′ GSA And the local spatial feature H obtained in step (5) LSA Connect them through the concatenate function to get the fusion features

[0105] H fusion =concat(H′ GSA , H LSA )

[0106] (6.3) The fused feature H obtained from (6.2) fusion After flattening, it is sent to two fully connected layers for nonlinear feature extraction to further integrate feature information. The specific formula is as follows:

[0107] H out =W2ReLU(W1flatten(H fusion )+b1)+b2

[0108] in, are the weight matrices of two fully connected layers, fl = P × P × (C + C′), r represents the dimensionality reduction ratio (16 in the experiment of the present invention), N represents the number of sample categories (the number of categories in the XuZhou dataset is 9), b1 and b2 represent biases, and flatten(·) represents the flattening operation.

[0109] (7) Input the test set into the network model trained in step (6), and use the Softmax classifier to predict the object category of each pixel to obtain the final classification result. The method for constructing the Softmax classifier is as follows:

[0110]

[0111] Among them, y i ,y j represents the i-th and j-th samples in the input feature, e represents a constant, N represents the number of sample categories, S i It represents the probability that the input sample belongs to the i-th category.

[0112] During the experiment, the learning rate was set to 0.001, the number of iterations was 200, and the batch size was set to 32. The number of cycle-consistent Transformer modules was set to 2, of which the number of heads of the multi-head self-attention mechanism was set to 4. The drop rate of the MLP in the feature fusion module was set to 0.3.

[0113] The present invention uses two different hyperspectral remote sensing image classification methods to compare with the proposed method. The comparison methods used are:

[0114] The hyperspectral remote sensing image classification method based on S3Net proposed by Xue et al. in "S3Net: Spectral-Spatial Siamese Network for Few-Shot Hyperspectral Image Classification[J].IEEE Transactions on Geoscience and Remote Sensing, 2022." is referred to as Method 1.

[0115] The hyperspectral remote sensing image classification method based on SS-MTR proposed by Huang et al. in "Spectral-Spatial Masked Transformer With Supervised and Contrastive Learning for Hyperspectral Image Classification[J].IEEE Transactions on Geoscience and Remote Sensing, 2023." is referred to as Method 2.

[0116] Table 1 is a performance comparison of the three methods on the three indicators of overall classification accuracy (OA), average classification accuracy (AA), and Kappa coefficient on the public hyperspectral remote sensing image classification dataset XuZhou. Among them, the closer the OA index is to 1, the better the overall classification effect is; the closer the AA index is to 1, the better the classification balance of each category is; the Kappa coefficient index is between -1 and 1, and the closer it is to 1, the better the overall performance of the classification algorithm is. It can be seen that the method proposed in the present invention has the best classification effect on hyperspectral remote sensing images.

[0117] Table 1 Performance comparison of three methods on XuZhou dataset

[0118] Performance Indicators Method 1 Method 2 Method of the present invention OA (%) 82.07 87.76 93.74 AA(%) 83.98 87.46 94.65 Kappa coefficient (%) 77.60 84.68 92.32

Claims

1. Hyperspectral image classification method based on spectrally enhanced cycle-consistent Transformer, It is characterized in that The following steps are involved: (1) Construct a hyperspectral image classification dataset and divide it into training set, validation set and test set; design a principal component analysis preprocessing module to perform band dimensionality reduction on the original hyperspectral image to reduce redundant spectral bands; (2) Build a spectral enhancement cycle consistency Transformer model, which mainly includes four parts: spectral enhancement module, global spatial feature extraction module, local spatial feature extraction module, and feature fusion and classification module; (3) inputting the training set and the validation set in step (1) into the spectral enhancement module in step (2) and extracting image-enhanced spectral features using three-dimensional convolution; (4) Design a global spatial feature extraction module, introduce the cycle consistency idea into the hyperspectral image classification Transformer model, encode the global features by aggregating the relevant context information of the image, and obtain the global spatial features of the image; (5) In order to make up for the defect that local spatial information of hyperspectral images is easily lost, a local spatial feature extraction module is constructed to obtain the spatial correlation between local pixels through two-dimensional convolution; (6) Designing a feature fusion and classification module to fuse the global features obtained in step (4) with the local features obtained in step (5), and the fused features are used to train the entire spectrally enhanced cycle-consistent Transformer network model; (7) Input the test set into the network model trained in step (6), use the Softmax classifier to predict the object category of each pixel, and obtain the final classification result.

2. According to the hyperspectral image classification method based on spectral enhanced cycle-consistent Transformer of claim 1, in step (1), the method of constructing a hyperspectral image classification dataset and designing a principal component analysis preprocessing module is as follows: (1.1) Obtain the original hyperspectral image dataset from a public website and construct a training sample set as follows: For this dataset, select a labeled pixels for each class; (1.2) A total of m (m = N × a, where N represents the number of sample categories) labeled pixels selected from all classes are used as a training set to train the network model, and the same number of labeled pixels are used as a validation set to further adjust the model parameters, while all unlabeled sample pixels are used as a test set; (1.3) Design a principal component analysis preprocessing module for the original hyperspectral image ( in, H represents height, W represents width, and B represents the number of original bands) to perform band dimensionality reduction. The image after dimensionality reduction is represented as (Z represents the number of bands after dimensionality reduction, and Z <B)。 3. According to the hyperspectral image classification method based on spectral enhancement cycle-consistent Transformer of claim 1, in step (2), a spectral enhancement cycle-consistent Transformer model is built, which mainly includes four parts: spectral enhancement module, global spatial feature extraction module, local spatial feature extraction module, and feature fusion and classification module.

4. According to the hyperspectral image classification method based on spectral enhancement cycle-consistent Transformer of claim 1, in step (3), the method of building a spectral enhancement module and extracting image enhancement spectral features using three-dimensional convolution is as follows: (3.1) For the Process it and divide it into several image blocks of size P×P for feature extraction in the subsequent three-dimensional convolutional layer; (3.2) Define a three-dimensional convolution layer 1, whose convolution kernel size is 1×1×5 and stride is 1; then set a batch normalization layer and an activation function layer, where the activation function is set to ReLU; (3.3) Define a three-dimensional convolution layer 2, whose convolution kernel size is 1×1×3 and step size is 1; then set a batch normalization layer and an activation function layer, where the activation function is set to ReLU; (3.4) The output features obtained by (3.2) and the output features obtained by (3.3) are connected through the concatenate function to form a feature map, which serves as the input of the three-dimensional convolution layer 3 in (3.5); (3.5) Define a three-dimensional convolution layer 3, whose convolution kernel size is 1×1×3 and step size is 1; then set a batch normalization layer and an activation function layer, where the activation function is set to ReLU; Get the output feature map of the final spectral enhancement module Among them, P, P, D, and C represent the width, height, depth, and number of channels of the feature map respectively.

5. According to the hyperspectral image classification method based on spectral enhanced cycle consistency Transformer of claim 1, in step (4), a global spatial feature extraction module is designed, the cycle consistency concept is introduced into the hyperspectral image classification Transformer model, and the global feature is encoded by aggregating the relevant context information of the image to obtain the method of global spatial feature of the image as follows: (4.1) The output result H of step (3) SPE Flatten and linearly map to transform into a sequence vector Where U = D × C represents the dimension of the feature; X seq Input cycle consistency Transformer module to extract global spatial features; (4.2) The cycle-consistent Transformer module in step (4.1) consists of a self-alignment submodule and a traditional ViT encoder. in, The self-alignment submodule can selectively receive information from contexts that are more consistent with the target pixel, thereby effectively aggregating the global context and enhancing the effectiveness of the features. The design ideas of the self-alignment module are as follows: (4.2.1) First, calculate the consistent pixels and attention weights that are beneficial to the information aggregation of the target pixel. The specific formula is as follows: Δ=f(Q+C), A=g(Q+C) in, represents the predicted consistent pixels, represents the attention weight, P represents the number of aggregated pixels, Q represents the query vector in Transformer, and C represents the position encoding information; f(·) and g(·) represent two fully connected layers, which are used to predict the offset and attention weight values ​​respectively; (4.2.2) Calculate the self-attention in the self-alignment module. The specific formula is as follows: Among them, r∈{0, 1,…, HW} represents the index of the flattened feature, V represents the numerical vector in Transformer, and ζ represents the Softmax function; (4.2.3) Calculate multi-head attention based on self-attention And perform layer normalization to obtain The specific formula is as follows: H MSA =concat(PredAtten(Q 1 ,V 1 ),...,PredAtten(Q HW ,V HW )) A LN =LN(H MSA ) Among them, LN(·) represents layer normalization processing; (4.2.4) The H obtained in step (4.2.3) MSA The input feature X of the self-alignment module obtained in step (4.1) seq Perform element-wise addition in the following form to obtain the output features of the self-alignment module H OUT =LN(MLP(X seq +H LN ))+X seq +H LN Among them, MLP(·) represents a multi-layer perceptron: (4.3) The feature H obtained by the self-alignment module OUT After passing through the traditional ViT encoder, the output features of the cycle-consistent Transformer module are obtained. The present invention uses two cycle-consistent Transformer modules with the same structure to extract global spatial features, and finally obtains the global spatial features of the image.

6. According to the hyperspectral image classification method based on spectral enhanced cycle-consistent Transformer of claim 1, in step (5), in order to compensate for the defect that local spatial information of hyperspectral images is easily lost, a local spatial feature extraction module is constructed, and the method of obtaining the spatial correlation between local pixels by two-dimensional convolution is as follows: (5.1) Design a two-dimensional convolution layer 1 with a convolution kernel size of 3×3 and a stride of 1; then set a batch normalization layer and an activation function layer, where the activation function is set to ReLU; (5.2) Design a two-dimensional convolution layer 2 with a convolution kernel size of 3×3 and a step size of 1; then set a batch normalization layer and an activation function layer, where the activation function is set to ReLU; (5.3) Design a two-dimensional convolution layer 3, whose convolution kernel size is 3×3 and step size is 1; then set a batch normalization layer and an activation function layer, where the activation function is set to ReLU; get the final local spatial feature map in, P, P, C represent the feature map H LSA The width, height, and number of channels.

7. According to the hyperspectral image classification method based on spectrally enhanced cycle-consistent Transformer of claim 1, in step (6), a feature fusion and classification module is designed to fuse the global features obtained in step (4) with the local features obtained in step (5), and the fused features are used to train the entire spectrally enhanced cycle-consistent Transformer network model as follows: (6.1) The global spectral spatial feature H output from step (4) GSA Perform dimension conversion processing and transform it into a three-dimensional form with the same spatial size as the original image block through matrix reshaping Where P, P, C′ represent the feature map H′ respectively. GSA The width, height, and number of channels; (6.2) H′ GSA And the local spatial feature H obtained in step (5) LSA Connect them through the concatenate function to get the fusion features H fusion =concat(H′ GSA ,H LSA ) (6.3) The fused feature H obtained from (6.2) fusion After flattening, it is sent to two fully connected layers for nonlinear feature extraction to further integrate feature information. The specific formula is as follows: A out =W 2 ReLU(W 1 flatten(H fusion )+b 1 )+b 2 in, is the weight matrix of the two fully connected layers, fl = P × P × (C + C ′), r represents the dimensionality reduction ratio, N represents the number of sample categories, b 1 , b 2 represents the bias, and flatten(·) represents the flattening operation.

8. According to the hyperspectral image classification method based on spectral enhanced cycle-consistent Transformer of claim 1, in step (7), the method of constructing the Softmax classifier is as follows: in, y i ,y j represents the i-th and j-th samples in the input feature, e represents a constant, N represents the number of sample categories, S i It represents the probability that the input sample belongs to the i-th category.

Citation Information

Patent Citations

  • Ground feature classification method based on spectral space fusion Transform feature extraction

    CN116229153A

  • Unsupervised panchromatic sharpening method based on dual cycle consistency

    CN117152006A

  • Hyperspectral image classification method based on Transform and non-local neural network double-branch architecture

    CN117218537A

Cited By

  • Hyperspectral image classification method based on spectral feature reconstruction

    CN120356015A

  • A hyperspectral image classification method based on spectral feature reconstruction

    CN120356015B

  • Plant category determination method based on multispectral image

    CN120599457A

  • A plant class determination method based on multispectral images

    CN120599457B

  • Germplasm vigor detection method, device and equipment based on hyperspectral imaging and medium

    CN121366361A