CN115272776A - Hyperspectral image classification method based on double-path convolution and double attention and storage medium - Google Patents
Hyperspectral image classification method based on double-path convolution and double attention and storage medium Download PDFInfo
- Publication number
- CN115272776A CN115272776A CN202211169177.5A CN202211169177A CN115272776A CN 115272776 A CN115272776 A CN 115272776A CN 202211169177 A CN202211169177 A CN 202211169177A CN 115272776 A CN115272776 A CN 115272776A
- Authority
- CN
- China
- Prior art keywords
- attention
- convolution
- channel
- way
- spectrum
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 33
- 238000003860 storage Methods 0.000 title claims abstract description 8
- 238000000605 extraction Methods 0.000 claims abstract description 40
- 238000012549 training Methods 0.000 claims abstract description 40
- 238000013507 mapping Methods 0.000 claims abstract description 37
- 230000004927 fusion Effects 0.000 claims abstract description 9
- 238000005070 sampling Methods 0.000 claims abstract description 8
- 238000005520 cutting process Methods 0.000 claims abstract description 4
- 238000005457 optimization Methods 0.000 claims abstract description 4
- 238000007781 pre-processing Methods 0.000 claims abstract description 4
- 230000006870 function Effects 0.000 claims description 53
- 230000004913 activation Effects 0.000 claims description 37
- 238000010606 normalization Methods 0.000 claims description 26
- 238000011176 pooling Methods 0.000 claims description 11
- 238000012360 testing method Methods 0.000 claims description 11
- 238000012545 processing Methods 0.000 claims description 10
- 238000012795 verification Methods 0.000 claims description 8
- 238000004590 computer program Methods 0.000 claims description 3
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 claims description 3
- 230000003247 decreasing effect Effects 0.000 claims 1
- 238000013145 classification model Methods 0.000 abstract description 6
- 230000009286 beneficial effect Effects 0.000 description 7
- 230000003044 adaptive effect Effects 0.000 description 6
- 230000008569 process Effects 0.000 description 6
- 238000010586 diagram Methods 0.000 description 5
- ORILYTVJVMAKLC-UHFFFAOYSA-N Adamantane Natural products C1C(C2)CC3CC1CC2C3 ORILYTVJVMAKLC-UHFFFAOYSA-N 0.000 description 3
- 238000001514 detection method Methods 0.000 description 3
- 230000007246 mechanism Effects 0.000 description 3
- 230000003595 spectral effect Effects 0.000 description 3
- 238000005304 joining Methods 0.000 description 2
- 238000005065 mining Methods 0.000 description 2
- 230000000630 rising effect Effects 0.000 description 2
- 238000010200 validation analysis Methods 0.000 description 2
- 235000008331 Pinus X rigitaeda Nutrition 0.000 description 1
- 235000011613 Pinus brutia Nutrition 0.000 description 1
- 241000018646 Pinus brutia Species 0.000 description 1
- 230000004931 aggregating effect Effects 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 238000013528 artificial neural network Methods 0.000 description 1
- 230000000903 blocking effect Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000013527 convolutional neural network Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000008447 perception Effects 0.000 description 1
- 238000001228 spectrum Methods 0.000 description 1
- 230000001629 suppression Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
- 238000012800 visualization Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/764—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
- G06V10/765—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects using rules for classification or partitioning the feature space
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/77—Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
- G06V10/774—Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/77—Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
- G06V10/80—Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level
- G06V10/806—Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level of extracted features
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/82—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/10—Terrestrial scenes
- G06V20/194—Terrestrial scenes using hyperspectral data, i.e. more or other wavelengths than RGB
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Evolutionary Computation (AREA)
- Multimedia (AREA)
- Software Systems (AREA)
- Artificial Intelligence (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Computing Systems (AREA)
- Health & Medical Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Databases & Information Systems (AREA)
- Image Analysis (AREA)
- Remote Sensing (AREA)
- Biomedical Technology (AREA)
- Life Sciences & Earth Sciences (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Molecular Biology (AREA)
- General Engineering & Computer Science (AREA)
- Mathematical Physics (AREA)
- Spectroscopy & Molecular Physics (AREA)
Abstract
The invention relates to a hyperspectral image classification method and a storage medium based on double-path convolution and double attention, and belongs to the technical field of remote sensing images. The method comprises the following steps of S1, preprocessing an image; s2, cutting a sampling image block, and dividing a data set; s3, respectively sending the image blocks into the constructed space attention double-path convolution module and the constructed channel attention double-path convolution module, and respectively extracting the surface spectrum-space characteristics; s4, performing double-branch feature fusion on the spectrum-space features extracted by the two modules, and inputting the spectrum-space features into a basic double-path convolution network block to further extract the spectrum-space features; s5, sending the extracted spectrum-space characteristic mapping into a classifier for pixel classification, and calculating a loss value; and S6, performing iterative training and model optimization, and obtaining the final hyperspectral image classification mapping by using the final model. The method can realize the extraction of discriminant and fine characteristics, and improve the classification performance and the generalization capability of the classification model.
Description
Technical Field
The invention relates to a hyperspectral image classification method, in particular to a hyperspectral image classification method and a storage medium based on two-way convolution and two-way attention, and belongs to the technical field of convolution neural networks, attention mechanisms and remote sensing images.
Background
The hyperspectral image is usually captured by an image spectrometer carried on an aviation platform, and abundant spectral information and spatial ground object information are recorded. Therefore, the hyperspectral image has very wide application in a plurality of fields such as mining exploration, ecological engineering, precision agriculture and urban planning. As a basic task in the field of hyperspectral image application, hyperspectral image classification is a plurality of basic stones applied in hyperspectral downstream, and for example, hyperspectral image target detection, hyperspectral image anomaly detection, hyperspectral image change detection and the like need to be based on the hyperspectral image classification. The hyperspectral image classification task aims at assigning a unique ground object semantic label to each pixel of the hyperspectral image.
According to the traditional hyperspectral image classification method based on the classical machine learning method, due to the fact that the prior knowledge and the manually set hyper-parameters are compared, ideal ground object assignment results are difficult to obtain in the aspects of discriminative classification and generalization classification of hyperspectral ground object scenes. In recent years, due to strong spectrum-space feature extraction capability, a more ideal result is obtained in a hyperspectral image classification task, and development and application of the hyperspectral image classification task are greatly promoted.
Currently, classification methods based on convolutional neural networks are receiving extensive attention in hyperspectral image classification tasks and demonstrate their excellent performance with their local perception and parameter sharing characteristics. For a hyperspectral image classification task, learning of more discriminative spectrum-space characteristics is the key for achieving more superior hyperspectral image classification results. In a hyperspectral image classification model based on image blocks widely used at present, the image blocks represent central pixels of the image blocks to complete extraction and final classification of spectral-spatial features, and ground object class labels of the image blocks and the ground object class labels are kept consistent. Based on the assumption that the adjacent pixels have a high probability of belonging to the unified ground object class, the neighborhood pixels of the central pixel play an assisting role in the classification process. However, it should be noted that the feature class labels of the neighborhood pixels relative to the center pixel may be different, and the inconsistency is more obvious at the feature class boundary. Therefore, the contribution of the self-adaptive determination neighborhood pixels in the classification process can play a positive role in the ground feature discrimination. On the other hand, in the process of feature learning of the convolution model, different feature channels also make different contributions to the final discriminative power of the model, so that the adaptive enhancement and suppression of channel features is also the key to extract more discriminative feature representation and realize superior classification performance.
Attention machine is a computational element that can achieve adaptive relationship mining to facilitate discriminative feature learning, and has a significant effect in many artificial intelligence tasks. Attention mechanism is often embedded into a model and is trained with the model in a coordinated mode, feature units beneficial to a model task are emphasized through soft weight calculation, and feature units interfering with the model task are restrained to extract more robust features in a refined mode. At present, aiming at a hyperspectral image classification task, how to reasonably and efficiently utilize an attention mechanism to fully mine the characteristics of a spectrum domain and a space domain to enhance the ground object assignment performance of a model still remains to be solved.
Disclosure of Invention
The invention aims to overcome the defects and provide a hyperspectral image classification method based on two-way convolution and two-way attention.
The technical scheme adopted by the invention is as follows:
the hyperspectral image classification method based on two-way convolution and two-way attention comprises the following steps:
s1, carrying out standardization preprocessing on a loaded original image;
s2, cutting a sampling image block of the preprocessed image, and dividing a sampling data set into a training set, a verification set and a test set;
s3, respectively sending the same image block into a constructed space attention double-path convolution module and a channel attention double-path convolution module, and respectively extracting the spectrum-space characteristics facing the self-adaptive space information and the self-adaptive channel information; the step of extracting the spectrum-space characteristics by the spatial attention double-path convolution module comprises the steps of performing primary characteristic extraction on an image block by using two paths of convolution networks arranged in parallel, merging the two paths of primary characteristics, performing channel-by-channel batch normalization and nonlinear activation function processing on the merged spectrum-space characteristics, performing spatial attention mapping extraction after the final batch normalization processing of the module, and then performing nonlinear activation function processing; the step of spectrum-space feature extraction of the channel attention double-path convolution module comprises the steps of performing primary feature extraction on an image block by using two paths of convolution networks which are arranged in parallel, performing channel attention mapping extraction after one path of primary feature extraction, then combining the extracted mapping feature with the other path of primary feature, and performing channel-by-channel batch normalization and nonlinear activation function processing on the combined spectrum-space feature;
s4, performing double-branch feature fusion on the spectrum-space features extracted by the two paths of modules, and inputting the spectrum-space features into a basic two-path convolution network block to further refine the spectrum-space features;
s5, the spectrum-space characteristic mapping obtained by thinning is sent to a classifier for pixel classification, and a loss value is calculated according to the generated label classification probability value;
and S6, performing iterative training and model optimization, and obtaining the final hyperspectral image classification mapping by using the final model.
In the method, the two parallel convolution networks in the spatial attention two-way convolution module in the step S3 are realized by a 1 × 1 convolution layer, the output channel of the 1 × 1 convolution layer is configured with batch normalization operation and a ReLU nonlinear activation function, the output channel of the 3 × 3 convolution layer is configured with batch normalization operation and a ReLU nonlinear activation function; and S3, combining the two primary characteristics in the spatial attention two-way convolution module by using element-by-element addition. The spatial attention mapping extraction is realized through a spatial attention module, firstly, input spectrum-spatial feature maps are subjected to feature abstraction along channel dimensions by respectively using maximum pooling and mean pooling to respectively obtain a 2D spatial feature descriptor, the obtained two spatial feature descriptors are subjected to channel dimension splicing, then are sent to a 7 x 7 convolution layer for attention mapping learning, and are activated by joining a Sigmoid nonlinear function to obtain spatial attention mapping (soft weight spatial attention mapping capable of reflecting the importance degree of pixel information in an image block). Step S3, the step of spectrum-space feature extraction by the space attention double-path convolution module further comprises the step of multiplying the space attention mapping processed by the nonlinear activation function with the spectrum-space feature graph originally input by the space attention double-path convolution module element by element in the space dimension so as to emphasize neighborhood features beneficial to feature extraction and inhibit the neighborhood features having interference on feature extraction.
S3, one path of the two paths of convolution networks arranged in parallel in the channel attention two-path convolution module is realized by a 1 x 1 convolution layer, the output channel of the 1 x 1 convolution layer is configured with batch normalization operation and a ReLU nonlinear activation function, the other path is realized by a 3 x 3 convolution layer, and the output channel of the 3 x 3 convolution layer is configured with batch normalization operation and a ReLU nonlinear activation function and then connected with channel attention mapping extraction; and S3, combining the mapping characteristics and the preliminary characteristics in the channel attention double-path convolution module by using element-by-element addition. S3, channel attention mapping extraction is achieved through a channel attention module, firstly, mean pooling is used for carrying out feature abstraction on an input spectrum-space feature map along a space dimension to obtain a 1D channel feature descriptor, then a small double-layer full-connection group is connected to achieve rising dimension and falling dimension extraction of channel features, a nonlinear activation function embedded in the double-layer full-connection group is a ReLU function, and then a Sigmoid nonlinear function is used for further nonlinear activation to obtain channel attention mapping (soft weight channel attention mapping capable of reflecting different channel importance degrees in the feature mapping). And S3, the step of extracting the spectrum-space characteristics by the channel attention two-way convolution module further comprises the step of multiplying the combined spectrum-space characteristics processed by the channel-by-channel batch normalization and the nonlinear activation function with the spectrum-space characteristic diagram originally input by the channel attention two-way convolution module element by element in the channel dimension so as to reinforce the self-adaptive channel characteristics.
And step 4, the dual-branch feature fusion is carried out by element-by-element addition, and the batch normalization processing is carried out channel-by-channel after the dual-branch feature fusion, so that the offset in the batch is eliminated, and the stability of feature extraction is improved. The basic two-way convolutional network block described in step S4 is composed of 1 × 1 and 3 × 3 convolutional layer branches, element-by-element addition operation, batch normalization operation, and ReLU activation function.
And the classifier in the step S5 uses a classical three-layer classifier to carry out final hyperspectral image pixel classification and comprises a mean pooling layer, a flattening layer and a full-connection layer. The final classifier uses a softmax activation function to predict and generate label classification probability, and uses a cross entropy loss function to calculate a loss value, wherein the cross entropy loss function is expressed as:
wherein,the calculated loss value is represented by the value,Nrepresenting the number of samples of the single batch training set in which the model employs the small batch training mode, here a value of 32,Krepresenting the number of categories in the data scene,nandkseparately index the first of the training set of the current batchnSample and class labelsetkThe number of the categories is one,y n represents the first in the current batch training setnA true value of a number of samples of the hyperspectral image block,represents an indication function wheny n Is composed ofkWhen the temperature of the water is higher than the set temperature,is 1; if not, then,is 0, and in addition to this,represents the considered secondnSample of hyperspectral image blockkThe softmax function of the category outputs a probability value.
The iterative training and optimization model in the step S6 uses an Adam optimizer, the learning rate is set to be 0.001, the size of a single batch training set in a small batch training mode is 32, in model training, loss values corresponding to the training set and the verification set are calculated after each iteration is completed, and the model after 100 iterations is used as a final model. (iterative training is based on a training set, one iteration of the model is the process of inputting all training set samples into the proposed model after one pass; and the Adam optimizer overall parameters are set for the stages including training, verifying and testing).
It is a further object of the present invention to provide a computer readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out the steps of the hyperspectral image classification method based on two-way convolution and two-way attention as described above.
The beneficial effects of the invention are as follows:
(1) Convolution units with two scales of 1 multiplied by 1 and 3 multiplied by 3 convolution are used as basic branches to form a parallel feature extraction unit and are properly embedded into an attention module, and spatial attention and channel attention are embedded into a basic double-path convolution block to obtain more robust spectrum-space features in a spatial domain and a channel domain, so that more precise and more discriminant spectrum-space feature extraction in the spatial dimension and the channel dimension is realized;
(2) The two attention double-path convolution modules are integrally arranged in parallel, namely, neighborhood features beneficial to feature extraction can be emphasized, neighborhood features with interference on feature extraction can be restrained, and adaptive channel features can be strengthened, so that beneficial spectrum-space features in a space domain and a channel domain can be adaptively mined; the two adaptive attention modules can be seamlessly embedded into the proposed hyperspectral image classification model and trained along with a forward-backward propagation algorithm, and finally the feature distinguishing capability of the proposed classification model is enhanced;
(3) According to the method, the superior hyperspectral image classification result is realized by the cooperation of the two attention double-path convolution modules which are arranged in parallel, the feature fusion, the further double-path convolution module and the like, the model performance and the generalization capability on a hyperspectral image classification task are improved, and finally a foundation is laid for the superior ground feature distinguishing performance of the proposed model in a plurality of scenes.
Drawings
FIG. 1 is a schematic diagram of a model of the process of the present invention;
FIG. 2 is a flow chart of the method of the present invention;
FIG. 3 is a block diagram of a spatial attention module according to the present invention;
FIG. 4 is a block diagram of a channel attention module according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to specific embodiments and the accompanying drawings.
Example 1
A hyperspectral image classification method based on two-way convolution and two-way attention comprises the following steps:
s1, image preprocessing
And respectively carrying out mean-variance standardization treatment on each spectral dimension of all pixel samples in the loaded original image so as to accelerate the convergence speed of the proposed classification model in the training process.
S2, image cutting blocking and data set splitting
Firstly, the image block of the preprocessed image is cut, and finally the image block is used as an input unit of the proposed classification model to judge the ground feature type. Specifically, the boundary of the image is first filled with 0, and then random sampling is performed on each category in each data scene according to a set proportion to obtain a training sample, a verification sample and a test sample. For example, for the Indian Pines dataset and Kennedy Space Center dataset, the training and validation samples account for 10% and 1%, respectively, with the remainder being used as sample tests. For the Pavia University dataset, training samples and validation samples account for 5% and 0.5%, respectively, with the remainder used as sample tests. When the number of certain sample classes is too small to meet the sampling requirement of the verification set, the lowest sampling number is set to ensure that each class is uniformly sampled approximately according to the proportion of the number of class samples. Specifically, when each pixel sample is sampled, an image block with the size of 9 × 9 × b is cut by taking the pixel as a center, wherein 9 × 9 represents the size of a spatial window of the image block, and b is the original spectral dimension of the image. And finally, respectively aggregating the training samples, the verification samples and the test samples of each category into a training set, a verification set and a test set.
S3, feature extraction is carried out on the space attention double-path convolution module and the channel attention double-path convolution module simultaneously
As shown in fig. 1, in the present invention, an input spectrum-space image block is first sent to a space attention two-way convolution module and a channel attention two-way convolution module respectively to perform spectrum-space feature extraction facing adaptive space information and adaptive channel information, respectively. The proposed spatial attention two-way convolution module and channel attention two-way convolution module are based on the proposed two-way convolution block, which is implemented by two parallel convolution networks, namely, a 1 × 1 convolution layer, a 3 × 3 convolution layer and a 3 × 3 convolution layer, wherein the output channel of the 1 × 1 convolution layer is configured with batch normalization operation and ReLU nonlinear activation function. The merging of the two-way features is then done using element-by-element addition. The combined spectral-spatial features are further processed by batch normalization and ReLU nonlinear activation functions channel by channel. For the spatial attention two-way convolution module, spatial attention is used to be embedded between the last batch normalization of the module and the ReLU nonlinear activation function, wherein the spatial attention module used is the spatial attention module in the classical CBAM attention module as shown in FIG. 3. For the channel attention two-way convolution module, the channel attention is used to be embedded between the 3 × 3 convolution layer branches and the element-by-element addition, wherein the adopted channel attention module is the classical SE attention module as shown in fig. 4.
For the spatial attention module, firstly, performing feature abstraction on a spectrum-spatial feature map input by the module by respectively using maximum pooling and mean pooling along channel dimensions to respectively obtain a 2D spatial feature descriptor, splicing the two obtained spatial descriptors in the channel dimensions, sending the two spatial descriptors into a 7 × 7 convolution layer for attention mapping learning, and joining a Sigmoid nonlinear function for activation to obtain spatial attention mapping (soft weight spatial attention mapping capable of reflecting the importance degree of pixel information in an image block). Finally, the spatial attention mapping processed by the nonlinear activation function and the spectrum-spatial feature graph originally input by the spatial attention module are subjected to element-by-element multiplication in spatial dimension to emphasize neighborhood features beneficial to feature extraction and inhibit the neighborhood features having interference on feature extraction. For the channel attention module, firstly, the spectral-spatial feature map input by the module is subjected to feature abstraction along the spatial dimension by using mean pooling to obtain a 1D channel feature descriptor. Then a small double-layer full-connection group is connected to realize the rising dimension and the falling dimension extraction of the channel characteristics, the nonlinear activation function embedded therein is still the ReLU function used before. The channel attention map (a soft weighted channel attention map that may reflect different channel importance levels in the feature map) is then derived using a Sigmoid nonlinear function for further nonlinear activation. Finally, the spectrum-space characteristics after being combined and processed by the channel-by-channel batch normalization and the ReLU nonlinear activation function are multiplied element by element in the channel dimension by the spectrum-space characteristic diagram originally input by the channel attention module, so that the self-adaptive channel characteristics are strengthened.
Spatial attention and channel attention are embedded into the basic two-way convolution module, so that spectrum-spatial feature extraction with more fineness and more discriminativity in spatial dimension and channel dimension is realized, and finally a foundation is laid for the superior ground feature discrimination performance of the proposed model in multiple scenes. In addition to this, the two attention two-way convolution modules are arranged in parallel as a whole, so that the beneficial spectral-spatial features in the spatial domain and the channel domain can be adaptively mined.
S4, fusing double-branch characteristics, and further extracting characteristics by using basic two-way convolution network blocks
As shown in fig. 1, spectral-spatial feature mapping after refinement and extraction is performed by the spatial attention two-way convolution module and the channel attention two-way convolution module, dual-branch feature fusion is performed by element-by-element addition, and then batch normalization is performed channel-by-channel to eliminate offset in batches, thereby increasing the stability of feature extraction. And then, sending a basic two-way convolution network block to further extract the spectral-spatial characteristics, wherein the basic two-way convolution network block consists of 1 x 1 and 3 x 3 convolution layer branches, element-by-element addition operation, batch normalization operation and a ReLU activation function. The basic two-way convolutional network block further enhances the feature extraction capability of the proposed model.
S5, sending the obtained spectrum-space characteristic mapping into a classifier for classification, and calculating a loss value
As shown in FIG. 1, the invention uses a classic three-layer classifier to perform the final classification of the hyperspectral image pixels, which comprises a mean pooling layer, a flattening layer and a full link layer. The final classifier uses a softmax activation function to predict and generate label classification probability, and uses a cross entropy loss function to calculate a loss value, wherein the cross entropy loss function is expressed as:
wherein,the calculated loss value is represented by the value,Nsample representing single batch training set in small batch training mode adopted by modelThe number, here the value 32,Krepresenting the number of categories in the data scene,nandkseparately index the first of the training set of the current batchnSample and class labelsetkThe number of the categories is one,y n represents the first in the training set of the current batchnA true value of a number of samples of the hyperspectral image block,represents an indicator function wheny n Is composed ofkWhen the temperature of the water is higher than the set temperature,is 1; if not, then,is 0, and in addition to this,represents the considered secondnSample of hyperspectral image blockkThe softmax function of the category outputs a probability value.
And S6, iteratively training and optimizing the model, and obtaining the final hyperspectral image classification mapping (namely the classified ground feature scene visualization map) by using the final model. And iteratively training the proposed model in a back propagation mode according to the loss value, and updating the parameters of the model. Iterative training is performed based on a training set. The network model provided by the invention uses an Adam optimizer, the learning rate is set to be 0.001, and the size of a single batch training set in a small batch training mode is 32. In model training, calculating loss values corresponding to a training set and a verification set after each iteration is completed, and using a model after 100 iterations as a final model. In the model testing stage, the cut image block testing set is used for conducting model testing under different hyperspectral scenes, the classification performance of the model in each hyperspectral scene can be quantitatively measured according to the corresponding truth labels, and the model can obtain a visual image of the whole scene by assigning class labels to each pixel in the scene.
Example 2
The present embodiment provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps in the hyperspectral image classification method based on two-way convolution and two-way attention as described in embodiment 1 above.
The above description is only exemplary of the present invention and should not be taken as limiting the invention, as any modification, equivalent replacement, or improvement made within the spirit and scope of the present invention should be included in the present invention.
Claims (10)
1. The hyperspectral image classification method based on two-way convolution and two-way attention is characterized by comprising the following steps of:
s1, carrying out standardized preprocessing on a loaded original image;
s2, cutting the pre-processed image into sampling image blocks, and dividing a sampling data set into a training set, a verification set and a test set;
s3, respectively sending the same image block into a constructed space attention double-path convolution module and a constructed channel attention double-path convolution module, and respectively extracting the spectrum-space characteristics facing the self-adaptive space information and the self-adaptive channel information; the step of extracting the spectrum-space characteristics by the spatial attention double-path convolution module comprises the steps of performing primary characteristic extraction on an image block by using two paths of convolution networks arranged in parallel, merging the two paths of primary characteristics, performing channel-by-channel batch normalization and nonlinear activation function processing on the merged spectrum-space characteristics, performing spatial attention mapping extraction after the final batch normalization processing of the module, and then performing nonlinear activation function processing; the step of spectrum-space feature extraction of the channel attention double-path convolution module comprises the steps of performing primary feature extraction on an image block by using two paths of convolution networks which are arranged in parallel, performing channel attention mapping extraction after one path of primary feature extraction, then combining the extracted mapping feature with the other path of primary feature, and performing channel-by-channel batch normalization and nonlinear activation function processing on the combined spectrum-space feature;
s4, performing double-branch feature fusion on the spectrum-space features extracted by the two paths of modules, and inputting the spectrum-space features into a basic two-path convolution network block to further refine the spectrum-space features;
s5, the spectrum-space characteristic mapping obtained by thinning is sent to a classifier for pixel classification, and a loss value is calculated according to the generated label classification probability value;
and S6, performing iterative training and model optimization, and obtaining the final hyperspectral image classification mapping by using the final model.
2. The hyperspectral image classification method based on two-way convolution and two-way attention according to claim 1 is characterized in that the two-way parallel convolution networks in the spatial attention two-way convolution module in the step S3 are realized by a 1 × 1 convolution layer, an output channel of the 1 × 1 convolution layer is configured with batch normalization operation and a ReLU nonlinear activation function, and one channel is realized by a 3 × 3 convolution layer, and an output channel of the 3 × 3 convolution layer is configured with batch normalization operation and a ReLU nonlinear activation function; and S3, combining the two primary characteristics in the spatial attention two-way convolution module by using element-by-element addition.
3. The hyperspectral image classification method based on two-way convolution and two-way attention according to claim 1 is characterized in that the spatial attention mapping extraction is realized through a spatial attention module, firstly, feature abstraction is respectively performed on an input spectrum-spatial feature map by using maximum pooling and mean pooling along channel dimensions, respectively, a 2D spatial feature descriptor is obtained, the obtained two spatial feature descriptors are spliced through the channel dimensions, and then are sent to a 7 x 7 convolutional layer for attention mapping learning, and a Sigmoid nonlinear function is linked for activation, so that spatial attention mapping is obtained.
4. The hyperspectral image classification method based on two-way convolution and two-way attention according to claim 1 is characterized in that the step of performing spectrum-space feature extraction by the spatial attention two-way convolution module in step S3 further comprises the step of performing element-by-element multiplication on the spatial attention map processed by the nonlinear activation function and the spectrum-space feature map originally input by the spatial attention two-way convolution module in the spatial dimension.
5. The hyperspectral image classification method based on two-way convolution and two-way attention according to claim 1 is characterized in that the two-way convolution network one arranged in parallel in the step S3 channel attention two-way convolution module is realized by a 1 x 1 convolution layer, the output channel of the 1 x 1 convolution layer is configured with batch normalization operation and a ReLU nonlinear activation function, one is realized by a 3 x 3 convolution layer, the output channel of the 3 x 3 convolution layer is configured with batch normalization operation and a ReLU nonlinear activation function, and is followed by channel attention mapping extraction; and S3, combining the mapping characteristics and the preliminary characteristics in the channel attention double-path convolution module by using element-by-element addition.
6. The method for classifying hyperspectral images based on two-way convolution and two-way attention according to claim 1 is characterized in that the step S3 of extracting the channel attention mapping is realized through a channel attention module, firstly, input spectrum-space feature maps are subjected to feature abstraction along space dimensions by using mean pooling to obtain a 1D channel feature descriptor, then, a small-sized double-layer fully-connected group is connected to realize the dimension increasing and dimension decreasing extraction of channel features, wherein a nonlinear activation function embedded in the double-layer fully-connected group is a ReLU function, and then, a Sigmoid nonlinear function is used for further nonlinear activation to obtain the channel attention mapping.
7. The hyperspectral image classification method based on two-way convolution and two-way attention according to claim 1 is characterized in that the step of extracting the spectrum-space features by the channel attention two-way convolution module in the step S3 further comprises the step of multiplying the combined spectrum-space features processed by batch normalization and nonlinear activation function with the spectrum-space feature map originally input by the channel attention two-way convolution module element by element in the channel dimension.
8. The hyperspectral image classification method based on two-way convolution and two-note as claimed in claim 1 is characterized in that the two-branch feature fusion of step S4 is performed by element-by-element addition, the two-branch feature fusion is followed by channel-by-channel batch normalization processing, and the basic two-way convolution network block consists of two convolution layer branches of 1 × 1 and 3 × 3, element-by-element addition operation, batch normalization operation and ReLU activation function.
9. The hyperspectral image classification method based on two-way convolution and two-way attention according to claim 1 is characterized in that the classifier in the step S5 uses a classical three-layer classifier to perform final hyperspectral image pixel classification, the final classifier uses a softmax activation function to predict and generate a label classification probability, a cross entropy loss function is used to calculate a loss value, and the cross entropy loss function is expressed as:
wherein,the calculated loss value is represented by the value,Nrepresenting the number of samples of the single batch training set in which the model employs the small batch training mode, here a value of 32,Krepresenting the number of categories in the data scene,nandkseparately index the first of the training set of the current batchnSample and class labelsetkThe number of the categories is one,y n represents the first in the training set of the current batchnA true value of each of the hyperspectral image patch samples,represents an indication function wheny n Is composed ofkWhen the temperature of the water is higher than the set temperature,is 1; if not, then,is 0, and in addition to this,represents the considered secondnA hyperspectral image block sample belongs tokThe softmax function of the category outputs a probability value.
10. A storage medium being a computer readable storage medium having stored thereon a computer program, characterized in that the program, when being executed by a processor, is adapted to carry out the steps of the method for hyperspectral image classification based on two-way convolution and two-note according to any of the claims 1-9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211169177.5A CN115272776B (en) | 2022-09-26 | 2022-09-26 | Hyperspectral image classification method based on double-path convolution and double attention and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211169177.5A CN115272776B (en) | 2022-09-26 | 2022-09-26 | Hyperspectral image classification method based on double-path convolution and double attention and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115272776A true CN115272776A (en) | 2022-11-01 |
CN115272776B CN115272776B (en) | 2023-01-20 |
Family
ID=83756415
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211169177.5A Active CN115272776B (en) | 2022-09-26 | 2022-09-26 | Hyperspectral image classification method based on double-path convolution and double attention and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115272776B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116229178A (en) * | 2023-03-14 | 2023-06-06 | 安徽大学 | Image classification method for small quantity of training samples based on Transformer |
CN117152616A (en) * | 2023-09-12 | 2023-12-01 | 电子科技大学 | Remote sensing image typical object extraction method based on spectrum enhancement and double-path coding |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111667489A (en) * | 2020-04-30 | 2020-09-15 | 华东师范大学 | Cancer hyperspectral image segmentation method and system based on double-branch attention deep learning |
CN111832620A (en) * | 2020-06-11 | 2020-10-27 | 桂林电子科技大学 | Image emotion classification method based on double-attention multilayer feature fusion |
CN113642634A (en) * | 2021-08-12 | 2021-11-12 | 南京邮电大学 | Shadow detection method based on mixed attention |
WO2021248687A1 (en) * | 2020-06-10 | 2021-12-16 | 南京理工大学 | Driving fatigue detection method and system combining pseudo 3d convolutional neural network and attention mechanism |
CN114067107A (en) * | 2022-01-13 | 2022-02-18 | 中国海洋大学 | Multi-scale fine-grained image recognition method and system based on multi-grained attention |
CN114187261A (en) * | 2021-12-07 | 2022-03-15 | 天津大学 | Non-reference stereo image quality evaluation method based on multi-dimensional attention mechanism |
CN114418003A (en) * | 2022-01-20 | 2022-04-29 | 北京科技大学 | Double-image identification and classification method based on attention mechanism and multi-size information extraction |
WO2022127227A1 (en) * | 2020-12-15 | 2022-06-23 | 西安交通大学 | Multi-view semi-supervised lymph node classification method and system, and device |
CN114663309A (en) * | 2022-03-23 | 2022-06-24 | 山东大学 | Image defogging method and system based on multi-scale information selection attention mechanism |
CN114821164A (en) * | 2022-04-13 | 2022-07-29 | 北京工业大学 | Hyperspectral image classification method based on twin network |
-
2022
- 2022-09-26 CN CN202211169177.5A patent/CN115272776B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111667489A (en) * | 2020-04-30 | 2020-09-15 | 华东师范大学 | Cancer hyperspectral image segmentation method and system based on double-branch attention deep learning |
WO2021248687A1 (en) * | 2020-06-10 | 2021-12-16 | 南京理工大学 | Driving fatigue detection method and system combining pseudo 3d convolutional neural network and attention mechanism |
CN111832620A (en) * | 2020-06-11 | 2020-10-27 | 桂林电子科技大学 | Image emotion classification method based on double-attention multilayer feature fusion |
WO2022127227A1 (en) * | 2020-12-15 | 2022-06-23 | 西安交通大学 | Multi-view semi-supervised lymph node classification method and system, and device |
CN113642634A (en) * | 2021-08-12 | 2021-11-12 | 南京邮电大学 | Shadow detection method based on mixed attention |
CN114187261A (en) * | 2021-12-07 | 2022-03-15 | 天津大学 | Non-reference stereo image quality evaluation method based on multi-dimensional attention mechanism |
CN114067107A (en) * | 2022-01-13 | 2022-02-18 | 中国海洋大学 | Multi-scale fine-grained image recognition method and system based on multi-grained attention |
CN114418003A (en) * | 2022-01-20 | 2022-04-29 | 北京科技大学 | Double-image identification and classification method based on attention mechanism and multi-size information extraction |
CN114663309A (en) * | 2022-03-23 | 2022-06-24 | 山东大学 | Image defogging method and system based on multi-scale information selection attention mechanism |
CN114821164A (en) * | 2022-04-13 | 2022-07-29 | 北京工业大学 | Hyperspectral image classification method based on twin network |
Non-Patent Citations (4)
Title |
---|
PEIDA WU ET AL: "Residual Group Channel and Space Attention Network for Hyperspectral Image Classification", 《REMOTE SENSING》 * |
TIANYU ZHANG ET AL: "A Spectral Spatial Attention Fusion with Deformable Convolutional Residual Network for Hyperspectral Image Classification", 《REMOTE SENSING》 * |
冯权泷: "土地利用/覆被深度学习遥感分类研究综述", 《农业机械学报》 * |
罗勇琛: "融合空间和通道注意力机制的害虫图像识别方法研究", 《中国优秀硕士学位论文数据库》 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116229178A (en) * | 2023-03-14 | 2023-06-06 | 安徽大学 | Image classification method for small quantity of training samples based on Transformer |
CN116229178B (en) * | 2023-03-14 | 2023-11-24 | 安徽大学 | Image classification method for small quantity of training samples based on Transformer |
CN117152616A (en) * | 2023-09-12 | 2023-12-01 | 电子科技大学 | Remote sensing image typical object extraction method based on spectrum enhancement and double-path coding |
Also Published As
Publication number | Publication date |
---|---|
CN115272776B (en) | 2023-01-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115249332B (en) | Hyperspectral image classification method and device based on space spectrum double-branch convolution network | |
CN113159051B (en) | Remote sensing image lightweight semantic segmentation method based on edge decoupling | |
CN115272776B (en) | Hyperspectral image classification method based on double-path convolution and double attention and storage medium | |
CN114092832B (en) | High-resolution remote sensing image classification method based on parallel hybrid convolutional network | |
CN108564115A (en) | Semi-supervised polarization SAR terrain classification method based on full convolution GAN | |
CN111126202A (en) | Optical remote sensing image target detection method based on void feature pyramid network | |
CN112884758B (en) | Defect insulator sample generation method and system based on style migration method | |
CN116524361A (en) | Remote sensing image change detection network and detection method based on double twin branches | |
CN112232328A (en) | Remote sensing image building area extraction method and device based on convolutional neural network | |
CN114255403A (en) | Optical remote sensing image data processing method and system based on deep learning | |
CN117475236B (en) | Data processing system and method for mineral resource exploration | |
CN117557775B (en) | Substation power equipment detection method and system based on infrared and visible light fusion | |
CN117315381B (en) | Hyperspectral image classification method based on second-order biased random walk | |
CN114048468A (en) | Intrusion detection method, intrusion detection model training method, device and medium | |
CN111815526B (en) | Rain image rainstrip removing method and system based on image filtering and CNN | |
CN116012653A (en) | Method and system for classifying hyperspectral images of attention residual unit neural network | |
CN113837191A (en) | Cross-satellite remote sensing image semantic segmentation method based on bidirectional unsupervised domain adaptive fusion | |
Zhou et al. | MSAR‐DefogNet: Lightweight cloud removal network for high resolution remote sensing images based on multi scale convolution | |
CN115565019A (en) | Single-channel high-resolution SAR image ground object classification method based on deep self-supervision generation countermeasure | |
CN110263638A (en) | A kind of video classification methods based on significant information | |
CN112818818B (en) | Novel ultra-high-definition remote sensing image change detection method based on AFFPN | |
CN112801185B (en) | Network security situation understanding and evaluating method based on improved neural network | |
CN112330562A (en) | Heterogeneous remote sensing image transformation method and system | |
CN115174421B (en) | Network fault prediction method and device based on self-supervision unwrapping hypergraph attention | |
CN115987730A (en) | Signal modulation identification method based on tree-shaped perception fusion convolutional network |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |