Small sample hyperspectral image classification method based on double-branch Transform

By introducing dual-branch Transformer and unsupervised mask learning into hyperspectral image classification, combined with contrastive learning and graph convolution, the problem of limited performance in small-sample hyperspectral image classification is solved, and classification effects with high accuracy and low computational cost are achieved. .

CN118691884APending Publication Date: 2024-09-24XI'AN UNIVERSITY OF ARCHITECTURE AND TECHNOLOGY
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410792277.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-19
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

Existing hyperspectral image classification methods have limited performance in the case of small samples and require a large number of labeled samples for training, resulting in high computational costs and difficulty in field application.

Method used

A small-sample hyperspectral image classification method based on dual-branch Transformer is used, combined with unsupervised mask learning and contrastive learning, to construct a lightweight mask autoencoder through graph convolution and principal component analysis to reduce the impact of irrelevant bands and utilize support Vector machines are fine-tuned.

Benefits of technology

In the case of small samples, the classification performance is improved, the calculation cost is reduced, and high-precision ground object classification is achieved, while reducing the impact on irrelevant bands.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118691884A
    Figure CN118691884A
Patent Text Reader

Abstract

The invention discloses a small sample hyperspectral image classification method based on a double-branch Transform. The method comprises the following steps: 1, carrying out the classification of a hyperspectral image; the method comprises the following steps: step 1, respectively inputting unmarked hyperspectral image data into two different mask self-coding modules: a graph convolution-based mask self-coding module (GMA) and a principal component analysis-based mask self-coding module (PMA), and then carrying out unsupervised pre-training; step 2, taking coding parts of the pre-trained GMA and PMA in the step 1 as feature extractors, and putting the feature extractors into a designed comparison framework to continue pre-training so as to further enhance the discrimination of features; step 3, extracting the pre-trained model in the step 2, inputting the hyperspectral image into the pre-trained model, and obtaining features; and step 4, inputting the features obtained in the step 3 into a classifier support vector machine (SVM), outputting a prediction classification result through the SVM, and realizing accurate classification of the ground features. According to the method, wave band selection based on graph convolution is fused into view construction, and the influence of irrelevant wave bands is relieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of remote sensing image processing, and in particular to a small sample hyperspectral image classification method based on a dual-branch Transformer. Background Art

[0002] Hyperspectral images (HSI) are acquired by hyperspectral sensors (such as AVIRIS). Compared with RGB images, HSI contains rich spectral and spatial information and has great advantages in ground object classification. Currently, HSI has been applied to fields such as earth monitoring, agricultural management and medical analysis. HSI provides rich information, but it also brings many challenges to Hyperspectral Image Classification (HSIC), such as high-dimensional data and sample imbalance.

[0003] Traditional HSIC methods mainly focus on utilizing the spectral features of HSI, such as support vector machines (SVM), random forests (RF) and K nearest neighbor algorithms (KNN). Although these methods are computationally efficient, they usually rely on manually designed features and have limited performance. Supervised deep learning methods usually use multi-layer networks to automatically learn high-level features from labeled data. In recent years, they have made significant progress in HSIC, but they often need to rely on a large number of labeled samples (more than 20%-30%) to train to achieve advanced performance. However, obtaining a large number of labeled samples is still time-consuming and labor-intensive, which is a huge obstacle to the field application of HSIC. Summary of the invention

[0004] In order to overcome the problems existing in the above prior art, the purpose of the present invention is to provide a small sample hyperspectral image classification method based on a dual-branch Transformer. First, the unsupervised mask learning method is introduced into the hyperspectral field to strengthen the model's learning of important features in the data. Second, the unsupervised mask learning is combined with contrastive learning, which can achieve unsupervised feature learning on the one hand, and enhance the discriminability of features on the other hand. Third, a lightweight mask autoencoder is constructed, which keeps the method high in precision while having a low computational cost. In addition, the band selection based on graph convolution is integrated into the view construction to alleviate the influence of irrelevant bands.

[0005] In order to achieve the above object, the present invention adopts the following technical solution:

[0006] The small sample hyperspectral image classification method based on dual-branch Transformer includes the following steps:

[0007] Step 1: Obtain the hyperspectral image data X∈R collected by the aircraftH×W×C and the corresponding annotation Y∈R H×W , where H, W, and C are the height, width, and number of channels of the image data, respectively. The unlabeled hyperspectral image data are input into two different masked self-encoding modules: the masked self-encoding module (GMA) based on graph convolution and the masked self-encoding module (PMA) based on principal component analysis, followed by unsupervised pre-training;

[0008] Step 2: The encoding parts of GMA and PMA pre-trained in step 1 are used as feature extractors and incorporated into the designed comparison framework for further pre-training to further enhance the discriminability of the features.

[0009] Step 3, extracting the pre-trained model in step 2, inputting the hyperspectral image into the pre-trained model, and obtaining features;

[0010] Step 4, input the features obtained in step 3 into the classifier support vector machine (SVM), wherein 5 labeled samples for each type of land object are used as downstream fine-tuning data, input into the SVM, and use the grid search method to determine the optimal hyperplane parameters through 4-fold cross validation (cv=4), wherein the kernel of the SVM is rbf, and the predicted classification results are output through the SVM to achieve accurate classification of the land objects.

[0011] The step 1 includes the following sub-steps:

[0012] Step 1.1, GMA module: for the hyperspectral image data X∈R H×W×C Perform band selection, select representative spectral bands, and reduce the influence of irrelevant spectral bands; then, use representative spectral bands to construct scene visual Figure 1 V1∈R H×W×C ; Cropping views and performing unsupervised pre-training to learn important view features;

[0013] Step 1.2, PMA module: construct scene view Figure 2 , cropped views for unsupervised pre-training.

[0014] The specific implementation of step 1.1 is as follows:

[0015] Step 1.1.1, convert the hyperspectral image into a K nearest neighbor graph G = (v, ε, A), which is used to characterize the structural information of the spectral data in the hyperspectral image; where node v i For band x i ; Select parameter K and calculate the value associated with each node v i The K nodes closest to each other are used to determine ε; A is the adjacency matrix of graph G, A∈R C×C is defined as:

[0016]

[0017] In the above formula, N k (x (i) ) represents x (i) The set of nearest neighbor nodes;

[0018] In step 1.1.2, the graph embedding of the spectral graph G is calculated by graph convolution and combined with the self-representation. The modified self-representation model is defined as:

[0019]

[0020] In the above formula, is the graph embedding matrix of the frequency band graph; is a self-loop adjacency matrix, is the degree matrix of the node;

[0021] Step 1.1.3, use the F norm to solve the self-representation matrix C in step 1.1.2; the self-representation model formula in step 1.1.2 is transformed into:

[0022] C=(W T W+λI b ) -1 W T X

[0023] In the above formula, W is the graph embedding matrix; λ is the scaling factor; I b is the identity matrix;

[0024] Step 1.1.4, after solving C in step 1.1.3, normalize and use L1 norm to calculate the contribution of each band to the reconstruction, and take the first n spectral bands with the largest contribution as the selected spectral band subset;

[0025] Step 1.1.5, perform channel splicing on the spectral band subsets selected in step 1.1.4 to form a scene view Figure 1 Each small image patch cropped with the object as the center is regarded as a view of an object instance, and then input into the mask autoencoder after data enhancement;

[0026] Step 1.1.6, in the masked autoencoder of step 1.1.5, most of the view area is masked, and the autoencoder takes the visible part as input and performs the task of pixel-level reconstruction of the original view; the loss function is set to mean square error (MSE) to make the reconstruction result close to the original input;

[0027] Step 1.1.7, to reduce the amount of computation and memory overhead, use a lightweight Transformer block to construct the masked autoencoder in step 1.1.5; after unsupervised pre-training, the decoder is discarded, and the encoding part can be used as a good view feature extractor and applied to the full view;

[0028] The specific implementation of step 1.2 is as follows:

[0029] Step 1.2.1, for the hyperspectral image data X∈R H×W×C Apply principal component analysis to extract the first three main components to form a scene view Figure 2 V2∈R H×W×C ;

[0030] Step 1.2.2, with the object as the center, the view in step 1.2.1 is cropped, and most of the view of each object instance is masked and used as the input of the mask autoencoder; after unsupervised pre-training, the encoded part can be used as a good spatial feature extractor and applied to the complete view;

[0031] The step 2 includes the following sub-steps:

[0032] Step 2.1, the contrast framework adopts a dual-branch structure, including: a projection head structure (consisting of a fully connected (Linear) layer, a batch normalization (BatchNorm) layer and an activation function (ReLU) connected in sequence) and a contrast loss function; the projection head structure is used to reduce the dimension of the features extracted by the encoder to better capture the differences between samples. The contrast loss function is used to aggregate different view features from the same sample and push away view features of different samples to guide unsupervised training and model updates.

[0033] Step 2.2, define two views from the same object instance as positive samples, and two views from different object instances as negative pairs. The contrast loss function is defined as:

[0034]

[0035] In the above formula, N is the batch size, z i and z j is the feature vector extracted by the model, sim(z i ,z j ) are two eigenvectors z i and z j The cosine similarity between ;

[0036] Step 2.3, obtain the two sets of features after the projection head in step 2.1 and calculate the loss in step 2.2;

[0037] Step 2.4, back-propagate the loss value and update the network parameters.

[0038] Beneficial effects of the present invention:

[0039] (1) The band selection method based on graph convolution and the principal component analysis method are used to construct the view, which alleviates the influence of irrelevant spectral band features;

[0040] (2) We combined unsupervised representation learning with unsupervised contrastive learning and designed an unsupervised hyperspectral feature learning network, which uses autoencoders to extract features and contrastive learning to improve feature separability. Its classification performance in small sample cases is better than several existing advanced small sample classification methods.

[0041] (3) A lightweight masked autoencoder is designed, which maintains high accuracy while having low computational cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 This is a flowchart of the small sample hyperspectral image classification method based on the dual-branch Transformer of the present invention.

[0043] Figure 2 It is the hyperspectral image input in step 1 of embodiment 1 of the present invention.

[0044] Figure 3 This is a network structure diagram of the GMA module in step 1.1 of Example 1 of the present invention.

[0045] Figure 4 This is a network structure diagram of the PMA module in step 1.2 of Example 1 of the present invention.

[0046] Figure 5 This is a network structure diagram of the MACN in step 2 of embodiment 1 of the present invention.

[0047] Figure 6 This is a qualitative comparison chart of the classification method described in the present invention and six other classification methods. DETAILED DESCRIPTION

[0048] The present invention will be further described in detail below in conjunction with the accompanying drawings.

[0049] Reference Figure 1 , Example 1 is given:

[0050] The present invention provides a small sample hyperspectral image classification method based on a dual-branch Transformer, and the specific implementation steps are as follows:

[0051] Step 1: An unlabeled hyperspectral image of Indian Pines, denoted as X∈R H×W×C ,like Figure 2 As shown, they are respectively input into the autoencoder modules (GMA and PMA) for unsupervised pre-training, including the following sub-steps:

[0052] Step 1.1, GMA module: For the original data X∈R H×W×C Select the band, such as Figure 3 As shown in the figure, representative spectral bands are selected to alleviate the influence of irrelevant spectral bands; then, the representative spectral bands are used to construct the scene view Figure 1 ; Cropping views and performing unsupervised pre-training to learn important view features;

[0053] The implementation of step 1.1 is as follows:

[0054] Step 1.1.1: Transform the hyperspectral image X∈R H×W×C Converted into a K nearest neighbor graph G = (v, ε, A) to characterize the structural information of the spectrum data in the hyperspectral image (the number of channels in this embodiment 1 is 200);

[0055] In step 1.1.2, the graph embedding of the spectral graph G is calculated by graph convolution and combined with the self-representation. The modified self-representation model can be defined as:

[0056]

[0057] In the above formula, is the graph embedding matrix of the band graph;

[0058] Step 1.1.3, use the F-norm to solve the self-expressive matrix C in step 1.1.2;

[0059] Step 1.1.4, after solving C in step 1.1.3, use L1 norm to calculate the contribution of each band to the reconstruction, and take the first n (n is 63 in this embodiment 1) spectral bands as the selected spectral band subset;

[0060] Step 1.1.5: perform channel stitching on the spectral band subsets selected in step 1.1.4 to form a hyperspectral scene view. Figure 1 Each small image patch cropped with the object as the center is regarded as a view of an object instance, and then input into the mask autoencoder after data enhancement;

[0061] Step 1.1.6, in the masked autoencoder of step 1.1.5, most of the view area is masked, and the autoencoder takes the visible part as input and performs the task of pixel-level reconstruction of the original view; the loss function is set to mean square error (MSE) to make the reconstruction result close to the original input;

[0062] Step 1.1.7, to reduce the amount of computation and memory overhead, use a lightweight Transformer block to construct the masked autoencoder in step 1.1.5; after unsupervised pre-training, the decoder is discarded, and the encoding part can be used as a good view feature extractor and applied to the full view;

[0063] Step 1.2, PMA module: construct scene view Figure 2 , crop views for unsupervised pre-training, such as Figure 4 As shown;

[0064] The implementation of step 1.2 is as follows:

[0065] Step 1.2.1, for the hyperspectral image data X∈R H×W×C Apply principal component analysis to extract the first three main components to form a scene view Figure 2 V2∈R H×W×C ;

[0066] Step 1.2.2, with the object as the center, the view in step 1.2.1 is cropped, and most of the view of each object instance is masked and used as the input of the mask autoencoder; after unsupervised pre-training, the encoded part can be used as a good spatial feature extractor and applied to the complete view;

[0067] Step 2: The encoding parts of the pre-trained GMA and PMA are used as feature extractors and incorporated into the designed comparison framework to further enhance the discriminability of the features, such as Figure 5 As shown, it includes the following sub-steps:

[0068] Step 2.1, the comparison framework adopts a dual-branch structure, including: a projection head structure (consisting of two fully connected layers, a batch normalization layer and an activation function) and a comparison loss function;

[0069] Step 2.2, define two views from the same object instance as positive samples, and two views from different object instances as negative pairs. The contrast loss function is defined as:

[0070]

[0071] In the above formula, sim(z i ,z j ) are two eigenvectors z i and z j The cosine similarity between ;

[0072] Step 2.3, obtain the two sets of features after the projection head in step 2.1 and calculate the loss in step 2.2;

[0073] Step 2.4, back propagate the loss value and update the network parameters;

[0074] Step 3: Input the hyperspectral image to be classified into the trained model and obtain features;

[0075] Step 4: Input the features obtained in step 3 into the classifier support vector machine (SVM), wherein 5 labeled samples for each type of land object are used as downstream fine-tuning data, and the predicted classification results are output through the SVM to achieve accurate classification of the land object;

[0076] In order to better reflect the advantages of the present invention, the classification method of the present invention is compared with the existing classic classification method SVM, supervised classification method SSRN and small sample classification methods (DFSL, DCFSL and CA-CFSL) in combination with specific examples.

[0077] The prior art comparison classification method used in the present invention is as follows:

[0078] SSRN is the supervised learning hyperspectral classification method proposed in "Zhong, Z., Li, J., Luo, Z., Chapman, M.: Spectral–spatial residual network for hyperspectral image classification: A 3-d deep learning framework. IEEE Transactions on Geoscience and Remote Sensing 56(2), 847–858(2017)";

[0079] DFSL is a small sample hyperspectral classification method proposed in "Liu, B., Yu, X., Yu, A., Zhang, P., Wan, G., Wang, R.: Deep few-shot learning for hyperspectral image classification. IEEE Transactions on Geoscience and Remote Sensing 57(4), 2290–2304(2018)";

[0080] DCFSL is the small-sample hyperspectral classification method proposed in "Li, Z., Liu, M., Chen, Y., Xu, Y., Li, W., Du, Q.: Deep cross-domain few-shot learning for hyperspectral image classification. IEEE Transactions on Geoscience and Remote Sensing 60, 1–18 (2022)";

[0081] CA-CFSL is the small-sample hyperspectral classification method proposed in "Wang, W., Liu, F., Liu, J., Xiao, L.: Cross-domain few-shot hyperspectral image classification with class-wise attention. IEEE Transactions on Geoscience and Remote Sensing 61, 1–18 (2023)";

[0082] The comparison method is: Figure 2 The real hyperspectral image Indian Pines shown in the figure is classified. 50% of the unlabeled pixels are randomly selected as the unsupervised pre-training sample set. For all methods, 5 labeled pixels are selected from each class as the training data set, and the remaining pixels are used as the test sample set. The classification results are expressed using the overall classification accuracy (OA), average accuracy (AA), Kappa coefficient and classification accuracy of each category;

[0083] Table 1 is the comparison results of OA, AA, Kappa coefficient and classification accuracy of each type of the six classification methods for the experimental hyperspectral image. Table 2 is the comparison results of the parameters of the six classification methods for the experimental hyperspectral image. It can be seen from Table 1 and Table 2 that the MACN method of the present invention has a lower parameter amount (Para:

[0084] 7.35M), and obtained the highest OA, AA and Kappa coefficients, that is, the best classification results, with classification OA and AA of 74.93% and 81.12% respectively. Compared with the most advanced small sample classification method CA-CFSL, the proposed method MACN improved OA and Kappa coefficients by 4.30% and 4.92% respectively;

[0085] Figure 6This is a visual comparison of the classification results of the experimental images by the classification method MACN and six classification methods including SVM, SSRN, DFSL, DCFSL and CA-CFSL described in the present invention; Figure 6 It can be seen that the classification method MACN proposed in the present invention can provide the best classification results, the generated classification graph is more accurate, and there are fewer large-scale misclassifications;

[0086] Table 1 is a comparison of the OA, AA, Kappa coefficients and classification accuracy of the six classification methods for the experimental hyperspectral images. Table 1 is as follows (the bold font is the best result):

[0087] Table 1 Quantitative comparison results

[0088]

[0089]

[0090] Table 2 is a comparison result of the parameters of the experimental hyperspectral images by the six classification methods (Para(M)), as shown below (IP is the Indian Pines dataset in Example 1):

[0091] Table 2 Parameter comparison

[0092] Data / Methods SVM SSRN DFSL DCFSL CA-CFSL MACN IP - 34.67M 3.49M 42.69M 43.04M 7.35M

[0093] The above embodiments are only used to illustrate the present invention, and are not intended to be limiting of the present invention. The specific embodiments described herein are only examples of the present invention.

Claims

1. A small sample hyperspectral image classification method based on a dual-branch Transformer, characterized in that: The steps include: Step 1: Obtain the hyperspectral image data X∈R collected by the aircraft H×W×C and the corresponding annotation Y∈R H×W , the unlabeled hyperspectral image data are input into two different masked autoencoder modules: the masked autoencoder module (GMA) based on graph convolution and the masked autoencoder module (PMA) based on principal component analysis, followed by unsupervised pre-training; Step 2: The encoding parts of GMA and PMA pre-trained in step 1 are used as feature extractors and incorporated into the designed comparison framework for further pre-training; Step 3, extracting the pre-trained model in step 2, inputting the hyperspectral image into the pre-trained model, and obtaining features; Step 4: Input the features obtained in step 3 into the classifier support vector machine (SVM), where 5 labeled samples for each type of land object are used as downstream fine-tuning data, input into the SVM, and the optimal hyperplane parameters of the SVM classifier are determined through 4-fold cross validation. Through the SVM, the predicted classification results are output to achieve accurate classification of the land objects.

2. The small sample hyperspectral image classification method based on dual-branch Transformer according to claim 1 is characterized in that: The step 1 comprises the following sub-steps: Step 1.1, GMA module: for the hyperspectral image data X∈R H×W×C Perform band selection and select representative spectral bands; Afterwards, the representative spectral bands are used to construct the scene view V1∈R H×W×C ; Cropping views and performing unsupervised pre-training to learn important view features; Step 1.2, PMA module: construct scene view 2 and crop the view for unsupervised pre-training.

3. The small sample hyperspectral image classification method based on dual-branch Transformer according to claim 2 is characterized in that: The specific implementation of step 1.1 is as follows: Step 1.1.1, convert the hyperspectral image into a K nearest neighbor graph G = (v, ε, A), which is used to characterize the structural information of the spectral data in the hyperspectral image; where node v i For band x i ; Select parameter K and calculate the value associated with each node v i The K nodes closest to each other are used to determine ε; A is the adjacency matrix of graph G, A∈R C×C is defined as: In the above formula, N k (x (i) ) represents x (i) The set of nearest neighbor nodes; In step 1.1.2, the graph embedding of the spectral graph G is calculated by graph convolution and combined with the self-representation. The modified self-representation model is defined as: In the above formula, is the graph embedding matrix of the frequency band graph; is a self-loop adjacency matrix, is the degree matrix of the node; Step 1.1.3, use the F norm to solve the self-representation matrix C in step 1.1.2; the self-representation model formula in step 1.1.2 is transformed into: C=(W T W+λI b ) -1 W T X In the above formula, W is the graph embedding matrix; λ is the scaling factor; I b is the identity matrix; Step 1.1.4, after solving C in step 1.1.3, normalize and use L1 norm to calculate the contribution of each band to the reconstruction, and take the first n spectral bands with the largest contribution as the selected spectral band subset; Step 1.1.5, the spectral band subsets selected in step 1.1.4 are channel-joined to form scene view 1; each small image block cropped with the ground object as the center is regarded as a view of a ground object instance, and then input into the mask autoencoder after data enhancement; Step 1.1.6, in the masked autoencoder of step 1.1.5, most of the view area is masked, and the autoencoder takes the visible part as input and performs the task of pixel-level reconstruction of the original view; the loss function is set to mean square error (MSE) to make the reconstruction result close to the original input; In step 1.1.7, a lightweight Transformer block is used to construct the masked autoencoder in step 1.1.5; after unsupervised pre-training, the decoder is discarded and the encoding part is used as a view feature extractor and applied to the full view.

4. The small sample hyperspectral image classification method based on dual-branch Transformer according to claim 2 is characterized in that: The specific implementation of step 1.2 is as follows: Step 1.2.1, for the hyperspectral image data X∈R H×W×C Apply principal component analysis to extract the first three main components to form the scene view V2∈R H×W×C ; Step 1.2.2, with the object as the center, the view in step 1.2.1 is cropped, and most of each object instance view is masked and used as the input of the mask autoencoder; After unsupervised pre-training, the encoded part can be used as a good spatial feature extractor and applied to the full view.

5. The small sample hyperspectral image classification method based on dual-branch Transformer according to claim 2 is characterized in that: The step 2 includes the following sub-steps: Step 2.1, the comparison framework adopts a dual-branch structure, including: a projection head structure (consisting of a fully connected (Linear) layer, a batch normalization (BatchNorm) layer and an activation function (ReLU) connected in sequence) and a contrast loss function; the projection head structure is used to reduce the dimension of the features extracted by the encoder, and the contrast loss function is used to aggregate different view features from the same sample and push away view features of different samples, so as to guide unsupervised training and model updating; Step 2.2, define two views from the same object instance as positive samples, and two views from different object instances as negative pairs. The contrast loss function is defined as: In the above formula, N is the batch size, z i and z j is the feature vector extracted by the model, sim(z i ,z j ) are two eigenvectors z i and z j The cosine similarity between ; Step 2.3, obtain the two sets of features after the projection head in step 2.1 and calculate the loss in step 2.2; Step 2.4, back-propagate the loss value and update the network parameters.

Citation Information

Cited By

  • Abdominal lymph node metastasis prediction method, system and equipment based on comparative learning

    CN119295844A

  • Small sample HSI classification method based on prototype mask comparison and cross-stage feature refinement

    CN119672440A