A transformer-based image compression method

By employing a Transformer-based deep image compression method, utilizing an encoder and decoder with alternating stacked convolutional and TF-SPP modules, combined with a channel autoregressive entropy model based on window self-attention mechanism, the problem of low compression efficiency in existing technologies is solved, achieving efficient image compression and reconstruction.

CN115439565BActive Publication Date: 2026-04-17HENAN UNIVERSITY
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HENAN UNIVERSITY
Filing Date
2022-08-18
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing depth image compression methods suffer from low compression efficiency and high complexity, making joint optimization difficult.

Method used

We employ a Transformer-based deep image compression method. By constructing an encoder and decoder consisting of alternating stacked convolutional and TF-SPP modules, combined with a channel autoregressive entropy model based on window self-attention mechanism, we establish a high-resolution image compression dataset and train the model using the Adam optimization algorithm.

Benefits of technology

It achieves higher compression efficiency and image reconstruction quality, with a PSNR of 33.25, a compression ratio of 0.41, and an MS-SSIM of 0.98, thus improving the robustness of image reconstruction and the compression effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115439565B_ABST
    Figure CN115439565B_ABST
Patent Text Reader

Abstract

The application provides a kind of image compression method based on Transformer, mainly includes the following steps: constructing depth image compression model based on Transformer;Establish the training set, validation set and test set for depth compression model;Finally, the processed depth image compression dataset is sent into the constructed depth image compression model based on Transformer for training;The depth image compression model based on Transformer is optimized by a predetermined manner, and the process of iterative training and optimization is repeated until the loss function approaches a constant value, and the optimized depth image compression model based on Transformer is outputted;The trained Transformer depth image compression model is used to compress and reconstruct the image, and the compression result is evaluated or further analyzed and understood.The method described in the application uses an advanced Transformer feature extraction network to significantly improve the quality of compressed images and greatly save image storage costs.The application has important application value in the field of image storage, transmission, analysis, etc.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and further to an image compression method based on Transformer in the field of image processing technology. Background Technology

[0002] With the rapid development of science and technology, data compression has always been an important research topic, significantly impacting data transmission and storage. Image compression is the application of data compression technology to digital images, aiming to reduce redundancy in image data and achieve more efficient data storage and transmission. Traditional image compression methods involve steps such as prediction, transformation, quantization, and entropy coding, each optimized using manually designed algorithms, resulting in high complexity, inability to specifically compress images, and low efficiency. The emergence of deep learning has brought about breakthroughs in image compression methods, especially end-to-end deep image compression. Compared to traditional methods, end-to-end image compression allows for joint optimization, achieving higher compression efficiency. In recent years, the introduction of Transformer has brought a new feature extraction mechanism, and its application in end-to-end image compression represents a new attempt.

[0003] Hubei University of Technology's invention patent application, "An Image Compression and Perception Reconstruction Method Based on Attention Multi-Feature Fusion" (Patent Application No.: 202010479734.8, Publication No.: CN 111667445A), discloses an image compression and reconstruction method based on attention multi-feature fusion for image compression. This invention adds residual blocks to each channel of the network to form a residual network. After obtaining multi-scale feature information, it uses an attention mechanism to weight the different output features, better utilizing more useful information in the features. Then, it fuses multiple feature information to complete the depth reconstruction of the image. This method has achieved a certain improvement in the quality of image reconstruction, but there is still a gap between its performance and practical application.

[0004] In their paper "An End-to-End Image Compression Method Based on Attention Mechanism and Discrete Gaussian Mixture Model" (Journal of Chongqing University of Posts and Telecommunications (Natural Science Edition), 2020, Vol. 32, No. 5, pp. 770-778), Zhu Jun and Gao Chenqiang proposed an end-to-end image compression method based on attention mechanism and discrete Gaussian mixture model. A global context attention module is embedded into the encoder to construct compact latent representation features. Simultaneously, the latent representation features are modeled as a parameterized discrete Gaussian mixture model to improve the accuracy of bitrate estimation. While the image reconstruction quality is improved, the overall feature extraction capability of the model is limited. Summary of the Invention

[0005] The purpose of this invention is to overcome the shortcomings of the existing technology and provide an image compression method based on Transformer to solve the problems of low compression efficiency in existing depth image compression methods.

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

[0007] A Transformer-based image compression method includes the following steps:

[0008] Step 1: Construct a Transformer-based depth image compression model, specifically:

[0009] Step 1.1: Input the image to be compressed into the main encoder, which is formed by alternating stacking of convolutional modules and TF-SPP modules, and perform nonlinear transformation processing to generate the latent representation of the compressed image;

[0010] Step 1.2: Construct a channel autoregressive entropy model by combining a window self-attention mechanism, mainly including a super-prior encoder and a channel regulator, specifically:

[0011] Step 1.2.1: The latent representation generated in Step 1.1 is fed into a super prior encoder formed by alternating stacking of convolutional modules and window self-attention modules for downsampling processing to obtain the super latent representation of the compressed image;

[0012] Step 1.2.2: Quantize and compress the hyperlatent representation of the compressed image generated in Step 1.2.1 to obtain the boundary representation of the compressed image;

[0013] Step 1.2.3: Input the latent representation of the compressed image generated in Step 1.1 and the boundary representation of the compressed image generated in Step 1.2.2 into the channel regulator for encoding and decoding to obtain the compressed latent representation;

[0014] Step 1.3: The compressed latent representation input described in Step 1.2.3 is upsampled by the main decoder formed by alternately stacking deconvolution modules and TF-SPP modules to reconstruct the compressed image;

[0015] Step 2: Create a depth image compression dataset, specifically:

[0016] Step 2.1: Take 600 high-quality images containing targets such as trees, vehicles, people, animals, and buildings using a visible light digital camera;

[0017] Step 2.2: Randomly crop each high-quality image captured in Step 2.1 into 50 images of size 256×256 pixels, and finally obtain a depth image compression dataset containing 30,000 images.

[0018] Step 2.3: Randomly select 70% of the deep image compression dataset described in Step 2.2 as the training set of the model, 20% as the test set of the model, and 10% as the validation set of the model.

[0019] Step 3: Train the Transformer-based deep image compression model constructed in Step 1, specifically:

[0020] Step 3.1: Set the training parameters. Set the batch size to Batch size = 8, the initial learning rate to Ir = 0.0001, and the number of training iterations to Epoch = 400.

[0021] Step 3.2: Input the depth image compression dataset established in Step 2 into the Transformer-based depth image compression model described in Step 1 and train it according to the parameters set in Step 3.1;

[0022] Step 3.3: Use the Adam stochastic optimization algorithm to perform stochastic gradient descent on the Transformer-based deep image compression model trained in Step 3.2 to continuously optimize the loss function. Based on the loss change trend of cross-validation between the training set and the validation set, until the loss change gradually tends to a stable state, determine the optimal weight.

[0023] Step 4: Input the test set described in Step 2.2 into the Transformer-based depth image compression model trained in Step 3.3 to test the performance of the Transformer-based depth image compression model;

[0024] Step 5: Evaluate the model, specifically:

[0025] The Transformer-based deep image compression model trained in step 3 is evaluated based on the test results in step 4, using PSNR (Peak Signal-to-Noise Ratio), MS-SSIM (Multi-Scale Structural Similarity), and compression ratio.

[0026] Step 6: Determine whether the PSNR (Peak Signal-to-Noise Ratio), MS-SSIM (Multi-Scale Structural Similarity), and compression ratio of the evaluation results of the Transformer-based deep image compression model in Step 5 meet the requirements of actual applications. If the Transformer-based deep image compression model meets the requirements of image compression applications in real-world scenarios, proceed to Step 8; otherwise, proceed to Step 7.

[0027] Step 7: By adjusting the learning rate of the model described in Step 3.1, reduce the learning rate by a factor of ten after 200 iterations, and further reduce it by a factor of ten after 300 iterations, then return to Step 3.1 for retraining.

[0028] Step 8: Apply the Transformer-based depth image compression model from Step 6, which meets the practical application requirements, to image compression in real-world scenarios.

[0029] The main encoder described in step 1.1 employs the TF-SPP feature extraction mechanism, which consists of two parts: Calculate attention and Fusion. Specifically, step 1.1 includes the following steps:

[0030] Step 1.1.1: Calculate attention operation, specifically:

[0031] The input feature maps are converted into a sequence and then multiplied by the coefficient matrix W. Q W K W V We obtain three input feature vectors Q, K, and V. These three vectors are combined and input into three Transformer blocks with heads of 8, 10, and 12 respectively, and self-attention is calculated to obtain the output feature map Z. i Here, i = 1, 2, 3, Z1, Z2, and Z3 represent the three output feature maps of the Transformer block, Z... i The calculation is shown in formula (1).

[0032]

[0033] Where Softmax is the normalization function, Z i Here are the three output feature maps of the Transformer block, Q i V i K i The three feature vectors are the input. is the transpose of the input feature vector K, and dim is the dimension of the Transformer block output.

[0034] Step 1.1.2: Fusion operation, specifically:

[0035] The input feature map is convolved using a 1×1 convolution kernel, and the three outputs Z1, Z2, and Z3 from step 1.1.1 are convolved together using a 1×1 convolution kernel, keeping the number of channels in the output feature map consistent with the number of channels in the input feature map, to obtain the fused feature map.

[0036] Step 1.2 introduces a window self-attention mechanism into the channel autoregressive entropy model, and designs a super-prior decoder that combines a window self-attention layer and a convolutional layer to extract global features from the latent representation and obtain more accurate boundary information.

[0037] The images in the dataset described in step 2 are all high-resolution digital images with distinct features and high contrast, which are beneficial for model training.

[0038] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0039] First, because the present invention designs an encoder and decoder formed by alternating stacking of convolutional modules and TF-SPP modules, the feature extraction network starts from the global perspective and can more thoroughly extract global features and deep high-level semantic features.

[0040] Second, because the present invention introduces a window self-attention mechanism module into the channel autoregressive entropy model, it accurately extracts the boundary information of the latent representation and fuses the boundary information of the latent representation from the channel dimension to achieve high-quality image reconstruction.

[0041] Third, since this invention establishes a deep image compression dataset composed of high-resolution, feature-rich, and high-contrast images, it is more conducive to model learning and achieves higher robustness.

[0042] Fourth, this invention offers a qualitative improvement over traditional end-to-end image compression in terms of image reconstruction quality, compression ratio, and encoding / decoding time. At medium bit rates, the PSNR (Peak Signal-to-Noise Ratio) reaches 33.25, the compression ratio reaches 0.41, and the MS-SSIM (Multi-Scale Structural Similarity) reaches 0.98. Attached Figure Description

[0043] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

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

[0045] Figure 2 This is a schematic diagram of the image compression network structure of the present invention;

[0046] Figure 3 This is an example diagram of the image reconstruction results of the present invention. Detailed Implementation

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

[0048] like Figure 1 As shown: The image compression method based on Transformer of the present invention includes the following steps:

[0049] Step 1: Construct a Transformer-based depth image compression model:

[0050] First, most traditional image compression models use convolutional neural networks (CNNs) as the backbone feature extraction network. Compared to Transformers, convolutions are not as effective at extracting global features from images, which inevitably introduces errors during image reconstruction, leading to lower image quality. TF-SPP combines Transformers and CNNs, extracting global features more effectively than traditional image compression models, thus solving the problem of low reconstruction quality. Second, traditional image compression methods involve steps such as prediction, transformation, quantization, and entropy coding, each optimized using manually designed algorithms. While traditional methods are technically mature and have low complexity, they heavily rely on manual design and are difficult to optimize jointly. The Transformer-based deep image compression model described above uses an end-to-end structure, which not only allows for joint optimization of network parameters but also avoids complex manual algorithm design. The network can more intelligently learn to remove redundant information from images, thus often achieving better compression ratios and visual quality than traditional methods. In summary, the Transformer-based deep image compression model includes: backbone network design, with TF-SPP modules and convolutional modules alternately stacked to form the encoder and decoder; construction of a dataset suitable for deep image compression; design of a channel autoregressive entropy model incorporating a window self-attention mechanism; and a schematic diagram of the Transformer-based deep image compression network structure as shown in the figure. Figure 2 As shown, specifically:

[0051] Step 1.1: Input the image to be compressed into the main encoder g, which is formed by alternating stacks of convolutional modules and TF-SPP modules. a The input image x is subjected to feature extraction and 3x downsampling to extract deeper semantic features of the compressed image and generate the latent representation y of the compressed image. The calculation of y is shown in formula (2):

[0052] y = g a (x); (2)

[0053] Step 1.2: Construct a channel autoregressive entropy model by combining a window self-attention mechanism, mainly including a super-prior encoder and a channel regulator, specifically:

[0054] Step 1.2.1: Feed the latent representation y of the compressed image generated in Step 1.1 into the super-prior encoder h, which is formed by alternating stacks of convolutional modules and window attention modules. a By performing a 2x downsampling process and keeping the number of channels in the feature map unchanged, the hyper-latent representation z of y is obtained. The calculation of z is shown in formula (3). This module makes full use of the parallel processing capability of the window self-attention module, which accelerates the computation of the network.

[0055] z = h a (y); (3)

[0056] Step 1.2.2: Quantize the hyperlatent representation z generated in Step 1.2.1 to obtain the quantized representation. The data is compressed into a bitstream using an arithmetic encoder (AE) and decompressed by an arithmetic decoder (AD) to obtain the compressed boundary representation.

[0057] Step 1.2.3: Input the latent representation y of the compressed image generated in Step 1.1 into the channel conditioner, slice the latent representation y in the channel dimension into 10 slices and sort them. The number of channels in each slice is N / 10 (N is the total number of channels). The first slice is compressed using a Gaussian model and represented by the compressed boundary as described in Step 1.2.2. The entropy parameters of the model are predicted conditionally through densely connected convolutional blocks; the second slice uses the entropy parameters and boundary representations of the first slice. Conditional range entropy encoding is performed, and residual prediction is added to reduce quantization error; the entropy parameter of the third slice follows the same pattern.

[0058]

[0059] This process continues until the tenth slice. The tenth slice is entropy encoded using the entropy parameters of the previous nine slices as a condition. After encoding, the ten slices are concatenated to obtain the compressed latent representation.

[0060] Step 1.3: Compress the latent representation described in Step 1.2.3 The input consists of a main decoder g formed by alternating stacks of deconvolution modules and TF-SPP modules. s Upsampling is performed to obtain the reconstructed image. The calculation is shown in formula (4):

[0061]

[0062] Table 1. Parameter details of the Transformer-based depth image compression model (dim is the number of channels in the TF-SPP output, and S is the stride of the convolution).

[0063] Step 2: Create a depth image compression dataset, specifically:

[0064] Step 2.1: Establish training, validation, and test sets for depth image compression. The established depth image compression dataset consists of 600 high-quality images taken with a Canon EOS 800D visible light digital camera, containing targets such as trees, vehicles, people, animals, and buildings.

[0065] Step 2.2: Randomly crop the high-quality images captured in Step 2.1. Each image is cropped into 50 images of size 256×256 pixels, resulting in a depth image compression dataset containing 30,000 images. The cropped images have more prominent features and consistent resolution, which will greatly save GPU memory resources during training.

[0066] Step 2.3: Divide the depth image compression dataset mentioned in Step 2.2 into a ratio of 7:2:1, that is, randomly select 70% as the training set of the model, select 20% as the test set of the model, and select 10% as the validation set of the model.

[0067] Step 3: Train a Transformer-based deep image compression model, specifically:

[0068] Step 3.1: Set the training parameters. Set the batch size to Batch size = 8, the initial learning rate to Ir = 0.0001, and the number of training iterations to Epoch = 400.

[0069] Step 3.2: Input the depth image compression dataset established in Step 2 into the Transformer-based depth image compression model described in Step 1 and train it according to the parameters set in Step 3.1;

[0070] Step 3.3: Use the Adam stochastic optimization algorithm to perform stochastic gradient descent on the Transformer-based deep image compression model trained in Step 3.2 to continuously optimize the loss function. The loss function is calculated as shown in Equation (5):

[0071] L=D+λ*R;(5)

[0072] Where D represents the distortion function, which calculates the distortion of the input and decoder output images; λ is the Lagrange multiplier, which controls the expected compression tradeoff and distortion; and R is the bitrate result obtained by the bitrate estimation network.

[0073] Based on the trend of loss change during cross-validation of the training and validation sets, until the loss change L no longer decreases, the weights of each module are saved as the initial solution, the optimal weights are determined, and the training of this stage ends.

[0074] Step 4: Input the test set described in Step 2.2 into the Transformer-based depth image compression model trained in Step 3.3 to test the performance of the Transformer-based depth image compression model;

[0075] Step 5: Evaluate the model, specifically:

[0076] Based on the test results of step 4, the Transformer-based deep image compression model trained in step 3 is evaluated using PSNR (Peak Signal-to-Noise Ratio), MS-SSIM (Multi-Scale Structural Similarity), and compression ratio. A higher PSNR indicates higher image quality. The value of MS-SSIM ranges from 0 to 1, and its magnitude represents the structural similarity between the reconstructed image and the original image. The compression ratio is the ratio of the digital size of the compressed image to the digital size of the original image. Depending on the actual application, the model can also be evaluated from aspects such as computational complexity, number of parameters, and weight file size. The calculation of PSNR is shown in formula (7):

[0077] To calculate PSNR, we must first calculate MSE (mean squared error). The calculation of MSE is shown in formula (6):

[0078]

[0079] Where I and K are two monochrome images with m rows and n columns.

[0080]

[0081] Among them, MAX I It represents the maximum value of the color of an image point, and MSE is the mean square error.

[0082] Step 6: Determine whether the PSNR (Peak Signal-to-Noise Ratio), MS-SSIM (Multi-Scale Structural Similarity), and compression ratio of the Transformer-based deep image compression model evaluated in Step 4 meet the requirements of practical applications. If the Transformer-based deep image compression model meets the image compression application requirements in real-world scenarios, proceed to Step 8; otherwise, proceed to Step 7. Specifically, according to the final experimental results of the model, at a medium bit rate, the PSNR (Peak Signal-to-Noise Ratio) reached 33.25, the compression ratio reached 0.41, and the MS-SSIM (Multi-Scale Structural Similarity) reached 0.98.

[0083] Step 7: By adjusting the learning rate of the model described in Step 3.1, reduce the learning rate by a factor of ten when the training iteration reaches 200 times, and reduce the learning rate by a factor of ten again when the training iteration reaches 300 times, and then jump to Step 3.1 to retrain.

[0084] Step 8: Apply the Transformer-based depth image compression model from Step 6, which meets the practical application requirements, to image compression in a real-world scene. The image reconstruction result is as follows: Figure 3 As shown, the overall image and edge features are largely free from distortion. By constructing a dataset suitable for deep image compression, adding a TF-SPP module to the feature extraction network for more accurate feature extraction, and introducing a window self-attention mechanism into the channel autoregressive entropy model to improve image reconstruction quality, high-efficiency image compression is achieved.

[0085] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0086] First, because the present invention designs an encoder and decoder formed by alternating stacking of convolutional modules and TF-SPP modules, the feature extraction network can start from the global perspective and extract global features and deep high-level semantic features more thoroughly.

[0087] Second, because the present invention introduces a window self-attention mechanism module into the channel autoregressive entropy model, it accurately extracts the boundary information of the latent representation and fuses the boundary information of the latent representation from the channel dimension to achieve higher quality image reconstruction.

[0088] Third, since this invention establishes a deep image compression dataset composed of high-resolution, feature-rich, and high-contrast images, it is more conducive to model learning and achieves higher robustness.

[0089] Fourth, this invention offers a qualitative improvement over traditional end-to-end image compression in terms of image reconstruction quality, compression ratio, and encoding / decoding time. At medium bit rates, the PSNR (Peak Signal-to-Noise Ratio) reaches 33.25, the compression ratio reaches 0.41, and the MS-SSIM (Multi-Scale Structural Similarity) reaches 0.98.

[0090] This invention employs a mechanism combining Transformer and convolution to perform global feature extraction on the compressed image, enabling the extraction of deeper semantic features. Furthermore, by introducing a window self-attention mechanism into the entropy model, boundary distortion is avoided, which is beneficial for achieving higher compression results. This invention can be used for various static digital image compression coding.

[0091] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

[0092] The terms “comprising” and “having”, and any variations thereof, in the specification and claims of this application are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such process, method, product, or device.

[0093] Note that the above description is merely a preferred embodiment and application of the technical principles of the present invention. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the specific embodiments described herein, and may include many other effective embodiments without departing from the concept of the present invention. The scope of the present invention is determined by the scope of the appended claims.

Claims

1. A method for image compression based on Transformer, characterized in that, The method includes the following steps: Step 1: Construct a Transformer-based depth image compression model, specifically: Step 1.1: The image to be compressed is input into the main encoder, which is formed by alternating stacks of convolutional modules and TF-SPP modules, to perform nonlinear transformation processing and generate the latent representation of the compressed image. The main encoder in Step 1.1 adopts the TF-SPP feature extraction mechanism, which is divided into two parts: Calculate attention and Fusion. Step 1.1 specifically includes the following steps: Step 1.1.1: Calculate attention operation, specifically: The input feature maps are converted into a sequence and then multiplied by the coefficient matrix W. Q W K W V We obtain three input feature vectors Q, K, and V; we combine these three vectors and input them into three Transformer blocks with heads of 8, 10, and 12 respectively, and perform self-attention calculations to obtain the output feature maps. ,here Z1, Z2, and Z3 represent the three output feature maps of the Transformer block, respectively. The calculation is shown in formula (1). ; (1) in, It is the normalization function, Z i These are the three output feature maps of the Transformer block. , , The three feature vectors are the input. This is the transpose of the input feature vector K. The dimension output by the Transformer block; Step 1.1.2: Fusion operation, specifically: The input feature map is convolved using a 1×1 convolution kernel, and the three outputs Z1, Z2, and Z3 from step 1.1.1 are convolved together using a 1×1 convolution kernel, keeping the number of channels in the output feature map consistent with the number of channels in the input feature map, to obtain the fused feature map. Step 1.2: Construct a channel autoregressive entropy model by combining a window self-attention mechanism, including a super-prior encoder and a channel regulator. The channel autoregressive entropy model described in Step 1.2 introduces a window self-attention mechanism and designs a super-prior decoder that combines a window self-attention layer and a convolutional layer to extract global features from the latent representation and obtain more accurate boundary information. Specifically, it includes the following steps: Step 1.2.1: The latent representation generated in Step 1.1 is fed into a super prior encoder formed by alternating stacking of convolutional modules and window self-attention modules for downsampling processing to obtain the super latent representation of the compressed image; Step 1.2.2: Quantize and compress the hyperlatent representation of the compressed image generated in Step 1.2.1 to obtain the boundary representation of the compressed image; Step 1.2.3: Input the latent representation of the compressed image generated in Step 1.1 and the boundary representation of the compressed image generated in Step 1.2.2 into the channel regulator for encoding and decoding to obtain the compressed latent representation; Step 1.3: The compressed latent representation input described in Step 1.2.3 is upsampled by the main decoder formed by alternately stacking deconvolution modules and TF-SPP modules to reconstruct the compressed image; Step 2: Establish a deep image compression dataset; First, randomly crop all images in the dataset to the same size, and use all cropped images as the image compression dataset; then use the images in the image compression dataset as the training set, test set, and validation set of the model according to a certain ratio; Step 3: Train the Transformer-based deep image compression model constructed in Step 1; Step 4: Test the performance of the Transformer-based depth image compression model; Step 5: Evaluate the Transformer-based depth image compression model described above; Step 6: Apply the Transformer-based depth image compression model that meets the requirements of practical applications to image compression in real-world scenarios.

2. The method of claim 1, wherein the method is based on a Transformer. Step 3 specifically includes the following steps: Step 3.1: Set training parameters; Step 3.2: Input the depth image compression dataset established in Step 2 into the Transformer-based depth image compression model described in Step 1 and train it according to the parameters set in Step 3.1; Step 3.3: Use the Adam stochastic optimization algorithm to perform stochastic gradient descent on the Transformer-based depth image compression model trained in Step 3.2 to continuously optimize the loss function. Based on the loss change trend of cross-validation between the training set and the validation set, until the loss change gradually tends to a stable state, determine the optimal weight.

3. The method of claim 1, wherein the method is based on a Transformer. Step 5 specifically includes: Based on the test results of step 4, the Transformer-based deep image compression model trained in step 3 is evaluated using PSNR (Peak Signal-to-Noise Ratio), MS-SSIM (Multi-Scale Structural Similarity), and compression ratio. The evaluation results of the Transformer-based deep image compression model are evaluated to determine whether the PSNR (Peak Signal-to-Noise Ratio), MS-SSIM (Multi-Scale Structural Similarity), and compression ratio meet the requirements of practical applications. If the Transformer-based deep image compression model meets the requirements of image compression applications in real-world scenarios, proceed to step 6; otherwise, proceed to the next step. Adjust the learning rate during the training of the Transformer-based deep image compression model in step 3. Reduce the learning rate by a factor of ten when the training is repeated 200 times, and reduce the learning rate by a factor of ten again when the training is repeated 300 times. Then jump to step 3 to retrain.

4. The method of claim 1, wherein the method is based on a Transformer. The dataset described in step 2 contains high-resolution images of 24 million pixels, and all of them are high-contrast digital images with a contrast ratio greater than 300:1, which is beneficial for model training.

5. The method of claim 1, wherein: Step 2 specifically includes the following steps: Step 2.1: Take 600 high-quality images containing trees, vehicles, people, animals, and buildings using a visible light digital camera; Step 2.2: Randomly crop each high-quality image captured in Step 2.1 into 50 images of size 256×256 pixels, and finally obtain a depth image compression dataset containing 30,000 images. Step 2.3: Randomly select 70% of the deep image compression dataset described in Step 2.2 as the training set of the model, 20% as the test set of the model, and 10% as the validation set of the model.

6. The method of claim 2, wherein: The specific steps for setting training parameters in step 3.1 are as follows: the batch size is set to Batch size = 8, the initial learning rate is set to Ir = 0.0001, and the number of training iterations is Epoch = 400.

Citation Information

Patent Citations

  • Multi-feature fusion image compressed sensing reconstruction method based on Attention

    CN111667445A

  • A Compressed Sensing Reconstruction Method for Images Based on Attention-Based Multi-Feature Fusion

    CN111667445B

  • Disease information identification method, system and device and storage medium

    CN113469049A

  • Ultrasonic image quantification method based on interactive fusion Transform

    CN114863111A