CN-116681946-B - Hyperspectral classification method based on band erasure and contrast learning
Abstract
The invention provides a hyperspectral classification method based on band erasure and contrast learning. The hyperspectral data are collected, band erasing is carried out to obtain two hyperspectral images with bands removed, pretreatment is carried out to obtain sample patches of two branches of a comparison learning network respectively, a gradual change mask is used for covering all patches of an upper branch, patches of a lower branch are not operated, random shielding is carried out to the patches of the two branches respectively, data enhancement is carried out to obtain positive sample pairs, super parameters are set, the positive sample pairs are input into the comparison learning network, network parameters and characteristics are saved after training is completed, the extracted characteristics and labels are used as training sets, and a classifier is trained to realize hyperspectral classification. According to the method, a plurality of data enhancement methods suitable for hyperspectral data are combined to a contrast learning method, the potential of contrast learning in the hyperspectral field is explored, the classification precision is improved to a new level, and the classification of the spectral images can be effectively realized.
Inventors
- LI XIAORUN
- LI JINHUI
- CHEN SHUHAN
- WANG JING
Assignees
- 浙江大学
Dates
- Publication Date
- 20260505
- Application Date
- 20230612
Claims (5)
- 1. The hyperspectral classification method based on band erasure and contrast learning is characterized by comprising the following steps of: Step 1, collecting hyperspectral data; Step 2, performing band erasure on original hyperspectral data to obtain hyperspectral data X 0 and X 1 with non-repeated bands, respectively preprocessing the two hyperspectral data to obtain sample patch groups P 0 and P 1 for two branches of a contrast learning network, wherein each pixel corresponds to two patches taking the pixel as a center, and taking the two patches as a sample pair; The band erasure is as follows: Extracting an odd layer and an even layer from the original hyperspectral data respectively to obtain two original hyperspectral data with non-repeated wave bands, wherein the two obtained original hyperspectral data are obtained by erasing half of wave bands from the original hyperspectral data, and the wave bands are not repeated; Respectively preprocessing two hyperspectral data, namely respectively performing principal component analysis on the hyperspectral data X 0 and X 1 to respectively obtain d principal component graphs, filling the edges of the principal component graphs with 0, then respectively dividing the principal component graphs into sample patches by using a sliding window of s X s by using a step length 1 to obtain two groups of sample patch groups P 0 and P 1 , wherein d and s are preset values, and the patch groups P 0 and P 1 are a series of s X s d three-dimensional data; Step 3, covering the patch serving as the branch on the comparison learning network by using a gradual change mask, wherein the patch of the lower branch does not operate, and the upper branch of the comparison learning network is an online network branch and the lower branch is a target network branch; the step 3 specifically comprises the following steps: The gradient mask is a weight matrix with highest central value and lower central value, the size is s x s, the same as the patch size, the weight of the center is set to be 1, the weights of four vertexes are set to be 0, and other values are linearly interpolated according to the distance from the center, and the formula is as follows: Wherein the mask is a gradient mask matrix, and (i, j) is the position of an element in the mask, and (center ) is the center of the mask; multiplying the corresponding element of the patch P 0 of the upper branch by a gradual change mask to obtain a new patch P 0 ' after weighting; the patch P 1 of the lower branch is not processed by a gradual change mask; step 4, randomly shielding the patches of the two branches processed in the step 3 respectively, and carrying out data enhancement to obtain a positive sample pair (v i ,v i '); Step 5, setting super parameters, inputting all positive sample pairs into a comparison learning network to perform network training, and storing the trained network parameters and characteristics; step 6, taking the extracted characteristics and the marked categories as training sets, and training a classifier by using the training sets; and 7, after the hyperspectral data to be classified are processed in the steps 2 to 4, classifying by using a trained contrast learning network and a classifier.
- 2. The hyperspectral classification method based on band erasure and contrast learning as claimed in claim 1 wherein the random occlusion step of step 4 comprises the steps of: 4.1 Setting the area of the shielding rectangle, specifically setting the area of the shielding rectangle to be a fixed duty ratio of the patch area or a random value within a certain range; 4.2 Setting an aspect ratio; 4.3 Calculating the length and width of the rectangle; 4.4 Randomly selecting a starting point of a rectangle in the patch, and replacing the value on the original pixel with the shielding value; The shielding value is a set constant, and the pixels in the center of the patch are required to be reserved for shielding key information during random shielding, and shielding is performed on each layer of the patch simultaneously.
- 3. The hyperspectral classification method based on band erasure and contrast learning as claimed in claim 1 wherein the data enhancement of step 4 is one or more of random clipping, color distortion, random flipping, random gray scale, gaussian noise.
- 4. The hyperspectral classification method based on band erasure and contrast learning according to claim 1, wherein the contrast learning network is BYOL networks, and the structure of BYOL networks is divided into an upper branch online network and a lower branch target network; Inputting (v i ,v i ') into BYOL network, wherein v i is input into online network, coded by encoder to obtain characterization u i =f online (v i ), mapped z i =g online (u i by mapper), predicted result k i =q online (z i );v i ' is input into target network, coded by encoder to obtain u i '=f target (v i '), mapped to obtain z i '=g target (u i '); The operation process of the online network and the target network is expressed as the following formula: k i =q online (g online (f online (v i ))) z i '=g target (f target (v i ′)) The BYOL network optimization target is that the positive example of the online network approaches to the positive example of the target network in the representation space, the online network parameters are updated by using a loss function, the parameters of the target network are updated by using an Exponential Moving Average (EMA) according to the online network parameters, the updated step length is controlled by a super parameter tau, and the loss is calculated according to the output of two branches The k i and z i ' are first two-norm regularized, Then taking the two norms of the difference between the two, as the formula: Exchanging input patches of two branches, i.e. v i to the target network, v i ' to the on-line network, calculating to obtain the loss function The final loss function of the BYOL network is: The process of parameter update can be expressed as: W target ←τW target +(1-τ)W online Wherein W online is a parameter of the online network, W target is a parameter of the target network, eta is a learning rate, and tau is a weight of parameter update; after the training reaches the iteration times, the parameters of the encoder and the mapper are saved, and the output of the mapper is used as a characteristic and is input into the classifier.
- 5. The hyperspectral classification method based on band erasure and contrast learning as claimed in claim 4, wherein the encoder is composed of three-dimensional convolution layers, one two-dimensional convolution layer and one full-connection layer, wherein the full-connection layer is input after convolution through flattening operation, each layer follows a batch of regularization layers and ReLU activation functions, the mapper is composed of the full-connection layer, the regularization layers and the ReLU activation functions, and the predictor is composed of the full-connection layer, the regularization layers and the ReLU activation functions.
Description
Hyperspectral classification method based on band erasure and contrast learning Technical Field The invention belongs to the field of hyperspectral image classification, and particularly relates to a hyperspectral classification method based on band erasure and contrast learning. Background In recent years, hyperspectral images are increasingly widely used because of the abundant spectral and spatial information contained therein. Compared with visible light images or infrared images, the hyperspectral images have hundreds to thousands of wave bands, can distinguish the surface materials with diagnostic spectral characteristics with enough spectral resolution, and have wide application in vegetation investigation, atmospheric research, military detection, environmental monitoring and other aspects. Hyperspectral image classification is one of important research directions in the hyperspectral field, generally refers to classification of single pixels, and abundant spectral information contained in single pixels is a main basis of classification. With the progress of hardware technology, the spatial resolution of the hyperspectral sensor is also higher and higher, and the spatial information around the target pixel is also applied. Currently, combining spectral features and spatial features has become the mainstay of hyperspectral image classification. However, the characteristics of numerous bands of hyperspectral images also bring difficulty to classification, huge network scale and computer memory are needed if the hyperspectral images are directly trained without processing due to huge data scale, and meanwhile, higher spectral resolution brings redundancy of spectral information, so that the data scale can be reduced by a dimension reduction method, and key information can be reserved. Feature extraction is a common means for reducing the data dimension of hyperspectral images, which reduces the data dimension of the original input, and extracts or sorts out effective features for subsequent use. Typical feature extraction means include PCA, ICA, LDA, MDS, etc., some of which are still widely used for preprocessing of hyperspectral data due to their simplicity and efficiency. With the increasing maturity of deep learning algorithms, more and more deep learning algorithms are proposed to extract hyperspectral image features. The current common classification means is to extract spectral features or spatial features by using a supervised or unsupervised feature extraction algorithm, and then train a classifier by using the features. Feature extraction algorithms based on supervised deep learning have been developed earlier. In supervised learning, the convolutional neural network CNN occupies an important part, and develops from a one-dimensional convolutional network only extracting spectral features to a two-dimensional convolutional network and a three-dimensional convolutional network extracting spatial spectral information, and Roy et al provides HybridSN networks by combining two-dimensional convolutional and three-dimensional convolutional, so that classification accuracy is further improved. Zhong et al introduced a classical residual network into the hyperspectral domain, designing SSRN networks. In addition to CNN, networks such as DRNN, DFFN, etc. also achieve certain effects in hyperspectral classification. However, supervised learning often relies on tagged data, and requires enough tagged samples to achieve a good training effect. For hyperspectral images, large manpower and time cost are required for collecting and marking data, so that the hot spot of the feature extraction algorithm gradually progresses to unsupervised deep learning in recent years. The essential difference between the unsupervised learning and the supervised learning is that the training data is not labeled, the samples are classified according to the similarity among the samples, the distance among the similar data is reduced, and the distance among the different similar data is pulled. The potential of the model can be excited without the limitation of the label, so that the model can be immersed into data to perform autonomous discovery and experience, more potential characteristics are learned, and the trained model has better robustness and generalization. Discriminant learning is modeling conditional probabilities and learning optimal boundaries between different classes. Contrast learning is a typical discriminant learning algorithm in deep learning, and the main idea is to learn characterization by comparing positive and negative samples in potential space. The positive samples are a pair of spatially close but spectrally similar plaques, while the negative samples are a pair of spectrally dissimilar or spatially distant plaques. The model learns to encode spatial and spectral information in potential space by minimizing the distance between positive samples and maximizing the distance between negative samples. C