Progressive hyperspectral image compression method based on context model
By constructing a progressive hyperspectral image compression method based on a context model and using entropy parameters and probability tensors for slice reconstruction and feature fusion, the problem of existing methods failing to fully utilize image context information is solved, and efficient image compression and quality reconstruction are achieved.
Patent Information
- Application Number
- CN202411199302.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2044-08-29
AI Technical Summary
Existing hyperspectral image compression methods fail to fully utilize the contextual information of images when processing multi-band images, resulting in unsatisfactory compression effects and high computational complexity, making it difficult to meet real-time application requirements.
A progressive hyperspectral image compression method based on a context model is adopted. By constructing an encoder, decoder, super encoder, slicing module, context feature fusion model and distortion reduction module, entropy parameters and probability tensors are used to perform slice reorganization and feature fusion, reduce bit information, and refine the potential tensor reconstruction.
It effectively reduces the number of bits during hyperspectral image compression, improves the quality of reconstructed images, and meets the needs of real-time applications.
Smart Images

Figure CN119011862B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of hyperspectral image processing and relates to a progressive hyperspectral image compression method based on a context model. Background Art
[0002] In the processing of hyperspectral images, efficient compression and transmission pose significant challenges due to the sheer volume of data and limited transmission bandwidth. Hyperspectral images contain rich spectral information, with each pixel containing data from multiple bands. This makes traditional image compression methods difficult to address. Furthermore, hyperspectral images are susceptible to noise and signal interference during storage and transmission, further complicating data compression and transmission. Therefore, achieving efficient hyperspectral image compression while maintaining image quality is a pressing issue.
[0003] Although existing hyperspectral image compression methods, such as those based on transform coding, predictive coding, and low-rank matrix factorization, have improved compression efficiency to a certain extent, these methods often have significant limitations. Transform coding methods are inadequate for processing high-frequency information, while predictive coding methods rely on the accuracy of the prediction model. Low-rank matrix factorization methods have high computational complexity and are difficult to meet the requirements of real-time applications. In particular, when working with multi-band hyperspectral images, these methods fail to fully utilize the image's contextual information, resulting in suboptimal compression results. Summary of the Invention
[0004] The purpose of the present invention is to provide a progressive hyperspectral image compression method based on a context model, which solves the problem of high bit number and poor reconstructed image quality during hyperspectral image compression.
[0005] The technical solution adopted by the present invention is a progressive hyperspectral image compression method based on a context model, comprising the following steps:
[0006] Step 1: Select a public dataset of hyperspectral images for preprocessing and then divide it into a training set and a validation set;
[0007] Step 2: Construct the encoder, decoder, super encoder, super decoder, slicing module, context feature fusion model and distortion reduction module;
[0008] Step 3: Input the preprocessed image data into the encoder to obtain a latent tensor, which is then input into the super encoder. The super encoder performs nonlinear feature extraction on the latent tensor to obtain a super latent tensor, which is then quantized and input into the super decoder to obtain the entropy parameter mean M and standard deviation ∑.
[0009] Step 4: Input the potential tensor into the slicing module. The slicing module divides the decentralized and quantized potential tensor into multiple slices of the same shape and arranges them according to the priority of importance to obtain the slice tensor T l , calculate the probability tensor P of each slice based on the entropy parameter mean, standard deviation and slice tensor l ;
[0010] Step 5: The approximate tensor reconstructed from the encoded slice, the mean and standard deviation of the entropy parameters, and the probability tensor are used as three pieces of context information. The updated probability tensor is obtained through the context feature fusion model. The slice tensor is entropy encoded and decoded using the updated probability tensor, and then the slice is reassembled.
[0011] In step 6, the slice tensor after slice reorganization is input into the distortion reduction module to obtain a more refined latent tensor, and then the result is output through the decoder and the hyperspectral image is reconstructed.
[0012] In step 1, the preprocessing includes spectral channel normalization and invalid band screening of the selected multiple hyperspectral image public datasets, and then cropping the other datasets according to the minimum number of bands in the multiple datasets, and dividing the preprocessed hyperspectral image public datasets into training set and validation set in a ratio of 7:3.
[0013] In step 2, the encoder consists of a residual block with a downsampling function, a normal convolutional layer, and an attention module for image to potential tensor conversion. The decoder consists of a residual block with an upsampling function and an attention module for image reconstruction. The super encoder consists of a convolutional layer and a LeakyReLU activation function. The super decoder consists of a convolutional layer, a sub-pixel convolutional layer, and a LeakyReLU activation function. The context feature fusion model consists of a residual block, a convolutional layer, an activation function, and a normalization function. The various context features are spliced after being processed by the residual block, and then processed by the convolutional layer and the activation function to obtain the output result. The output result is normalized to obtain the updated probability tensor. The distortion reduction module consists of a residual block.
[0014] The specific process of step 3 is as follows:
[0015] Step 3.1, normalize the preprocessed image data and normalize the pixel values to the range [0, 1];
[0016] In step 3.2, the normalized image data is fed into the encoder. The image features in the normalized image data are first extracted using a residual block with a downsampling function, and the first downsampling is performed. Then, the image features are extracted again and downsampled again. The feature representation is enhanced using an attention block. Finally, a common convolutional layer is used for the final downsampling, and the feature representation is enhanced using an attention block to obtain a latent tensor.
[0017] In step 3.3, the latent tensor is input into the super encoder, and the latent tensor is preliminarily processed by a convolutional layer conv3x3 to obtain the first feature map. The LeakyReLU activation function is then applied to the feature map for nonlinear feature extraction. The feature map is then processed by a second convolutional layer conv3x3, and the LeakyReLU activation function is applied to the feature map for nonlinear feature extraction again to obtain the super latent tensor.
[0018] In step 3.4, the super latent tensor is quantized and then input into the super decoder. The super decoder recovers the Gaussian distribution parameters from the high-dimensional features for decoding the compressed features. The features are gradually upsampled through the convolution layer and the sub-pixel convolution layer to generate the Gaussian distribution parameters for decoding, namely the entropy parameter mean M and standard deviation ∑.
[0019] In step 3.4, the quantized super latent tensor is input into the super decoder to generate Gaussian distribution parameters for decoding. The specific process is as follows: first, the input feature is preliminarily processed through a convolutional layer conv3x3 to obtain the first feature map, and then the LeakyReLU activation function is applied to the feature map for nonlinear feature extraction; then the feature map is upsampled through a sub-pixel convolutional layer subpel_conv3x3 to double the resolution of the feature map, and the LeakyReLU activation function is applied again for nonlinear feature extraction. Next, the feature map is processed through a convolutional layer and subjected to the LeakyReLU activation function for nonlinear feature extraction. The feature map is upsampled again through a sub-pixel convolutional layer to double the resolution again, and subjected to the LeakyReLU activation function for nonlinear feature extraction. Finally, the result is output through a convolutional layer.
[0020] The specific process of step 4 is as follows:
[0021] Step 4.1: Input the potential tensor into the slicing module. The slicing module divides the decentralized and quantized potential tensor into L slices of the same shape and size, and arranges them according to the priority of importance to obtain the slice tensor T l , l=1,...,L, according to the rate-distortion priority as the standard, T1 is the most important slice, T L It is the least important slice;
[0022] Step 4.2, calculate the probability tensor P of each slice based on the entropy parameter mean, standard deviation and slice tensor l :
[0023]
[0024] Among them, P l ∈R 3C×H×W ,, R is the potential tensor, C, H and W represent the number of channels, height and width of the image respectively, 3C is because each slice is calculated in the form of a triple, each triple is 0 (3) , 1 (3) , 2 (3) .
[0025] The specific process of step 5 is as follows:
[0026] Step 5.1: Construct the context required for the context feature fusion model, using the encoded slice T 1:l-1 Reconstructed approximate tensor As the first context, it is connected with the entropy parameters mean and standard deviation as the second context, and the probability tensor P l As a third context;
[0027] Step 5.2, P l The features of the two contexts are first extracted by multi-layer residual blocks, and then fused by residual blocks and convolutional layers, which triples the number of tensor channels. Then, the channels are split into an additional term △P∈R 3C×H×W and a scaling term S∈R C×H×W ;
[0028] Step 5.3, convert the scaling term S into the conversion term D using the following formula:
[0029] D=s l +(s h -s l )×sigmoid(S)
[0030] Among them, (s l , s h ) represents the constraint range of each element, that is, each element is within (s l , s h ) l Represents the minimum constraint value, s h represents the highest constraint value;
[0031] Step 5.4, the probability tensor P l Add to the additional term △P, sum the two, and then modulate the summation result using the conversion term D to obtain the updated probability tensor The last pair Perform entropy coding and decoding, and finally reassemble the slices.
[0032] In step 5, the context feature fusion model is trained using the training set. The loss function used is cross entropy. The module is trained to learn to modify the probability tensor P with the additional term △P. l The input probability in is then flattened or sharpened using the transformation term D to minimize the bitstream length. Finally, the context feature fusion model is verified using the validation set.
[0033] Step 6 includes the entropy parameters mean M and standard deviation ∑, and the latent tensor after entropy decoding and slicing. As the input data of the distortion reduction module, it then passes through four layers of residual blocks to obtain a single channel output, and then performs channel cascade, regresses the residual △Y and generates the sum to obtain a more refined potential tensor
[0034]
[0035] The more refined potential tensor is input into the decoder. The decoder performs feature enhancement on the input more refined potential tensor through an attention block, and then performs the first image feature extraction and the first upsampling through the residual block with upsampling function, followed by the second image feature extraction and the second upsampling, and finally the third image feature extraction and the third upsampling to restore the spatial resolution of the feature map and finally generate an output image that matches the input image.
[0036] In step 6, the distortion reduction module is trained using the training set, and the loss function used is:
[0037]
[0038] Among them, L CE represents the cross entropy loss, Y represents the latent tensor, represents the Frobenius norm, which is used to limit the size of internal elements, and λ is a hyperparameter, that is, the loss function balance coefficient, which is used to control the trade-off between the cross entropy loss and the Frobenius norm regularization term;
[0039] The distortion reduction module is trained using the above loss function, using the Adam optimizer, with a batch size of 8 and a learning rate of 10 -4 ,The module is trained to use two contexts to reduce the error between the input tensor and the reconstructed tensor, so as to reduce the distortion of the hyperspectral image.,After the training is completed, the module is verified using the validation set, and the output image quality is measured by the bit rate per pixel, peak signal-to-noise ratio and structural maximum similarity index.
[0040] The beneficial effect of the present invention is that, by constructing a slicing module, a context feature fusion model and a distortion reduction module, the input data is sliced and sorted and encoded according to the degree of importance, and then the context feature fusion model is used to reduce the bit information used in encoding, thereby reducing the bit information during hyperspectral image compression, and finally the distortion reduction module is used to refine the reconstructed potential tensor, thereby ensuring the high quality of the reconstructed hyperspectral image. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 1 is a flow chart of a progressive hyperspectral image compression method based on a context model according to the present invention;
[0042] Figure 2 Schematic diagram of a context feature fusion model in a progressive hyperspectral image compression method based on a context model of the present invention;
[0043] Figure 3 It is a schematic diagram of a distortion reduction module in the context model-based progressive hyperspectral image compression method of the present invention. DETAILED DESCRIPTION
[0044] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0045] Example 1
[0046] A progressive hyperspectral image compression method based on context model, referring to Figure 1 , including the following steps:
[0047] Step 1: Select a public dataset of hyperspectral images for preprocessing and then divide it into a training set and a validation set;
[0048] Step 2: Construct the encoder, decoder, super encoder, super decoder, slicing module, context feature fusion model and distortion reduction module;
[0049] Step 3: Input the preprocessed image data into the encoder to obtain a latent tensor, which is then input into the super encoder. The super encoder performs nonlinear feature extraction on the latent tensor to obtain a super latent tensor, which is then quantized and input into the super decoder to obtain the entropy parameter mean M and standard deviation ∑.
[0050] Step 4: Input the potential tensor into the slicing module. The slicing module divides the decentralized and quantized potential tensor into multiple slices of the same shape and arranges them according to the priority of importance to obtain the slice tensor T l , calculate the probability tensor P of each slice based on the entropy parameter mean, standard deviation and slice tensor l ;
[0051] Step 5: The approximate tensor reconstructed from the encoded slice, the mean and standard deviation of the entropy parameters, and the probability tensor are used as three pieces of context information. The updated probability tensor is obtained through the context feature fusion model. The slice tensor is entropy encoded and decoded using the updated probability tensor, and then the slice is reassembled.
[0052] In step 6, the slice tensor after slice reorganization is input into the distortion reduction module to obtain a more refined latent tensor, and then the result is output through the decoder and the hyperspectral image is reconstructed.
[0053] Example 2
[0054] A context model-based progressive hyperspectral image compression method comprises the following steps:
[0055] Step 1: Four public hyperspectral image datasets of Chikusei, Washington DC, Pavia Centre, and CAVE were selected for preprocessing. Spectral channel normalization and invalid band screening were performed first. Then, the other datasets were cropped according to the minimum number of bands in multiple datasets. The preprocessed hyperspectral image public datasets were divided into training and validation sets in a ratio of 7:3.
[0056] Step 2: Construct the encoder, decoder, super encoder, super decoder, slicing module, context feature fusion model and distortion reduction module;
[0057] The encoder consists of a residual block with downsampling function, a normal convolutional layer, and an attention module for image-to-latent tensor conversion. The decoder consists of a residual block with upsampling function and an attention module for image reconstruction. The superencoder consists of a convolutional layer and a LeakyReLU activation function, and the superdecoder consists of a convolutional layer, a sub-pixel convolutional layer, and a LeakyReLU activation function for calculating the mean and standard deviation of the entropy parameter. The slicing module is used to divide the decentralized and quantized latent tensor into several small slices of the same shape and arrange them according to their importance. Entropy coding is then performed according to this priority. The context feature fusion model consists of a residual block, a convolutional layer, an activation function, and a normalization function. After being processed by the residual block, the various context features are concatenated and then processed by the convolution and activation function to obtain the output. The output is normalized to obtain the updated probability tensor. The distortion reduction module consists of multiple residual blocks. The reconstructed latent tensor is concatenated with the mean and standard deviation of the entropy parameter by channel and output through the residual block to obtain a more refined latent tensor.
[0058] Step 3: Input the preprocessed image data into the encoder, extract the image features in the normalized image data for the first time through the residual block with downsampling function, and perform the first downsampling, then perform the second image feature extraction, and perform the second downsampling, and enhance the feature representation through the attention block. Finally, use a common convolution layer for the last downsampling, and enhance the feature representation through the attention block to obtain the potential tensor, and input the potential tensor into the super encoder. The super encoder performs preliminary processing on the potential tensor through a convolution layer conv3x3 to obtain the first feature map, and then applies the LeakyReLU activation function to perform nonlinear feature extraction on the feature map, and then processes the feature map through the second convolution layer conv3x3, and again applies the LeakyReLU activation function to perform nonlinear feature extraction on the feature map to obtain the super potential tensor, which is quantized and passed to the super decoder to obtain the entropy parameter mean M and standard deviation ∑;
[0059] Step 4: Input the potential tensor into the slicing module. The slicing module divides the decentralized and quantized potential tensor into multiple slices of the same shape and arranges them according to the priority of importance to obtain the slice tensor T l , calculate the probability tensor P of each slice based on the entropy parameter mean, standard deviation and slice tensor l ;
[0060] Step 5: The approximate tensor reconstructed from the encoded slice, the mean and standard deviation of the entropy parameters, and the probability tensor are used as three pieces of context information. The updated probability tensor is obtained through the context feature fusion model. The slice tensor is entropy encoded and decoded using the updated probability tensor, and then the slice is reassembled.
[0061] Step 6: Take the entropy parameter mean M and standard deviation ∑, and the potential tensor after entropy decoding and slicing reorganization As the input data of the distortion reduction module, it then passes through four layers of residual blocks to obtain a single channel output, and then performs channel cascade, regresses the residual △Y and generates the sum to obtain a more refined potential tensor The decoder then generates reconstructed data and outputs a reconstructed hyperspectral image.
[0062] Example 3
[0063] A context model-based progressive hyperspectral image compression method comprises the following steps:
[0064] Step 1: Preprocess four public datasets of hyperspectral images from Chikusei, Washington DC, Pavia Centre, and CAVE. First, perform spectral channel normalization and invalid band screening. Normalization ensures that the spectral channel value range is consistent and reduces the deviation during model training. Invalid bands are screened out to ensure data validity. Then, the other three datasets are cropped according to the minimum number of bands in these four datasets. Before training, these hyperspectral images are randomly cropped into non-overlapping 256×256 batches. These batches are divided into training and validation sets in a ratio of 7:3 to ensure the generalization ability of the model.
[0065] Step 2: Construct the encoder, decoder, super encoder, super decoder, slicing module, context feature fusion model and distortion reduction module;
[0066] The encoder consists of a residual block with downsampling function, a normal convolutional layer, and an attention module for image-to-latent tensor conversion. The decoder consists of a residual block with upsampling function and an attention module for image reconstruction. The superencoder consists of a convolutional layer and a LeakyReLU activation function, and the superdecoder consists of a convolutional layer, a sub-pixel convolutional layer, and a LeakyReLU activation function for calculating the mean and standard deviation of the entropy parameter. The slicing module is used to divide the decentralized and quantized latent tensor into several small slices of the same shape and arrange them according to their importance. Entropy coding is then performed according to this priority. The context feature fusion model consists of a residual block, a convolutional layer, an activation function, and a normalization function. After being processed by the residual block, the various context features are concatenated and then processed by the convolution and activation function to obtain the output. The output is normalized to obtain the updated probability tensor. The distortion reduction module consists of multiple residual blocks. The reconstructed latent tensor is concatenated with the mean and standard deviation of the entropy parameter by channel and output through the residual block to obtain a more refined latent tensor.
[0067] Step 3: Input the preprocessed image data into the encoder to obtain a latent tensor, which is then input into the super encoder. The super encoder performs nonlinear feature extraction on the latent tensor to obtain a super latent tensor, which is then quantized and input into the super decoder to obtain the entropy parameter mean M and standard deviation ∑.
[0068] The specific process of step 3 is as follows:
[0069] Step 3.1, normalize the preprocessed image data and normalize the pixel values to the range [0, 1];
[0070] In step 3.2, the normalized image data is fed into the encoder. A residual block with a stride of 2 and a downsampling function is used to extract image features from the normalized image data for the first time, followed by the first downsampling. This is followed by a second image feature extraction and a second downsampling. An attention block is added to enhance the feature representation. Finally, a normal convolutional layer is used for the final downsampling, and the feature representation is enhanced by adding an attention block to obtain the latent tensor.
[0071] In step 3.3, the latent tensor is input into the super encoder, and the latent tensor is preliminarily processed by a convolutional layer conv3x3 to obtain the first feature map. The LeakyReLU activation function is then applied to the feature map for nonlinear feature extraction. The feature map is then processed by a second convolutional layer conv3x3, and the LeakyReLU activation function is applied to the feature map for nonlinear feature extraction again to obtain the super latent tensor.
[0072] In step 3.4, the super latent tensor is quantized and then input into the super decoder. The super decoder recovers the Gaussian distribution parameters from the high-dimensional features for decoding the compressed features. The features are gradually upsampled through the convolution layer and the sub-pixel convolution layer to generate the Gaussian distribution parameters for decoding, namely the entropy parameter mean M and standard deviation ∑. The specific process is as follows: first, the input features are preliminarily processed through a convolution layer conv3x3 to obtain the first feature map, and then the LeakyReLU activation function is applied to the feature map for nonlinear feature extraction; then the feature map is upsampled through a sub-pixel convolution layer subpel_conv3x3 to double the resolution of the feature map, and the LeakyReLU activation function is applied again for nonlinear feature extraction; next, the feature map is processed through a convolution layer and subjected to the LeakyReLU activation function for nonlinear feature extraction; the feature map is upsampled again through a sub-pixel convolution layer to double the resolution again, and subjected to the LeakyReLU activation function for nonlinear feature extraction, and finally the result is output through a convolution layer.
[0073] Step 4: Input the potential tensor into the slicing module. The slicing module divides the decentralized and quantized potential tensor into multiple slices of the same shape and arranges them according to the priority of importance to obtain the slice tensor T l , calculate the probability tensor P of each slice based on the entropy parameter mean, standard deviation and slice tensor l ;
[0074] The specific process of step 4 is as follows:
[0075] Step 4.1: Input the potential tensor into the slicing module. The slicing module divides the decentralized and quantized potential tensor into L slices of the same shape and size. Each slice has the same size as the template tensor and is arranged according to the priority of importance to obtain the slice tensor T. l , l=1,...,L, according to the rate-distortion priority as the standard, T1 is the most important slice, T L It is the least important slice;
[0076] Step 4.2, calculate the probability tensor P of each slice based on the entropy parameter mean, standard deviation and slice tensor l :
[0077]
[0078] Among them, P l ∈R 3C×H×W , R is the potential tensor, C, H and W represent the number of channels, height and width of the image respectively, 3C is because each slice is calculated in the form of a triple, each triple is 0 (3) , 1 (3) , 2 (3)
[0079] Step 5, see Figure 2 , the approximate tensor reconstructed from the encoded slice, the mean and standard deviation of the entropy parameters, and the probability tensor are used as three context information. The updated probability tensor is obtained through the context feature fusion model. The slice tensor uses the updated probability tensor for entropy encoding and entropy decoding to form a data set from T1 to T L The bit stream is then sliced and reassembled;
[0080] The specific process of step 5 is as follows:
[0081] Step 5.1: Construct the context required for the context feature fusion model, using the encoded slice T 1:l-1 Reconstructed approximate tensor As the first context, it is connected with the entropy parameters mean and standard deviation as the second context, and the probability tensor P l As a third context;
[0082] Step 5.2, First Context After three layers of input and output, both the residual block and the single-channel one are used; the second context information M and ∑ pass through four residual blocks in sequence. In the first residual block, the number of channels is adjusted to 2C, and convolution and nonlinear activation processing are performed in two convolutional layers with a channel number of 2C. The feature map of the 2C channel is output through the residual connection. The second residual block repeats this process and continues to maintain the output of the 2C channel. In the third residual block, the input 2C channel feature map remains 2C channel after passing through the first convolution layer, but is compressed to C channel in the second convolution layer. The number of output feature map channels is reduced to C. The two convolutional layers of the fourth residual block both maintain C channel, and the final C channel feature map is output through the residual connection; the third context P l The processing is similar to that of the second context, except that 2C is replaced by 3C. The entire process achieves a balance between information extraction and computational complexity by first increasing the number of channels to enrich feature expression and then gradually compressing the feature dimensions.
[0083] Step 5.3, the third context P l The features of the two contexts are first extracted by multi-layer residual blocks, and then connected step by step. Then, they are passed through 6 layers of residual blocks with 3C input and output channels, 3 layers of convolutional layers and LeakyReLU activation function. The convolution kernel in the residual block is 3×3, the step size and padding are both 1, and the convolution kernel in the convolution layer is 1×1, the step size is 1, and the padding is 0. Then, the fused feature tensor is obtained by one convolution. The result obtained at this time has the same l Same spatial resolution, but three times more channels.
[0084] Step 5.4: Split into an additional term △P∈R according to the channel method 3C×H×W and a scaling term S∈R C×H×W , convert the scaling term S into the conversion term D by the following formula:
[0085] D=s l +(s h -s l )×sigmoid(S)
[0086] Among them, (s l , s h ) represents the constraint range of each element, that is, each element is within (s l , s h ) l Represents the minimum constraint value, s h represents the highest constraint value;
[0087] Step 5.5, the probability tensor P lAdd to the additional term △P, sum the two, then use the conversion term D to modulate the summation result, and use the normalization function to obtain the updated probability tensor The last pair Perform entropy coding and decoding, and finally reassemble the slices.
[0088] In step 5, the context feature fusion model is trained using the training set. The loss function used is cross entropy. The module is trained to learn to modify the probability tensor P with the additional term △P. l The input probability in is then flattened or sharpened using the transformation term D to minimize the bitstream length. Finally, the context feature fusion model is verified using the validation set.
[0089] Step 6, see Figure 3 , with entropy parameter mean M and standard deviation ∑, and the potential tensor after entropy decoding and slicing reorganization As the input data of the distortion reduction module, it then passes through four layers of residual blocks to obtain a single channel output, and then performs channel cascade, regresses the residual △Y and generates the sum to obtain a more refined potential tensor
[0090]
[0091] The more refined potential tensor is input into the decoder. The decoder performs feature enhancement on the input more refined potential tensor through an attention block, and then performs the first image feature extraction and the first upsampling through the residual block with upsampling function, followed by the second image feature extraction and the second upsampling, and finally the third image feature extraction and the third upsampling to restore the spatial resolution of the feature map and finally generate an output image that matches the input image.
[0092] In step 6, the distortion reduction module is trained using the training set, and the loss function used is:
[0093]
[0094] Among them, L CE represents the cross entropy loss, Y represents the latent tensor, represents the Frobenius norm, which is used to limit the size of internal elements, and λ is a hyperparameter, that is, the loss function balance coefficient, which is used to control the trade-off between the cross entropy loss and the Frobenius norm regularization term;
[0095] The distortion reduction module is trained with the above loss function, using the Adam optimizer with a batch size of 8 and a learning rate of 10 -4, training the module to reduce the error between the input tensor and the reconstructed tensor using two contexts to reduce the distortion of the hyperspectral image, after training, the module is verified using a validation set, and the image quality of the output is measured in terms of bit rate per pixel, peak signal-to-noise ratio and structural maximum similarity index.
Claims
1. A progressive hyperspectral image compression method based on a context model, characterized in that: The following steps are involved: Step 1: Select a public dataset of hyperspectral images for preprocessing and then divide it into a training set and a validation set; Step 2: Construct the encoder, decoder, super encoder, super decoder, slicing module, context feature fusion model and distortion reduction module; Step 3: Input the preprocessed image data into the encoder to obtain a latent tensor, which is then input into the super encoder. The super encoder performs nonlinear feature extraction on the latent tensor to obtain a super latent tensor, which is then quantized and input into the super decoder to obtain the entropy parameter mean M and standard deviation ∑. Step 4: Input the potential tensor into the slicing module. The slicing module divides the decentralized and quantized potential tensor into multiple slices of the same shape and arranges them according to the priority of importance to obtain the slice tensor. , calculate the probability tensor of each slice based on the entropy parameters mean, standard deviation and slice tensor ; Step 5: The approximate tensor reconstructed from the encoded slice, the mean and standard deviation of the entropy parameters, and the probability tensor are used as three pieces of context information to Reconstructed approximate tensor As the first context, the entropy parameters mean and standard deviation are connected to serve as the second context, and the probability tensor is As the third context, the updated probability tensor is obtained through the context feature fusion model. The slice tensor uses the updated probability tensor for entropy encoding and entropy decoding, and then the slice is reassembled; In step 6, the slice tensor after slice reorganization is input into the distortion reduction module to obtain a more refined latent tensor, and then the result is output through the decoder to reconstruct the hyperspectral image.
2. The context model-based progressive hyperspectral image compression method according to claim 1, characterized in that: In step 1, the preprocessing includes performing spectral channel normalization processing and invalid band screening on the selected multiple hyperspectral image public data sets, then cropping the other data sets according to the minimum number of bands in the multiple data sets, and dividing the preprocessed hyperspectral image public data sets into a training set and a validation set in a ratio of 7:
3.
3. The context model-based progressive hyperspectral image compression method according to claim 2, characterized in that: In the step 2, the encoder is composed of a residual block with a downsampling function, a normal convolution layer and an attention block, which is used for converting images to potential tensors. The decoder is composed of a residual block and an attention block with an upsampling function, which is used for image reconstruction. The super encoder is composed of a convolution layer and a LeakyReLU activation function. The super decoder is composed of a convolution layer, a sub-pixel convolution layer and a LeakyReLU activation function. The context feature fusion model is composed of a residual block, a convolution layer, an activation function and a normalization function. Each context feature is spliced after being processed by the residual block, and then processed by the convolution and activation function to obtain an output result. The output result is normalized using a normalization function to obtain an updated probability tensor. The distortion reduction module is composed of a residual block.
4. The context model-based progressive hyperspectral image compression method according to claim 3, characterized in that: The specific process of step 3 is as follows: Step 3.1, normalize the preprocessed image data and normalize the pixel values to the range [0, 1]; In step 3.2, the normalized image data is fed into the encoder. The image features in the normalized image data are first extracted using a residual block with a downsampling function, and the first downsampling is performed. Then, the image features are extracted again and downsampled again. The feature representation is enhanced using an attention block. Finally, a common convolutional layer is used for the final downsampling, and the feature representation is enhanced using an attention block to obtain a latent tensor. In step 3.3, the latent tensor is input into the super encoder, and a convolutional layer conv3x3 is used to preliminarily process the latent tensor to obtain the first feature map. The LeakyReLU activation function is then applied to the feature map for nonlinear feature extraction. The feature map is then processed through a second convolutional layer conv3x3, and the LeakyReLU activation function is applied to the feature map for nonlinear feature extraction again to obtain the super latent tensor. In step 3.4, the super latent tensor is quantized and then input into the super decoder. The super decoder recovers the Gaussian distribution parameters from the high-dimensional features for decoding the compressed features. The features are gradually upsampled through the convolution layer and the sub-pixel convolution layer to generate the Gaussian distribution parameters for decoding, namely the entropy parameter mean M and standard deviation ∑.
5. The context model-based progressive hyperspectral image compression method according to claim 4, characterized in that: In the step 3.4, the quantized super latent tensor is input into the super decoder to generate Gaussian distribution parameters for decoding. The specific process is: first, the input feature is preliminarily processed through a convolutional layer conv3x3 to obtain the first feature map, and then the LeakyReLU activation function is applied to the feature map for nonlinear feature extraction; then the feature map is upsampled through a sub-pixel convolutional layer subpel_conv3x3 to double the resolution of the feature map, and the LeakyReLU activation function is applied again for nonlinear feature extraction; next, the feature map is processed through a convolutional layer and subjected to the LeakyReLU activation function for nonlinear feature extraction; the feature map is upsampled again through a sub-pixel convolutional layer to double the resolution again, and subjected to the LeakyReLU activation function for nonlinear feature extraction, and finally the result is output through a convolutional layer.
6. The context model-based progressive hyperspectral image compression method according to claim 5, characterized in that: The specific process of step 4 is as follows: Step 4.1: Input the potential tensor into the slicing module. The slicing module divides the decentralized and quantized potential tensor into L slices of the same shape and size, and arranges them according to the priority of importance to obtain the slice tensor. , , according to the rate-distortion priority as the standard, T1 is the most important slice, T L It is the least important slice; Step 4.2, calculate the probability tensor of each slice based on the entropy parameter mean, standard deviation and slice tensor : in, ∈R 3C×H×W , R is the potential tensor, C, H and W represent the number of channels, height and width of the image respectively.
7. The context model-based progressive hyperspectral image compression method according to claim 6, characterized in that: The specific process of step 5 is as follows: Step 5.1: Construct the context required for the context feature fusion model, using the encoded slices Reconstructed approximate tensor As the first context, the entropy parameters mean and standard deviation are connected to serve as the second context, and the probability tensor is As a third context; Step 5.2, The features of the two contexts are first extracted by multi-layer residual blocks, and then fused by residual blocks and convolutional layers, which triples the number of tensor channels. Then, the channels are split into an additional term △P∈R 3C ×H×W and a scaling term S∈R C×H×W ; Step 5.3, convert the scaling term S into the conversion term D using the following formula: in, Indicates the constraint range of each element, that is, each element is within Inside, represents the minimum constraint value, represents the highest constraint value; Step 5.4, for the probability tensor The sum is then modulated by the transformation term D to obtain the updated probability tensor. , and finally Perform entropy coding and decoding, and finally reassemble the slices.
8. The context model-based progressive hyperspectral image compression method according to claim 7, characterized in that: In step 5, the context feature fusion model is trained using the training set, and the loss function used is cross entropy. The model is trained to learn to modify the probability tensor with the additional term ΔP. The input probability in is then flattened or sharpened using the transformation term D to minimize the bitstream length. Finally, the context feature fusion model is verified using the validation set.
9. The context model-based progressive hyperspectral image compression method according to claim 8, characterized in that: The step 6 includes the entropy parameters mean M and standard deviation ∑, and the potential tensor after entropy decoding and slicing reorganization As the input data of the distortion reduction module, it then passes through four layers of residual blocks to obtain a single channel output, and then performs channel cascade, regresses the residual △Y and generates the sum to obtain a more refined potential tensor : The more refined potential tensor is input into the decoder. The decoder performs feature enhancement on the input more refined potential tensor through an attention block, and then performs the first image feature extraction and the first upsampling through the residual block with upsampling function, followed by the second image feature extraction and the second upsampling, and finally the third image feature extraction and the third upsampling to restore the spatial resolution of the feature map and finally generate an output image that matches the input image.
10. The context model-based progressive hyperspectral image compression method according to claim 9, characterized in that: In step 6, the distortion reduction module is trained using the training set, and the loss function used is: in, L CE represents the cross entropy loss, Y represents the latent tensor, represents the Frobenius norm, which is used to limit the size of internal elements, and λ is a hyperparameter, that is, the loss function balance coefficient, which is used to control the trade-off between the cross entropy loss and the Frobenius norm regularization term; The distortion reduction module is trained with the above loss function, using the Adam optimizer, with a batch size of 8 and a learning rate of 10. -4 ,The module is trained to use two contexts to reduce the error between the input tensor and the reconstructed tensor, so as to reduce the distortion of the hyperspectral image.,After the training is completed, the module is verified using the validation set, and the output image quality is measured by the bit rate per pixel, peak signal-to-noise ratio and structural maximum similarity index.
Citation Information
Patent Citations
Image compression method based on multi-scale space and context information fusion
CN114792347A
Attention based context modelling for image and video compression
US20240244274A1