A Hyperspectral Image Classification Method Based on a Two-Branch Attention Network

By constructing a hyperspectral image classification method based on a dual-branch attention network, spatial and spectral features are extracted using the main path and branches respectively, which reduces computational complexity, improves classification performance and efficiency, and solves the problem of high computational complexity in existing technologies.

CN116168235BActive Publication Date: 2025-10-28CHANGCHUN UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211692394.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-28
Publication Date
2025-10-28
Estimated Expiration
2042-12-28

AI Technical Summary

Technical Problem

Existing hyperspectral image classification methods are computationally complex and inefficient, making it difficult to effectively extract and fuse spatial and spectral information.

Method used

A method based on a dual-branch attention network is adopted to extract the spatial and spectral features of hyperspectral images through the main path and two branches respectively. Two-dimensional convolutional blocks are used for dimensionality transformation, and spatial multi-scale convolutional modules and channel attention blocks are combined to reduce the use of three-dimensional convolution and reduce computational complexity.

Benefits of technology

It improves the classification performance and computational efficiency of hyperspectral images, shortens the testing time, and maintains high classification accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116168235B_ABST
    Figure CN116168235B_ABST
Patent Text Reader

Abstract

This invention belongs to the field of image classification technology, and specifically to a hyperspectral image classification method based on a dual-branch attention network. The method includes the following steps: Step 1, preparing the dataset: using a publicly available hyperspectral image dataset; Step 2, image preprocessing: performing dimensionality reduction on the dataset prepared in Step 1 and extracting sample blocks from the dimensionality-reduced images to obtain a hyperspectral sample. This method comprises one main path and two branches. The main path extracts the spatial spectral features of the hyperspectral image; the spatial branch uses a spatial multi-scale module to process the spatial spectral features extracted by the main path, extracting spatial information; the channel branch uses channel attention blocks to process the spatial spectral features extracted by the main path, extracting spectral information; finally, the features obtained from the two branches are fused and classified. This network model exhibits good classification performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image classification technology, specifically to a hyperspectral image classification method based on a dual-branch attention network. Background Technology

[0002] In the field of multi-source remote sensing, hyperspectral data can provide more detailed spectral information describing land cover categories such as vegetation, soil, and water, and this spectral information can reflect subtle differences between feature categories, making hyperspectral data more widely used than other remote sensing imaging applications.

[0003] Hyperspectral images exhibit unique advantages in describing these different land cover information, with stronger feature recognition capabilities and higher classification reliability. However, because hyperspectral images contain a large amount of spatial and spectral information, these complex features increase the computational complexity of the network and also increase the difficulty of classifying hyperspectral images.

[0004] The Chinese patent publication number is "CN113486851A", entitled "A Hyperspectral Image Classification Method Based on a Two-Branch Spectral Multi-Scale Attention Network". This method constructs two branches, one of which is a spectral branch, which uses a pyramid multi-scale convolution module and a spectral attention structure to extract spectral information; the other branch is a spatial branch, which uses a dense connection block and a spatial attention mechanism to extract spatial information. Finally, the features obtained from the two branches are fused and classified. The method uses only three-dimensional convolution kernels, resulting in high computational complexity and low efficiency.

[0005] Therefore, we propose a hyperspectral image classification method based on a bi-branch attention network to solve the above problems. Summary of the Invention

[0006] (a) Technical problems to be solved

[0007] To address the shortcomings of existing technologies, this invention provides a hyperspectral image classification method based on a dual-branch attention network, which solves the problems mentioned in the background section.

[0008] (II) Technical Solution

[0009] To achieve the above objectives, the present invention specifically adopts the following technical solution:

[0010] A hyperspectral image classification method based on a dual-branch attention network includes the following steps:

[0011] Step 1, Prepare the dataset: Use a publicly available hyperspectral image dataset;

[0012] Step 2, Image preprocessing: Dimensionality reduction is performed on the dataset prepared in Step 1, and sample blocks are extracted from the dimensionality-reduced image to obtain a hyperspectral sample;

[0013] Step 3, Construct the network model: The entire network consists of a main path and two branches. The main path contains a dense convolutional block; the two branches are a spatial branch and a channel branch. The spatial branch contains a 2D convolutional block, a multi-scale convolutional block, and a multi-layer processing block; the channel branch contains a 2D convolutional block, a channel attention block, and a multi-layer processing block; finally, the two branches are connected.

[0014] Step 4, Select the loss function and evaluation metric: Calculate the loss function between the classified image and the label until the number of training iterations reaches a set threshold or the loss function value falls within a set range. This indicates that the model parameters have been trained successfully. At the same time, select an evaluation metric to measure the algorithm's accuracy and assess the system's performance.

[0015] Step 5, Save the model: Select the set of model parameters that performed best during training and save them. When hyperspectral image classification is needed later, simply input the hyperspectral image into the network to obtain the final classified image.

[0016] Furthermore, the public datasets used in step 1 are: Indian Pine Dataset (IN), University of Pavia Dataset (UP), and Salinas Dataset (SV).

[0017] Furthermore, the data dimensionality reduction method in step 2 uses Principal Component Analysis (PCA), and its dimensionality reduction process is as follows:

[0018] The original hyperspectral image I1 with dimensions W×H×C1 is subjected to covariance matrix eigenvalue decomposition and transformed into a new hyperspectral image I2 with dimensions W×H×C2, where W is the image width, H is the image height, C1 is the number of channels in the original image, and C2 is the number of bands after transformation.

[0019] Furthermore, the sample block extraction process in step 2 is as follows:

[0020] The new hyperspectral image I2 is cropped into a three-dimensional image patch of size w×w×C1 and input into the network model, where w is the window size.

[0021] Further, in step 3, the dense convolutional block in the main path is composed of four densely connected convolutional blocks. All convolutional blocks in the main path have similar structures, with each block consisting of a batch normalization layer, an activation function layer, and a convolutional layer. The convolutional layer in each dense convolutional block uses a three-dimensional convolutional layer. The two-dimensional convolutional block connecting the main path and the branch paths consists of a batch normalization layer, an activation function layer, and a convolutional layer, and its convolutional layer uses a two-dimensional convolutional layer. The multi-scale convolutional block in the spatial branch contains four paths. Path one consists of a two-dimensional convolutional block and a spatial attention block. Paths two and three consist of two two-dimensional convolutional blocks and a spatial attention block, respectively. Path four consists of a max pooling layer, a two-dimensional convolutional block, and a spatial attention block, respectively. The tensors obtained from the four paths are concatenated together with a dimension of 1. The two-dimensional convolutional blocks in all paths consist of a convolutional layer and a... The activation function layers are composed of: Spatial attention blocks in all circuits consist of an average pooling layer, a max pooling layer, and a 2D convolutional block. In the spatial attention block, the input passes through an average pooling layer and a max pooling layer, and the output is concatenated in dimension 1 before being input into the 2D convolutional block. This 2D convolutional block consists of a 2D convolutional layer and an activation function layer. In the spatial attention block, the output is multiplied by the initial input. Channel attention blocks in the channel branches consist of an average pooling layer and two 2D convolutional blocks. Each 2D convolutional block consists of a 2D convolutional layer and an activation function layer. Similarly, the output is multiplied by the initial input. The multi-layer processing blocks in both branches consist of a batch normalization layer, an activation function layer, a Dropout layer, and a global average pooling layer.

[0022] Furthermore, in step 4, the loss function is selected as the cross-entropy loss function; the evaluation metrics are selected as overall accuracy, average accuracy, and consistency.

[0023] (III) Beneficial Effects

[0024] Compared with existing technologies, this invention provides a hyperspectral image classification method based on a dual-branch attention network, which has the following advantages:

[0025] This invention describes a method comprising a main path and two branch paths. The main path is used to extract spatial spectral features from hyperspectral images. In the spatial branch, a spatial multi-scale module is used to process the spatial spectral features extracted by the main path to extract spatial information. In the channel branch, a channel attention block is used to process the spatial spectral features extracted by the main path to extract spectral information. Finally, the features obtained from the two branches are fused and classified. This network model has good classification performance.

[0026] This invention first uses a two-dimensional convolutional block to perform dimensionality transformation before inputting the spatial spectral features of the hyperspectral image extracted from the main path into the two branches. All subsequent operations are also based on the two-dimensional convolutional block, which reduces the classification cost compared to using a three-dimensional convolutional block alone.

[0027] In order to overcome the limitations of a single scale in the spatial branch, this invention proposes a spatial multi-scale convolution module. In the spatial multi-scale convolution block, features of different neighborhoods of the image are obtained through convolution kernels of different sizes, and spatial attention blocks are used for each scale. Finally, the extracted feature information is fused to improve the classification performance of hyperspectral images. Attached Figure Description

[0028] Figure 1 This is a flowchart of the present invention;

[0029] Figure 2 This is a network structure diagram of the present invention;

[0030] Figure 3 This is a schematic diagram illustrating the specific composition of the densely connected block of the present invention;

[0031] Figure 4 This is a schematic diagram illustrating the specific composition of the two-dimensional convolutional block of the present invention;

[0032] Figure 5 This is a schematic diagram illustrating the specific composition of the multi-scale convolutional block of the present invention;

[0033] Figure 6 This is a schematic diagram illustrating the specific composition of the spatial attention block of the present invention;

[0034] Figure 7 This is a schematic diagram illustrating the specific composition of the channel attention block of the present invention;

[0035] Figure 8 This is a schematic diagram illustrating the specific composition of the multi-layer processing block of the present invention;

[0036] Figure 9 This is a comparison chart of relevant indicators of the present invention on three datasets;

[0037] Figure 10a This is a diagram showing the actual results of this invention on a dataset of pine trees in Central India;

[0038] Figure 10b This is a diagram showing the classification results of the present invention on the Indian pine dataset;

[0039] Figure 11a This is a diagram showing the actual results of this invention on the University of Pavia dataset;

[0040] Figure 11b This is a diagram showing the classification results of this invention on the University of Pavia dataset;

[0041] Figure 12a This is a diagram showing the actual results of this invention on the Salinas dataset;

[0042] Figure 12b This is a diagram showing the classification results of the present invention on the Salinas dataset. Detailed Implementation

[0043] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0044] Example

[0045] like Figure 1-12b The flowchart shown is a hyperspectral image classification method based on a dual-branch attention network proposed in one embodiment of the present invention. The method specifically includes the following steps:

[0046] Step 1, Prepare the datasets: Prepare the Indian Pine Tree Dataset (IN), the University of Pavia Dataset (UP), and the Salinas Dataset (SV);

[0047] Step 2, Data Preprocessing: Based on principal component analysis, the original hyperspectral image I1 is dimensionality reduced, and the new hyperspectral image I2 after dimensionality reduction is sampled to obtain a three-dimensional image block;

[0048] Because hyperspectral image data is large in volume and has many bands, it is necessary to perform dimensionality reduction on this data. Principal component analysis (PCA) is a statistical method that uses orthogonal transformation to convert a set of potentially correlated variables into a set of linearly uncorrelated variables. The transformed variables are called principal components.

[0049] The specific implementation method of the sample block is to crop the new hyperspectral image I2 into a three-dimensional image block of size w×w×B in the spatial dimension and input it into the network model, where w is the window size; the sample block is labeled with the middle pixel.

[0050] Step 3, Construct the network model: The entire network consists of a main path and two branches. The main path contains a dense convolutional block, which inputs the image into the dense convolutional block to extract spatial spectral features. The two branches are a spatial branch and a channel branch. The spatial branch contains a 2D convolutional block, a multi-scale convolutional block, and a multi-layer processing block. This branch inputs the spatial spectral features extracted by the main path into the 2D convolutional block for dimensionality transformation, and then into the multi-scale convolutional block to extract spatial features at different scales. The various spatial attention blocks in the multi-scale convolutional block suppress irrelevant spatial feature information. Finally, this spatial feature information is input into the multi-layer processing block for further processing. To mitigate overfitting during training, the network learns spatial features more effectively. The channel branch contains a 2D convolutional block, a channel attention block, and a multi-layer processing block. This branch inputs the spatial spectral features extracted from the main path into the 2D convolutional block for dimensionality transformation before inputting them into the channel attention block, focusing only on useful spectral features. The spectral features are then processed in the multi-layer processing block to further reduce overfitting and improve the network's learning ability. Finally, the features from the two branches are fused, enhancing the network's ability to extract both types of features and improving computational efficiency. The final classification results are as follows: The dense convolutional blocks in the main path consist of four densely connected convolutional blocks. All convolutional blocks in the main path have the same structure. Each convolutional block consists of a batch normalization layer, an activation function layer, and a convolutional layer, respectively. The convolutional layers in each dense convolutional block use 3D convolutional layers. The 2D convolutional blocks connecting the main path and branches consist of a batch normalization layer, an activation function layer, and a convolutional layer, respectively. The convolutional layers in these 2D convolutional blocks use 2D convolutional layers. The multi-scale convolutional blocks in the spatial branches contain four paths. Path 1 consists of one 2D convolutional block and one spatial attention block. Paths 2 and 3 consist of two 2D convolutional blocks and one spatial attention block, respectively. Path 4 consists of a maximum convolutional block and one spatial attention block, respectively. The system consists of a pooling layer, a 2D convolutional block, and a spatial attention block. The tensors obtained from the four lines are concatenated together with dimension 1. The 2D convolutional blocks in all lines are composed of a convolutional layer and an activation function layer, respectively. The spatial attention blocks in all lines are composed of an average pooling layer, a max pooling layer, and a 2D convolutional block, respectively. In the spatial attention block, the input passes through an average pooling layer and a max pooling layer, and the output is concatenated with dimension 1 before being input into the 2D convolutional block. The 2D convolutional block is composed of a 2D convolutional layer and an activation function layer, respectively. In the spatial attention block, the output is multiplied by the initial input to suppress irrelevant spatial information.The channel attention block in the channel branch consists of an average pooling layer and two 2D convolutional blocks. Each 2D convolutional block consists of a 2D convolutional layer and an activation function layer. In the channel attention block, the output is multiplied by the initial input to suppress irrelevant channel information. The multi-layer processing block in both branches consists of a batch normalization layer, an activation function layer, a Dropout layer and a global average pooling layer.

[0051] The batch normalization layer uses a normalization method to force the distribution of input values ​​of any neuron in each layer of the neural network back to a standard normal distribution with a mean of 0 and a variance of 1. This ensures that the activation input values ​​fall in the region where the nonlinear function is sensitive to the input, making the network output less large and thus obtaining a larger gradient, avoiding the gradient vanishing problem. A larger gradient also means faster learning convergence. The dropout layer can set a certain probability to stop some neurons during forward propagation, and then start training. It updates the weight parameters of the neurons that are still working and retains them. After all the parameters are updated, it stops some neurons again according to the set probability and then starts training. If the new neurons used for training have been trained in the first time, their parameters are updated. If the parameters of the neurons were updated in the first time but stopped working in the second time, their weights are retained without modification. This process continues until the end of training to prevent the network from overfitting during the learning process.

[0052] Step 4, Select the loss function and evaluation metrics: Calculate the loss function between the classified image and the label. Training is considered complete when the number of training iterations reaches a set threshold or the loss function value falls within a set range. Save the model parameters. Simultaneously, select evaluation metrics to measure the algorithm's accuracy and evaluate the system's performance. The choice of loss function affects the model's quality, accurately reflecting the difference between predicted and actual values ​​and providing correct feedback on the model's quality. Evaluation metrics such as overall accuracy, average accuracy, and consistency effectively assess the classification quality and measure the effectiveness of the classification network.

[0053] Step 5, Save the model: Select the set of model parameters that performed best during training and save them. When hyperspectral image classification is needed later, simply input the hyperspectral image into the network to obtain the final classified image.

[0054] Further, in step 1, the Indian Pine Dataset (IN), the University of Pavia Dataset (UP), and the Salinas Dataset (SV) are selected. The Indian Pine Dataset (IN) is a hyperspectral image acquired in northwestern Indiana, USA, using an airborne visible-infrared imaging spectrometer. The image has a spatial size of 145×145 pixels, 220 bands, and spectral and spatial resolutions of 10 nm and 20 m, respectively. Excluding background pixels, there are generally 10249 spatial pixels used in the experiment, with 16 true ground cover categories. Of the 220 bands, 20 are unusable, and the experiment only uses the remaining 200 bands for research. The University of Pavia Dataset (UP) is a hyperspectral image acquired in northwestern Indiana, USA, using an airborne visible-infrared imaging spectrometer. The University of Florida dataset (UP) was obtained in 1996 in Florida using the AVIRIS sensor. It has a spatial size of 512×614 and a spatial resolution of 18m. The dataset is divided into 9 categories and contains 115 bands. After removing 12 noisy bands, 103 usable bands remain. The Salinas dataset (SV) consists of hyperspectral images obtained in the United States using the AVIRIS sensor. The images have a spatial size of 512×217 and a spatial resolution of 1.7m. It contains 16 categories of ground features and 224 bands, but 20 water absorption bands were removed, leaving 204 bands for hyperspectral image classification experiments.

[0055] Furthermore, in step 2, taking the Indian pine dataset as an example, the original hyperspectral image I1 is first reduced to 145×145×30. This process involves solving for the covariance matrix of the original hyperspectral image, and then calculating the eigenvalues ​​λ1≥λ2…≥λ of the covariance matrix. 200 For values ​​≥0, a threshold θ is set. The top P principal components with values ​​greater than θ are selected. The corresponding unit eigenvectors are obtained from the eigenvalues ​​of the top P principal components. These eigenvectors are combined into a matrix, and the transpose matrix is ​​calculated. This transpose matrix is ​​then used to transform the original hyperspectral image to obtain a dimension-reduced hyperspectral image. The dimension-reduced image I2 is then divided into blocks to obtain 11×11×30 three-dimensional image patches. The formulas for calculating the band mean and covariance matrix are shown below:

[0056]

[0057] Where x i Let x represent the i-th pixel in the original hyperspectral image, Q represent the number of pixels, and x represent the number of pixels. j Let J represent the j-th band of the original hyperspectral image, and B represent the number of bands.

[0058] Furthermore, the network model structure in step 3 is as follows: Figure 2 As shown, the entire network consists of one main path and two branch paths; the structure of the dense convolutional blocks in the main path is as follows: Figure 3As shown, in the first three convolutional blocks, the kernel size of each convolutional layer is 7×1×1, the stride is 1×1×1, and the padding is 3×0×0. In the fourth convolutional block, the kernel size of the convolutional layer is B×1×1 (B is the number of channels after dimensionality reduction), the stride is 1×1×1, and there is no padding. The activation function layers of all four convolutional blocks use the Mish activation function. In the two-dimensional convolutional blocks connected to the main path in the two branches, the kernel size is 1×1, the stride is 1×1, there is no padding, and the activation function layer uses the Mish activation function. The structure of the two-dimensional convolutional block is as follows. Figure 4 As shown; the structure of a multi-scale convolutional block is as follows Figure 5 As shown, in the multi-scale convolution module, the kernel size of the convolutional layer in Line 1 is 1×1, the stride is 1×1, and there is no padding; in Line 2, the kernel size of the first convolutional layer is 1×1, the stride is 1×1, and there is no padding, while the kernel size of the second convolutional layer is 3×3, the stride is 1×1, and the padding is 1×1; in Line 3, the kernel size of the first convolutional layer is 1×1, the stride is 1×1, and there is no padding, while the kernel size of the second convolutional layer is 5×5, the stride is 1×1, and the padding is 2×2; in Line 4, the kernel size of the max pooling layer is 3×3, the stride is 1×1, and the padding is 1×1, while the kernel size of the convolutional layer is 1×1, the stride is 1×1, and there is no padding. All activation function layers use the Mish activation function; the structure of the spatial attention module is as follows. Figure 6 As shown, the convolutional layers in this module have a kernel size of 7×7, a stride of 1×1, and padding of 3×3. The activation function layer uses the Mish activation function. The structure of the channel attention module is as follows: Figure 7 As shown, in this module, the kernel size of the two convolutional layers is 1×1, the stride is 1×1, and there is no padding. The first activation function layer uses the Mish activation function, and the second activation function layer uses the Sigmoid activation function. The structure of the multi-layer processing block is as follows: Figure 8 As shown, the activation function layer uses the Mish activation function, with a Dropout coefficient of 0.5, and a kernel size of 11×11 in the global average pooling layer; the input size of the fully connected layer is set to 140, and the output size is set according to the number of classes in the corresponding dataset; the Mish activation function mentioned above is a non-monotonic smooth activation function, which can achieve better accuracy and generalization; the Sigmoid activation function is less affected by noisy data; the LogSoftmax classifier is chosen to speed up the operation and improve data stability; the definitions of the Sigmoid function, Mish function, and LogSoftmax function are shown below:

[0059]

[0060] f(x) Mis h = x * tanh(ln(1+e)) x ))

[0061]

[0062] Where x represents the input feature information, x i x represents the predicted label value. j Represents the actual label value;

[0063] Furthermore, in step 4, the network output and labels are used to calculate a loss function. The cross-entropy loss function is selected, and its definition is as follows:

[0064]

[0065] Where C represents the cost, x represents the sample, y represents the actual value, a represents the output value, and n represents the total number of samples;

[0066] Overall precision is a metric that measures the accuracy of a classification model in classifying the whole category; average precision is a metric that measures the accuracy of a classification model in classifying a specific category; and the consistency coefficient measures the consistency between predicted and actual values. The formulas for calculating overall precision, average precision, and the consistency coefficient are shown below:

[0067]

[0068] Where TP represents the positive samples correctly classified by the model, FN represents the positive samples misclassified by the model, FP represents the negative samples misclassified by the model, and TN represents the negative samples correctly classified by the model; C represents the total number of classes, and T represents the total number of classes. i It is the number of samples that are correctly classified in each category, a i b is the number of real samples in each class. i It is the number of samples predicted for each class, where n is the total number of samples;

[0069] The training iterations are set to 200, with 16 images input to the network each time. The upper limit for the number of images input to the network each time is mainly determined by the performance of the computer's graphics processing unit (GPU). Generally, the larger the number of images input to the network each time, the better, making the network more stable. The learning rate during training is set to 0.0005, which ensures that the network fits quickly without causing overfitting. The Adam optimizer is selected for the network; its advantages are simple implementation, high computational efficiency, low memory requirements, and parameter updates are not affected by gradient scaling transformations, resulting in relatively stable parameters. The threshold value of the loss function is set to around 0.0005; a value less than 0.0005 indicates that the training of the entire network is basically complete.

[0070] The implementation of convolution, activation functions, and concatenation operations are algorithms well-known to those skilled in the art, and the specific processes and methods can be found in relevant textbooks or technical documents.

[0071] This invention constructs a hyperspectral image classification method based on a dual-branch attention network, which can classify hyperspectral images, reducing computational complexity and shortening testing time while improving classification accuracy. The feasibility and superiority of this method are further verified by calculating the correlation index of the images with existing methods.

[0072] The relevant metrics of existing technologies and the proposed method on the Indian Pine Dataset (IN), the University of Pavia Dataset (UP), and the Salinas Dataset (SV) are compared to, for example... Figure 9 As shown, 3% of the sample data in the Indian Pine Tree dataset was used as the training set, while 0.5% of the sample data in the University of Pavia and Salinas datasets were used as the training set. The proposed method achieves higher overall accuracy, average accuracy, and consistency coefficient on the Indian Pine Tree and Salinas datasets, and the testing time is significantly reduced. Although the improvement in overall accuracy, average accuracy, and consistency coefficient is not significant on the University of Pavia dataset, the testing time is still greatly reduced. These indicators further demonstrate that the proposed method has better classification performance and higher classification efficiency.

[0073] Finally, it should be noted that the above descriptions are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A hyperspectral image classification method based on a dual-branch attention network, characterized in that: The following steps are involved: Step 1, Prepare the dataset: Use a publicly available hyperspectral image dataset; Step 2, Image preprocessing: Dimensionality reduction is performed on the dataset prepared in Step 1, and sample blocks are extracted from the dimensionality-reduced image to obtain a hyperspectral sample; Step 3, Construct the network model: The entire network consists of a main path and two branches. The main path contains a dense convolutional block; the two branches are a spatial branch and a channel branch. The spatial branch contains a 2D convolutional block, a multi-scale convolutional block, and a multi-layer processing block; the channel branch contains a 2D convolutional block, a channel attention block, and a multi-layer processing block; finally, the two branches are connected. In step 3, the dense convolutional blocks in the main path consist of four densely connected convolutional blocks. All convolutional blocks in the main path have similar structures; each convolutional block consists of a batch normalization layer, an activation function layer, and a convolutional layer. The convolutional layers in each dense convolutional block use three-dimensional convolutional layers. The two-dimensional convolutional blocks connecting the main path and branches consist of a batch normalization layer, an activation function layer, and a convolutional layer, and the convolutional layers in these blocks use two-dimensional convolutional layers. The multi-scale convolutional blocks in the spatial branches contain four paths. Path 1 consists of one two-dimensional convolutional block and one spatial attention block. Paths 2 and 3 consist of two two-dimensional convolutional blocks and one spatial attention block, respectively. Path 4 consists of one max pooling layer, one two-dimensional convolutional block, and one spatial attention block, respectively. The tensors obtained from the four paths are concatenated together with a dimension of 1. The two-dimensional convolutional blocks in all paths consist of one convolutional layer and one activation function layer, respectively. The system consists of several layers. The spatial attention block in each line comprises an average pooling layer, a max pooling layer, and a 2D convolutional block. In the spatial attention block, the input passes through an average pooling layer and a max pooling layer, and the output is concatenated in dimension 1 before being input into the 2D convolutional block. This 2D convolutional block consists of a 2D convolutional layer and an activation function layer. In the spatial attention block, the output is multiplied by the initial input. The channel attention blocks in the channel branches consist of an average pooling layer and two 2D convolutional blocks. Each 2D convolutional block consists of a 2D convolutional layer and an activation function layer. Similarly, the output is multiplied by the initial input. The multi-layer processing blocks in both branches consist of a batch normalization layer, an activation function layer, a Dropout layer, and a global average pooling layer. Step 4, Select the loss function and evaluation metric: Calculate the loss function between the classified image and the label until the number of training iterations reaches a set threshold or the loss function value falls within a set range. This indicates that the model parameters have been trained successfully. At the same time, select an evaluation metric to measure the algorithm's accuracy and assess the system's performance. Step 5, Save the model: Select the set of model parameters that performed best during training and save them. When hyperspectral image classification is needed later, simply input the hyperspectral image into the network to obtain the final classified image.

2. The hyperspectral image classification method based on a dual-branch attention network according to claim 1, characterized in that: The public datasets used in step 1 are: Indian Pine Dataset (IN), University of Pavia Dataset (UP), and Salinas Dataset (SV).

3. The hyperspectral image classification method based on a dual-branch attention network according to claim 1, characterized in that: The data dimensionality reduction method in step 2 uses principal component analysis (PCA), and the dimensionality reduction process is as follows: The original hyperspectral image I1 with dimensions W×H×C1 is subjected to covariance matrix eigenvalue decomposition and transformed into a new hyperspectral image I2 with dimensions W×H×C2, where W is the image width, H is the image height, C1 is the number of channels in the original image, and C2 is the number of bands after transformation.

4. The hyperspectral image classification method based on a dual-branch attention network according to claim 3, characterized in that: The sample block extraction process in step 2 is as follows: The new hyperspectral image I2 is cropped into a three-dimensional image patch of size w×w×C1 and input into the network model, where w is the window size.

5. The hyperspectral image classification method based on a dual-branch attention network according to claim 1, characterized in that: In step 4, the loss function is selected as the cross-entropy loss function; the evaluation metrics are overall accuracy, average accuracy, and consistency.

Citation Information

Patent Citations

  • Hyperspectral image classification method based on double-branch spectrum multi-scale attention network

    CN113486851A

  • Hyperspectral image classification method based on double-path convolution and double attention and storage medium

    CN115272776A