Hyperspectral image classification method based on class-guided attention mechanism

Through the combination of class-guided attention mechanism and multi-channel graph convolution network, the problem of insufficient feature utilization and feature incompatibility between samples in hyperspectral image classification is solved, improving classification accuracy and reducing computational cost.

CN117830848BActive Publication Date: 2024-10-18CHANGCHUN INST OF OPTICS FINE MECHANICS & PHYSICS CHINESE ACAD OF SCI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410008244.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-03
Publication Date
2024-10-18
Estimated Expiration
2044-01-03

AI Technical Summary

Technical Problem

It is difficult for existing technologies to fully utilize inter-sample features and coordinate feature fusion of different networks in hyperspectral image classification, resulting in insufficient classification accuracy.

Method used

The class-guided attention mechanism and multi-channel graph convolution network are used to perform spectral dimensionality reduction through principal component analysis. A hyperspectral image classification model based on the class-guided attention mechanism is constructed, and the cross-entropy loss function and fully connected layer are used for feature fusion. , harmonizing the advantages of convolutional neural networks and graph convolutional networks.

Benefits of technology

It effectively improves the classification accuracy of hyperspectral images, reduces memory and computing costs in practical applications, and achieves full utilization of features between samples and compatibility of features.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117830848B_ABST
    Figure CN117830848B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of hyperspectral remote sensing image classification, and in particular to a hyperspectral image classification method based on a class-guided attention mechanism. The method comprises: S1: performing spectral dimension reduction on the original hyperspectral image by principal component analysis to obtain a feature map A; S2: acquiring and dividing the feature map A into data sets, and performing data expansion and processing to obtain neighborhood image blocks and image samples accordingly; S3: building a hyperspectral image classification model, inputting the training set into the hyperspectral image classification model for feature fusion, and obtaining the classification result of each sample in the training set; S4: optimizing the hyperspectral image classification model using a cross entropy function according to the classification result of the training set to obtain the model parameters with the highest accuracy; S5: inputting the test set into the hyperspectral image classification model to obtain the classification result. The present invention solves the problem of insufficient feature extraction and feature incompatibility between samples in hyperspectral remote sensing image classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of hyperspectral remote sensing image classification and deep learning technology, and in particular to a hyperspectral image classification method based on a class-guided attention mechanism. Background Art

[0002] In earth observation technology, hyperspectral imaging can capture dozens or even hundreds of continuous spectral bands. This rich spectral information can be used to mine spectral features beyond the range of human eye sensitivity, providing more detailed data support for subsequent ground object analysis tasks. Convolutional neural networks classify hyperspectral images in the form of input of neighborhood image blocks, but it is difficult to fully explore the data distribution characteristics of hyperspectral images using convolutional neural networks. Graph convolutional networks have shown good performance in processing non-Euclidean data. However, existing graph convolutional networks limit the adjacency matrix and feature graph to two-dimensional space, making it difficult to extract inter-sample features of hyperspectral images from multiple dimensions.

[0003] In the hyperspectral image classification task, graph convolutional networks can more effectively capture information between samples, while convolutional neural networks have excellent spatial-spectral feature extraction capabilities. In order to coordinate the advantages of both, convolutional neural networks are usually added when using graph convolutional networks. However, there is a certain degree of incompatibility between the features obtained by the two networks, so most hybrid networks can only fuse the two features in the fully connected layer. Due to over-reliance on the independent classification performance of the two networks, it is impossible to fully coordinate the extraction capabilities of the two networks for different features. Summary of the invention

[0004] In order to solve the problems of insufficient utilization of features between samples and insufficient attention to the fusion of different intermediate features in the prior art, the present invention proposes a hyperspectral image classification method based on a class-guided attention mechanism. The class-attention guidance mechanism is used to solve the problems of insufficient feature extraction and feature incompatibility between samples in hyperspectral remote sensing image classification.

[0005] The hyperspectral image classification method based on class-guided attention mechanism proposed in the present invention specifically includes the following steps:

[0006] S1: Perform spectral dimension reduction on the original hyperspectral image by principal component analysis to obtain a feature map A with b components retained;

[0007] S2: Acquire and divide the feature map A into a data set to obtain a training set and a test set, expand and process the training set and the test set, and obtain the neighborhood image blocks and image samples accordingly;

[0008] S3: Build a hyperspectral image classification model based on the class-guided attention mechanism, input the neighborhood image blocks and image samples of the training set into the hyperspectral image classification model for feature fusion, and obtain the classification results of each sample in the training set;

[0009] S4: According to the classification results of the training set, the learnable parameters of the hyperspectral image classification model are optimized using the cross entropy loss function to obtain a hyperspectral image classification model with the highest accuracy model parameters;

[0010] S5: Input the neighborhood image blocks and image samples of the test set into the hyperspectral image classification model obtained in step S4 to obtain the classification result of each sample in the test set.

[0011] Preferably, step S1 specifically includes the following steps:

[0012] S11: Expand the original hyperspectral image into a two-dimensional matrix;

[0013] S12: Perform principal component analysis on the two-dimensional matrix by maximizing the difference of spectral vectors to obtain a feature map A that retains b components.

[0014] Preferably, step S2 specifically includes the following steps:

[0015] S21: Randomly select a portion of labeled pixels in the feature map A as a training set, and the remaining labeled pixels as a test set, wherein the total number of labeled pixels in the training set is less than the total number of labeled pixels in the test set;

[0016] S22: Select a neighborhood with a size of w*h*b in the training set and the test set as the neighborhood image block;

[0017] S23: Select target pixels in the training set and the test set respectively, take the target pixel as the center, randomly select n pixels as random neighbor nodes, and use the random neighbor nodes to construct the adjacency matrix of the first three channels of the image by the following formula:

[0018] (1);

[0019] (2);

[0020] (3);

[0021] in, , , They are the first channel, the second channel and the third channel respectively. is the first Line Column pixels, = or , For the The spatial position of the pixel, For the The spatial position of the pixel, and Respectively and The spectral characteristics of pixels, is the weight, To control the range of data output by different metrics;

[0022] S24: Randomly select n pixel points in the training set and the test set as fixed neighbor nodes, and use the fixed neighbor nodes to construct the adjacency matrix of the last three channels through the following formula:

[0023] (4);

[0024] (5);

[0025] (6);

[0026] in, , , They are the first channel after, the second channel after, and the third channel after;

[0027] S25: Add the identity matrix to the adjacency matrix of the first three channels and the adjacency matrix of the last three channels, and construct the total adjacency matrix and degree matrix of the six channels containing their own node information by the following formula:

[0028] (7);

[0029] (8);

[0030] Where I is the identity matrix, Desirable , , , , , , representing six different channels, It represents the relationship between the i-th node and the j-th node in the total adjacency matrix containing its own node information. is the diagonal element of the degree matrix corresponding to the total adjacency matrix;

[0031] S26: construct a graph sample according to the total adjacency matrix of the six channels and the node signal matrix of the six channels.

[0032] Preferably, the neighborhood image blocks are expanded by vertical flipping and horizontal flipping in sequence.

[0033] Preferably, data expansion is performed on the graph sample by the following formula:

[0034] (9);

[0035] in, is the position of the target pixel of the original image sample, ( ) is the position of the target pixel of the new image sample, To randomly generate a set of length and width in the range arrive The two-dimensional coordinate increment .

[0036] Preferably, the hyperspectral image classification model includes four cascaded multi-channel convolutional networks, a convolutional neural network, a first group of fully connected layers, a second group of fully connected layers and a third group of fully connected layers. The neighborhood image blocks and the image samples are input into the convolutional neural network and the four cascaded multi-channel graph convolutional networks respectively, and the feature map Q and four groups of three-dimensional feature maps are obtained accordingly. Each group of three-dimensional feature maps includes a feature map K and a feature map V. The feature map Q is matrix multiplied with the four feature maps K according to the channel dimension to obtain the weight value corresponding to each multi-channel graph convolutional network. The four feature maps V are point-to-point added and fused in sequence according to the weight value corresponding to each multi-channel graph convolutional network to obtain a fused feature map B. The feature map Q, the fused feature map B and the four feature maps V are all expanded into vectors, and weighted fusion is performed through the first group of fully connected layers, the second group of fully connected layers and the third group of fully connected layers respectively, wherein the four feature maps V share all parameters of the third group of fully connected layers to obtain the final classification result.

[0037] Preferably, the multi-channel graph convolution network includes four layers of graph convolution layers, three layers of cascaded 2D convolution layers and two layers of cascaded 3D convolution layers, and a ReLU activation function is provided between every two layers of graph convolution layers. After the graph samples are activated by the ReLU activation function, they are sequentially input into the four layers of graph convolution layers for graph convolution and corresponding activation operations, and the feature map C is output. The feature map C is zero-padded and transposed by the three layers of cascaded 2D convolution layers to obtain the feature map D. After the feature map D is zero-padded by the two layers of cascaded 3D convolution layers, the feature map K and the feature map V are output.

[0038] Preferably, the propagation formula for each channel between two cascaded multi-channel graph convolutional layers is:

[0039] (10);

[0040] in, is the degree matrix corresponding to the total adjacency matrix, is the output feature map Layer features, For the The learnable parameter weights of layer features, For the The bias of the layer features, is the activation function.

[0041] Preferably, the calculation formula of the fusion feature map B is:

[0042] (11);

[0043] in, and Respectively Weights and feature maps of multi-channel graph convolutional networks , For the The first of the multi-channel graph convolutional networks The feature map K of each channel, For the The convolutional neural network of multi-channel graph convolutional networks is The feature map Q of each channel, is the fusion feature map B, represents the weight normalization function.

[0044] Preferably, the formula of the cross entropy loss function is:

[0045] (12);

[0046] Among them, L is the cross entropy loss function, is the batch size, is the number of categories, is the true label, is the predicted label.

[0047] Compared with the prior art, the present invention can achieve the following beneficial effects:

[0048] (1) The present invention proposes a class-guided attention mechanism and a fusion framework (including the first fully connected layer, the second fully connected layer and the third fully connected layer), which respectively realize the fusion of intermediate features and the fusion of fully connected features, and fully coordinate the advantages of convolutional neural networks and multi-channel graph convolutional networks, effectively improving the classification accuracy of hyperspectral images.

[0049] (2) The present invention adopts a batch training method to train the hyperspectral image classification model, and then uses the trained hyperspectral image classification model to directly predict new data, which effectively reduces the memory cost and computing cost in practical applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 is a flow chart of a hyperspectral image classification method based on a class-guided attention mechanism provided according to an embodiment of the present invention;

[0051] Figure 2 is a schematic structural diagram of an extended image book provided according to an embodiment of the present invention;

[0052] Figure 3 is a schematic diagram of a network structure of a hyperspectral image classification model provided according to an embodiment of the present invention;

[0053] Figure 4 is a schematic diagram of the network structure of a multi-channel convolutional network provided according to an embodiment of the present invention;

[0054] Figure 5 is a schematic diagram of a structure of a construction graph sample provided according to an embodiment of the present invention;

[0055] Figure 6 4 is a schematic diagram of comparison results between the hyperspectral image classification method provided according to an embodiment of the present invention and other methods. DETAILED DESCRIPTION

[0056] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. In the following description, the same modules are represented by the same reference numerals. In the case of the same reference numerals, their names and functions are also the same. Therefore, the detailed description thereof will not be repeated.

[0057] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and do not constitute a limitation of the present invention.

[0058] The hyperspectral image classification method based on the class-guided attention mechanism proposed in the embodiment of the present invention firstly performs a dimension reduction operation on the original hyperspectral image by the principal component analysis method, then constructs the neighborhood image blocks of the hyperspectral image and the graph samples containing multiple adjacency matrices, and performs data enhancement on all samples. Then, the constructed training set is respectively input into the multi-channel graph convolutional network and the convolutional neural network, and the spatial spectrum features of each sample and the relationship features with the neighboring samples are obtained correspondingly, and the intermediate features and the fully connected layer features of the same size are obtained. Finally, the features extracted by the two networks are fused multiple times through the class-guided attention mechanism and the fully connected layer fusion strategy, and the hyperspectral image classification model is trained by using the cross entropy loss function and batch processing. After training, the hyperspectral image classification model can be used to extract rich inter-sample features, and the multi-channel graph convolutional network and the convolutional neural network can fully cooperate to effectively improve the classification accuracy of the hyperspectral image.

[0059] Figure 1 The flowchart of the hyperspectral image classification method based on the class-guided attention mechanism provided according to an embodiment of the present invention is shown.

[0060] like Figure 1 As shown, the hyperspectral image classification method based on class-guided attention mechanism proposed in the present invention specifically includes the following steps:

[0061] S1: The original hyperspectral image is subjected to spectral dimension reduction by principal component analysis to obtain a feature map A with b components retained.

[0062] Step S1 specifically includes the following steps:

[0063] S11: Expand the original hyperspectral image into a two-dimensional matrix;

[0064] S12: Perform principal component analysis on the two-dimensional matrix by maximizing the difference of spectral vectors to obtain a feature map A that retains b components.

[0065] S2: Acquire and divide the feature map A into data sets to obtain training sets and test sets, expand and process the training sets and test sets, and obtain neighborhood image blocks and image samples accordingly.

[0066] Step S2 specifically includes the following steps:

[0067] S21: Randomly select a portion of labeled pixels in the feature map A as a training set, and the remaining labeled pixels as a test set, wherein the total number of labeled pixels in the training set is less than the total number of labeled pixels in the test set;

[0068] S22: Select a neighborhood with a size of w*h*b in the training set and the test set as the neighborhood image block;

[0069] S23: Select target pixels in the training set and the test set respectively, take the target pixel as the center, randomly select n pixels as random neighbor nodes, and use the random neighbor nodes to construct the adjacency matrix of the first three channels of the image by the following formula:

[0070] (1);

[0071] (2);

[0072] (3);

[0073] in, , , They are the first channel, the second channel and the third channel respectively. is the first Line Column pixels, = or , For the The spatial position of the pixel, For the The spatial position of the pixel, and Respectively and The spectral characteristics of pixels, is the weight, To control the range of data output by different metrics;

[0074] S24: Randomly select n pixel points in the training set and the test set as fixed neighbor nodes, and use the fixed neighbor nodes to construct the adjacency matrix of the last three channels through the following formula:

[0075] (4);

[0076] (5);

[0077] (6);

[0078] in, , , They are the first channel after, the second channel after, and the third channel after;

[0079] S25: Add the identity matrix to the adjacency matrix of the first three channels and the adjacency matrix of the last three channels, and construct the total adjacency matrix and degree matrix of the six channels containing their own node information by the following formula:

[0080] (7);

[0081] (8);

[0082] Where I is the identity matrix, Desirable , , , , , , representing six different channels, It represents the relationship between the i-th node and the j-th node in the total adjacency matrix containing its own node information. is the diagonal element of the degree matrix corresponding to the total adjacency matrix;

[0083] S26: construct a graph sample according to the total adjacency matrix of the six channels and the node signal matrix of the six channels.

[0084] The adjacency matrices of the six channels correspond to the node signal matrices of the six channels of the multi-channel convolutional network. The node signal matrix of each channel is composed of the spectral features of the neighboring nodes of the corresponding channel arranged in sequence.

[0085] S3: Build a hyperspectral image classification model based on the class-guided attention mechanism, input the neighborhood image blocks and image samples of the training set into the hyperspectral image classification model for feature fusion, and obtain the classification results of each sample in the training set;

[0086] S4: According to the classification results of the training set, the learnable parameters of the hyperspectral image classification model are optimized using the cross entropy loss function to obtain a hyperspectral image classification model with the highest accuracy model parameters;

[0087] S5: Input the neighborhood image blocks and image samples of the test set into the hyperspectral image classification model obtained in step S4 to obtain the classification result of each sample in the test set.

[0088] The formula for the cross entropy loss function is:

[0089] (9);

[0090] Among them, L is the cross entropy loss function, is the batch size, is the number of categories, is the true label, is the predicted label.

[0091] Figure 2 The structure of the extended image book provided according to an embodiment of the present invention is shown.

[0092] like Figure 2 As shown, when constructing a graph sample of a real label, the target pixel is first selected to construct the graph sample. The method of constructing additional samples is similar to that of the above. When selecting the spatial position of the target pixel, disturbance is added, and the target pixel is replaced by the adjacent pixel to construct the additional graph sample, and the label of the original target pixel is kept unchanged. That is, in the process of constructing the graph sample, the fixed neighbor nodes are kept unchanged, and the random neighbor nodes are reselected. Since the data set has the characteristics of mutual aggregation of similar objects and low spatial resolution, the additional samples constructed by adding pixel-level disturbance can maintain a high label confidence. In an embodiment of the present invention, the length and width of the selected disturbance range are two pixels each.

[0093] Considering the low spatial resolution of hyperspectral remote sensing images, the existence of end-member mixing, and the fact that similar objects often show a distribution characteristic of mutual aggregation, the label of the target pixel can replace the label of the adjacent pixel with a higher confidence. When the selection area of ​​adjacent pixels is within a few pixels, it can not only improve the confidence of the additional sample label, but also effectively alleviate the overfitting phenomenon by using the three adjacency matrices constructed by random neighbor nodes to produce sufficient differences from the original sample.

[0094] The data of the graph sample is expanded by the following formula:

[0095] (10);

[0096] in, is the position of the target pixel of the original image sample, ( ) is the position of the target pixel of the new image sample, To randomly generate a set of length and width in the range arrive The two-dimensional coordinate increment .

[0097] The neighborhood image blocks are augmented by vertical flipping and horizontal flipping.

[0098] Figure 3 The network structure of the hyperspectral image classification model provided according to an embodiment of the present invention is shown.

[0099] like Figure 3As shown in the figure, the hyperspectral image classification model includes four cascaded multi-channel convolutional networks, a convolutional neural network, a first group of fully connected layers, a second group of fully connected layers and a third group of fully connected layers. The neighborhood image blocks and the image samples are input into the convolutional neural network and the four cascaded multi-channel graph convolutional networks respectively, and the feature map Q and four groups of three-dimensional feature maps are obtained respectively. Each group of three-dimensional feature maps includes a feature map K and a feature map V. The feature map Q is matrix multiplied with the four feature maps K according to the channel dimension respectively, and the weight value of each multi-channel graph convolutional network is obtained respectively. According to the weight value corresponding to each multi-channel graph convolutional network, the four feature maps V are point-to-point added and fused in turn to obtain the fused feature map B. The feature map Q, the fused feature map B and the four feature maps V are all expanded into vectors, and weighted fusion is performed through the first group of fully connected layers, the second group of fully connected layers and the third group of fully connected layers respectively, wherein the four feature maps V share all the parameters of the third group of fully connected layers to obtain the final classification result.

[0100] The calculation formula of the fused feature map B is:

[0101] (11);

[0102] in, and Respectively Weights and feature maps of multi-channel graph convolutional networks , For the The first of the multi-channel graph convolutional networks The feature map K of each channel, For the The convolutional neural network of multi-channel graph convolutional networks is The feature map Q of each channel, is the fusion feature map B, represents the weight normalization function.

[0103] Figure 4 The network structure of a multi-channel convolutional network provided according to an embodiment of the present invention is shown.

[0104] like Figure 4 As shown, the multi-channel graph convolutional network can extract richer features to a certain extent through different initializations. The embodiment of the present invention includes four identical multi-channel graph convolutional networks, and each multi-channel graph convolutional network adopts an independent and random initialization strategy.

[0105] The multi-channel graph convolutional network includes four layers of graph convolutional layers, three layers of cascaded 2D convolutional layers and two layers of cascaded 3D convolutional layers, and a ReLU activation function is set between every two layers of graph convolutional layers. After the graph samples are activated by the ReLU activation function, they are successively input into the four layers of graph convolutional layers for graph convolution and corresponding activation operations, and the feature map C is output. The feature map C is padded with zeros and transposed by three layers of cascaded 2D convolutional layers to obtain the feature map D. After the feature map D is padded with zeros by two layers of cascaded 3D convolutional layers, the feature maps K and V are output.

[0106] The propagation formula for each channel between two cascaded multi-channel graph convolutional layers is:

[0107] (12);

[0108] in,, is the degree matrix corresponding to the total adjacency matrix, is the output feature map Layer features, For the The learnable parameter weights of layer features, For the The bias of the layer features, is the activation function.

[0109] Figure 5 The structure of building a graph sample provided according to an embodiment of the present invention is shown.

[0110] like Figure 5As shown in the figure, the traditional graph convolutional network uses spatial position or spectral vector difference to measure the correlation between samples when constructing the adjacency matrix. Limited by the two-dimensional matrix operation method of the graph convolutional network, only one method can be selected to obtain information between samples, that is, the feature extraction ability of the graph convolutional network cannot be fully utilized. Take the hyperspectral image of the University of Pavia as an example. The size of the image is 610×340×103, which contains a spatial range of 610×340 pixels and covers 103 bands. The dataset is reduced to 610×340×9 by principal component analysis and used to construct samples. Each graph sample contains an adjacency matrix of six channels, which consists of random neighbor nodes of three channels and fixed neighbor nodes of three channels. In the adjacency matrix of random neighbor nodes, with the target pixel as the center, 8 neighbor nodes are randomly selected within the range of 27 pixels in length and width around the target pixel. The 9 nodes including the target pixel are respectively constructed into three-channel adjacency matrices according to the spatial position, spectral vector difference and light intensity difference. The corresponding node signal matrix is ​​composed of the spectral vectors of the 9 nodes arranged in sequence, wherein the length of the node signal matrix is ​​the number of nodes, and the width is the number of bands of the original hyperspectral image after dimensionality reduction. In the dimensionality reduction of the embodiment of the present invention, the 9 principal components of the original hyperspectral band are retained after principal component analysis. The construction method of the adjacency matrix of fixed neighbor nodes is the same as that of random neighbor nodes, with only differences in the selection of neighbor nodes and parameters. Fixed neighbor nodes are 8 sample points randomly selected from the entire hyperspectral data set. This group of neighbor nodes is selected from different categories as much as possible, and once selected, all target pixels select this group of neighbor nodes when constructing the adjacency matrix of fixed neighbors. The graph sample includes three ways to measure the correlation between samples, which more fully aggregates the features between samples. In the embodiment of the present invention, , , , .

[0111] Figure 6 The comparison results of the hyperspectral image classification method provided according to an embodiment of the present invention and other methods are shown.

[0112] In order to prove the feasibility and superiority of the present invention, the results of SVM, A²S²K, SSCNN, DBDA, P-ResNet, miniGCN, and MRViT are compared with the results of the method proposed in the present invention, where SVM is a support vector machine, A²S²K is a 3D convolutional neural network based on adaptive kernel spatial spectral attention and residual blocks, SSCNN is a convolutional neural network with two layers of 3D convolutional layers, DBDA is a convolutional neural network with spatial spectrum dual paths, P-ResNet is a pyramid network based on residual network, miniGCN is a hybrid network based on batch graph convolutional neural network and 3D convolutional neural network, and MRViT is a Transformer model based on hybrid residual network. The overall accuracy, average accuracy, kappa coefficient and accuracy of each type of sample are used as the evaluation benchmarks for the above methods, and 100 samples are selected for training for each type of method. In order to obtain reliable conclusions, each type of method is repeated 5 times and then averaged. As shown in Table 1, the classification accuracy of the present invention is improved by about 1%~2% compared with the current advanced technology, and as shown in Table 1, Figure 6 As shown, the classification graph obtained by the embodiment of the present invention has relatively less noise, clearer edge boundaries, and better classification performance.

[0113]

[0114] Table 1

[0115] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the disclosure of the present invention can be performed in parallel, sequentially or in different orders, as long as the desired results of the technical solution disclosed in the present invention can be achieved, and this document does not limit this.

[0116] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A hyperspectral image classification method based on class-guided attention mechanism, characterized in that: The specific steps include: S1: Perform spectral dimension reduction on the original hyperspectral image by principal component analysis to obtain a feature map A with b components retained; S2: acquiring and dividing the feature map A into a data set to obtain a training set and a test set, performing data expansion and processing on the training set and the test set to obtain neighborhood image blocks and image samples accordingly; S21: Randomly select a portion of labeled pixels in the feature map A as a training set, and the remaining labeled pixels as a test set, wherein the total number of labeled pixels in the training set is less than the total number of labeled pixels in the test set; S22: Selecting a neighborhood with a size of w*h*b in the training set and the test set as a neighborhood image block; S23: Select target pixels in the training set and the test set respectively, randomly select n pixels as random neighbor nodes with the target pixel as the center, and construct the adjacency matrix of the first three channels of the image by using the random neighbor nodes and the following formula: (1); (2); (3); in, , , They are the first channel, the second channel and the third channel respectively. is the first Line Column pixels, = or , For the The spatial position of the pixel, For the The spatial position of the pixel, and Respectively and The spectral characteristics of pixels, is the weight, To control the range of data output by different metrics; S24: Randomly select n pixel points in the training set and the test set as fixed neighbor nodes, and use the fixed neighbor nodes to construct the adjacency matrix of the last three channels by the following formula: (4); (5); (6); in, , , They are the first channel after, the second channel after, and the third channel after; S25: Add the identity matrix to the adjacency matrix of the first three channels and the adjacency matrix of the last three channels, and construct the total adjacency matrix and degree matrix of the six channels containing their own node information by the following formula: (7); (8); Where I is the identity matrix, Desirable , , , , , , representing six different channels, It represents the relationship between the i-th node and the j-th node in the total adjacency matrix containing its own node information. is the diagonal element of the degree matrix corresponding to the total adjacency matrix; S26: constructing a graph sample according to the total adjacency matrix of the six channels and the node signal matrix of the six channels; S3: Building a hyperspectral image classification model based on a class-guided attention mechanism, inputting the neighborhood image blocks and image samples of the training set into the hyperspectral image classification model for feature fusion, and obtaining the classification result of each sample in the training set; The hyperspectral image classification model includes four cascaded multi-channel convolutional networks, a convolutional neural network, a first group of fully connected layers, a second group of fully connected layers, and a third group of fully connected layers. The neighborhood image blocks and the image samples are input into the convolutional neural network and the four cascaded multi-channel graph convolutional networks respectively, and a feature map Q and four groups of three-dimensional feature maps are obtained accordingly. Each group of three-dimensional feature maps includes a feature map K and a feature map V. The feature map Q is subjected to matrix multiplication operations with four feature maps K according to the channel dimension to obtain a weight value corresponding to each multi-channel graph convolutional network. The four feature maps V are sequentially added and fused point-to-point according to the weight value corresponding to each multi-channel graph convolutional network to obtain a fused feature map B. The feature map Q, the fused feature map B, and the four feature maps V are all expanded into vectors, and weighted fusion is performed through the first group of fully connected layers, the second group of fully connected layers, and the third group of fully connected layers, respectively, wherein the four feature maps V share all parameters of the third group of fully connected layers to obtain a final classification result. S4: According to the classification results of the training set, the learnable parameters of the hyperspectral image classification model are optimized using a cross entropy loss function to obtain a hyperspectral image classification model with the highest precision model parameters; S5: Input the neighborhood image blocks and image samples of the test set into the hyperspectral image classification model obtained in step S4 to obtain the classification result of each sample in the test set.

2. The hyperspectral image classification method based on class-guided attention mechanism according to claim 1 is characterized in that: The step S1 specifically includes the following steps: S11: Expanding the original hyperspectral image into a two-dimensional matrix; S12: Performing principal component analysis on the two-dimensional matrix by maximizing the difference in spectral vectors to obtain a feature map A retaining b components.

3. The hyperspectral image classification method based on class-guided attention mechanism according to claim 1 is characterized in that: The neighborhood image block is expanded by vertical flipping and horizontal flipping in sequence.

4. The hyperspectral image classification method based on class-guided attention mechanism according to claim 1, characterized in that: The data of the graph sample is expanded by the following formula: (9); in, is the position of the target pixel of the original image sample, ( ) is the position of the target pixel of the new image sample, To randomly generate a set of length and width in the range arrive The two-dimensional coordinate increment .

5. The hyperspectral image classification method based on class-guided attention mechanism according to claim 1, characterized in that: The multi-channel graph convolution network includes four graph convolution layers, three cascaded 2D convolution layers and two cascaded 3D convolution layers, and a ReLU activation function is arranged between every two graph convolution layers. After the graph samples are activated by the ReLU activation function, they are sequentially input into the four graph convolution layers for graph convolution and corresponding activation operations, and a feature map C is output. The feature map C is padded with zeros and transposed by three cascaded 2D convolution layers to obtain a feature map D. After the feature map D is padded with zeros by two cascaded 3D convolution layers, feature maps K and V are output.

6. The hyperspectral image classification method based on class-guided attention mechanism according to claim 5, characterized in that: The propagation formula for each channel between two cascaded multi-channel graph convolutional layers is: (10); in, is the degree matrix corresponding to the total adjacency matrix, is the output feature map Layer features, For the The learnable parameter weights of layer features, For the The bias of the layer features, is the activation function.

7. The hyperspectral image classification method based on class-guided attention mechanism according to claim 1, characterized in that: The calculation formula of the fusion feature map B is: (11); in, and Respectively Weights and feature maps of multi-channel graph convolutional networks , For the The first of the multi-channel graph convolutional networks The feature map K of each channel, For the The convolutional neural network of multi-channel graph convolutional networks is The feature map Q of each channel, is the fusion feature map B, represents the weight normalization function.

8. The hyperspectral image classification method based on class-guided attention mechanism according to claim 1, characterized in that: The formula for the cross entropy loss function is: (12); Among them, L is the cross entropy loss function, is the batch size, is the number of categories, is the true label, is the predicted label.

Citation Information

Patent Citations

  • Hyperspectral image classification method based on attention mechanism and weight sharing

    CN113095409A