Method and device for image compression and decompression based on variational autoencoder
By using the noise-added training variational autoencoder and the distance loss function of quantized feature distribution in image compression, the problem of traditional methods being ineffective in low code rate areas is solved, and higher image compression efficiency and decoding fidelity are achieved. Spend.
Patent Information
- Application Number
- CN202010196440.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-19
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2040-03-19
AI Technical Summary
The compression effect of traditional image compression methods is not ideal in low bit rate areas, and the fidelity of decoded images is difficult to guarantee.
By adding noise to the training image, the variational autoencoder (VAE) is used for image compression and decompression to improve the performance and feature extraction robustness of VAE. The distance between the noisy training image and the quantified feature distribution is used as the loss function to enhance Decoded image fidelity.
It achieves better image compression effect in the low code rate range and improves the fidelity of decoded images, which is suitable for noisy channel transmission.
Smart Images

Figure CN113497938B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and in particular to a method and device for image compression and decompression based on a variational autoencoder. Background Art
[0002] Image compression can reduce the redundant information in image data. Therefore, image compression is of great significance to improving the storage efficiency and transmission efficiency of images. Traditional image compression methods such as the Joint Photographic Experts Group (JPEG) have good compression effects in medium and high bit rate areas. In low bit rate areas, the compression effects of traditional image compression methods are not ideal.
[0003] A new image compression method is to compress the encoded image through a variational auto encoder (VAE). This method mainly uses a convolutional network and corresponding nonlinear transformation to extract image features, and directly performs arithmetic coding on the image features to achieve the compression purpose. Compared with traditional image compression methods, this method can save complex parameter design and module design. During decompression, a generative model can be used to reconstruct the decoded image.
[0004] The above method can achieve image compression in a low bit rate range. However, since the decoded image is reconstructed by the generative model, the fidelity of the decoded image cannot be guaranteed. Summary of the invention
[0005] The present application provides a method and device for image compression and decompression based on VAE, which can achieve better compression effect in a low bit rate range and improve the fidelity of the decoded image.
[0006] In a first aspect, a method for training a VAE is provided, the method comprising: obtaining a training image; adding a first noise to the training image to obtain a noisy training image; training a variational autoencoder using the noisy training image, the variational autoencoder being used to compress and decompress the noisy training image.
[0007] Adding the first noise to the training image is equivalent to perturbing the pixel distribution of the training image. Since the characteristics of the first noise (such as the standard deviation) are known, VAE can use the global context information around the perturbed pixels for encoding, thereby improving the information utilization of the training image at a low bit rate. Therefore, training VAE with noisy training images can improve the performance of VAE, thereby improving the fidelity of the decoded image. In addition, training VAE with noisy training images can improve the robustness of the feature extraction function of VAE, and when a noisy channel is used to transmit the bitstream, the fidelity of the decoded image can be improved.
[0008] Optionally, the energy of the first noise is smaller than the energy of the training image.
[0009] If the energy of the first noise is too large, the image information may be masked by the noise. Therefore, adding the first noise with smaller energy to the training image can avoid the information of the training image from being masked and improve the performance of VAE.
[0010] Optionally, the first noise is Gaussian noise or Poisson noise.
[0011] Optionally, the training of the variational autoencoder using the noisy training image includes: extracting image features from the noisy training image; adding a second noise to the image features for quantization to obtain quantized image features, wherein the second noise is uniform noise; determining a feature distribution of the quantized image features; determining a distance between the feature distribution and a multivariate distribution; and training the variational autoencoder according to the distance.
[0012] The distance between distributions is used to represent the gap between the actual feature distribution and the theoretical feature distribution. Therefore, the distance between distributions can be used as a loss function to train VAE. In addition, multivariate distribution, that is, a combination of multiple distributions (such as mixed Gaussian distribution), is equivalent to noise of multiple intensities, which can better predict the feature distribution of quantized image features and reduce the encoding bit rate.
[0013] Optionally, the image features include YUV features.
[0014] The noisy training images are usually RGB images, and the YUV features are three-channel features extracted from the RGB images. Compared with directly extracting single-channel features from RGB images, the above scheme enables VAE to learn the potential high-dimensional features of the noisy training images and improve the performance of VAE.
[0015] Optionally, the upper and lower limits of the distribution of the second noise are [-0.5, +0.5].
[0016] The second noise with the upper and lower limits of the distribution being [-0.5, +0.5] can ensure that the quantization order is 1, which is convenient for quantization by rounding off during the test process.
[0017] Optionally, the method further includes: determining a reconstruction error of the variational autoencoder reconstructing the training image; and training the variational autoencoder according to the reconstruction error.
[0018] The reconstruction error can reflect the fidelity of the decoded image. The larger the reconstruction error, the lower the decoding fidelity, and the bit rate needs to be increased; the larger the reconstruction error, the higher the decoding fidelity, and the bit rate can be reduced. Therefore, training VAE based on reconstruction error can improve the performance of VAE.
[0019] In a second aspect, a method for compressing an image is provided, comprising: obtaining a test image; compressing the test image through a variational autoencoder and generating a code stream, wherein the variational autoencoder is trained based on the method described in any one of the first aspects.
[0020] The VAE used in the above compressed images is trained based on noisy training images, which has stronger robustness and can improve the information utilization of test images under low bit rate conditions, thereby improving the compression effect of test images. In addition, when using a noisy channel to transmit the bit stream, the negative impact of the noisy channel can be reduced.
[0021] In a third aspect, a method for decompressing an image is provided, comprising: receiving a code stream; obtaining test image features from the code stream; and decompressing the image features using a variational autoencoder, wherein the variational autoencoder is trained based on the method described in any one of the first aspects.
[0022] The VAE used in the above decompressed image is trained based on the noisy training image, has stronger robustness, and can improve the information utilization of the test image under low bit rate conditions. Therefore, decompression based on the above VAE can improve the fidelity of the decoded image.
[0023] In a fourth aspect, a device for training VAE is provided, comprising a unit for executing any one of the methods in the first aspect.
[0024] According to a fifth aspect, a device for compressing an image is provided, comprising a unit for executing any one of the methods in the second aspect.
[0025] According to a sixth aspect, a device for decompressing an image is provided, comprising a unit for executing any one of the methods in the third aspect.
[0026] In a seventh aspect, an electronic device for training VAE is provided, comprising a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that the device executes any one of the methods in the first aspect.
[0027] In an eighth aspect, an electronic device for compressing images is provided, comprising a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that the device executes any one of the methods in the second aspect.
[0028] In a ninth aspect, an electronic device for decompressing images is provided, comprising a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that the device executes any one of the methods in the third aspect.
[0029] In a tenth aspect, a computer program product is provided, the computer program product comprising: a computer program code, when the computer program code is executed by a device for pruning a neural network, the device executes any one of the methods in the first aspect.
[0030] In the eleventh aspect, a computer program product is provided, comprising: a computer program code, when the computer program code is executed by a device for pruning a neural network, the device executes any one of the methods in the second aspect.
[0031] In the twelfth aspect, a computer program product is provided, the computer program product comprising: a computer program code, when the computer program code is executed by a device for pruning a neural network, the device executes any one of the methods in the third aspect.
[0032] In a thirteenth aspect, a computer-readable medium is provided, wherein the computer-readable medium stores a program code, wherein the program code includes instructions for executing any one of the methods in the first aspect.
[0033] In a fourteenth aspect, a computer-readable medium is provided, wherein the computer-readable medium stores a program code, wherein the program code includes instructions for executing any one of the methods in the second aspect.
[0034] In a fifteenth aspect, a computer-readable medium is provided, wherein the computer-readable medium stores a program code, wherein the program code includes instructions for executing any one of the methods in the third aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 It is a schematic diagram of the structure of a VAE provided in this application;
[0036] Figure 2 It is a schematic diagram of a method for training VAE provided in this application;
[0037] Figure 3 It is a schematic diagram of the structure of another VAE provided in this application;
[0038] Figure 4 is a schematic diagram of a method for compressing an image provided by the present application;
[0039] Figure 5 is a schematic diagram of a method for decompressing an image provided by the present application;
[0040] Figure 6 is a schematic diagram of a device for training VAE provided in the present application;
[0041] Figure 7is a schematic diagram of a device for compressing an image provided by the present application;
[0042] Figure 8 is a schematic diagram of a device for decompressing an image provided by the present application;
[0043] Fig. 9 It is a schematic diagram of an electronic device provided by the present application. DETAILED DESCRIPTION
[0044] The technical solution in this application will be described below in conjunction with the accompanying drawings.
[0045] Figure 1 1 is a schematic diagram of the structure of a VAE provided in the present application. VAE 100 includes an encoder 110 , a quantization module 120 , a rate-distortion control module 130 , an arithmetic coding module 140 , an arithmetic decoding module 150 and a decoder 160 .
[0046] The encoder 110 is used to process the input image, such as performing noise perturbation and feature extraction on the input image.
[0047] The quantization module 120 is used to quantize the image features output by the encoder 110 for subsequent processing.
[0048] The rate-distortion control module 130 is used to constrain the distribution of image features according to the probabilistic prior information to control the bit rate. The distance between the distributions is used to represent the gap between the actual feature distribution and the theoretical feature distribution. Therefore, the distance between the distributions can be used as a loss function to train the VAE, and the actual feature distribution is constrained by the theoretical distribution. For example, after the rate-distortion control module 130 obtains the quantized image features from the quantization module 120, it generates feature coefficients, and then sends the feature coefficients and the probabilistic prior coefficients to the arithmetic coding module 140, so that the arithmetic coding module 140 performs arithmetic coding based on the above two coefficients.
[0049] The arithmetic coding module 140 is used to perform arithmetic coding on the quantized image features output by the quantization module 120. During the arithmetic coding process, the bit rate is determined based on the feature coefficients output by the rate-distortion control module 130 and the probability prior coefficients to generate a bit stream.
[0050] The arithmetic decoding module 150 is used to decode the code stream output by the arithmetic coding module 140 to restore image features.
[0051] The decoder 160 is used to reconstruct a decoded image according to the image features restored by the arithmetic decoding module 150 .
[0052] It should be noted that VAE100 is an example of a VAE applicable to the present application but is not limiting. The VAE applicable to the present application may also have other structures.
[0053] Below, the image compression and image decompression methods provided by the present application are described in conjunction with VAE100.
[0054] In order to obtain a VAE with higher performance, VAE needs to be trained first. The training method is as follows: Figure 2 The method 200 may be executed by a server or a terminal device or a chip, and the method 200 includes the following contents.
[0055] S210, obtaining a training image.
[0056] The training image may be an RGB image. For example, an image in the training set of the Challenge on Learned Image Compression (CLIC) in the Conference on Computer Vision and Pattern Recognition (CVPR) 2019 may be used as the training image. The training image may also be other types of images, and the specific form of the training image is not limited in this application.
[0057] After the encoder 110 obtains the training image, it may perform the following steps.
[0058] S220, adding a first noise to the training image to obtain a noisy training image.
[0059] The first noise is a noise with known probabilistic prior information (standard deviation and variance), such as Gaussian noise or Poisson noise. If the energy of the first noise is too large, the image information may be masked by the noise. In order to avoid the information of the training image being masked by the first noise, a first noise with smaller energy can be added to the training image, such as a first noise with less energy than the energy of the training image, which can improve the performance of VAE.
[0060] In the present application, adjectives such as "first" and "second" are used to limit different individuals of the same type of objects, such as: "first noise" and "second noise" below represent two different noises, and there is no other limitation.
[0061] The operation of adding the first noise can be performed by a noise disturbance module ( Figure 1 Taking the first noise as Gaussian noise as an example, the noise perturbation module can use a Gaussian function with a specific standard deviation to perturb the training image, which is equivalent to performing a global Gaussian filter on the training image in the frequency domain, and finally obtaining a noisy training image.
[0062] The training image can be processed according to formula (1) to obtain a noisy training image.
[0063]
[0064] In formula (1), p(x) represents the distribution of training images; N(0,σ 2 ) represents a Gaussian distribution with a mean of 0 and a standard deviation of σ, where the value of σ can be 0.01; represents the distribution of noisy training images.
[0065] After obtaining the noisy training image, the encoder 110 may perform the following steps.
[0066] S230: training a variational autoencoder using the noisy training image, wherein the variational autoencoder is used to compress and decompress the noisy training image.
[0067] Adding the first noise to the training image is equivalent to perturbing the pixel distribution of the training image. Since the characteristics of the first noise (such as the standard deviation) are known, VAE100 can use the global context information around the perturbed pixels for encoding, thereby improving the information utilization of the training image at a low bit rate. Therefore, training VAE100 with noisy training images can improve the performance of VAE100, thereby improving the fidelity of the decoded image. In addition, training VAE100 with noisy training images can improve the robustness of the feature extraction function of VAE100, and when a noisy channel is used to transmit a bitstream, the fidelity of the decoded image can be improved.
[0068] During the training process of VAE 100, encoder 110 can extract image features from the noisy training images through convolutional layers. Figure 3 As shown, represents a noisy training image, where x represents a training image and ε represents Gaussian noise; the encoder 110 includes 4 encoding units, each of which includes 1 convolution layer and 1 generalized divergent normalization (GDN) layer, the convolution kernel size of the convolution layer is 3×3, the convolution step is 2, and the convolution channels are 128, 256, 256 and 256 respectively. The above 4 encoding units can also be called image transformation modules. Another 3×3×192 convolution layer is used to change the number of channels of the convolution output and adjust the output value of the RELU activation function of the previous layer.
[0069] The noisy training image is usually an RGB image, and YUV features can be extracted from the RGB image. The YUV features are three-channel image features. Compared with directly extracting single-channel image features from the RGB image, the above scheme enables VAE100 to learn the potential high-dimensional features of the noisy training image and improve the performance of VAE100.
[0070] Subsequently, the quantization module 120 quantizes the image features. For example, a second noise is added to the image features for quantization to obtain a quantized image feature, wherein the second noise is uniform noise, and the upper and lower limits of the distribution of the second noise are [-0.5, +0.5], which can be adaptively adjusted during the training process. The second noise with upper and lower limits of the distribution of [-0.5, +0.5] can ensure that the quantization order is 1, which is convenient for quantization by rounding off during the test process.
[0071] The rate-distortion control module 130 may determine a feature distribution of the quantized image features, and determine a distance between the feature distribution and a multivariate distribution. The distance may be used as a loss function of the rate-distortion control module 130 to train the rate-distortion control module 130 .
[0072] An example of the training rate-distortion control module 130 is given below.
[0073] The first noise is Gaussian noise, and the multivariate distribution is a mixed Gaussian distribution. The mixed Gaussian distribution is a combination of normal distributions with multiple variances, which is equivalent to noise of multiple intensities, so that the feature distribution of quantized image features can be better predicted and the encoding bit rate can be reduced.
[0074] The distance between the feature distribution and the mixed Gaussian distribution can be represented by KL (Kullback-Leibler divergence) divergence, and the rate distortion control module 130 can be trained by formula (2).
[0075]
[0076] In formula (2), θ and θ′ are network parameters to be optimized, including parameters in the encoder 110, the quantization module 120 and the rate-distortion control module 130; represents the process of extracting image features from a noisy training image, where represents the noisy training image, and z represents the image features; Represents the process of reconstructing the decoded image based on the quantized image features, where represents the reconstructed decoded image, Represents the quantized image features; Indicated in The upper expectation is evaluated based on image features, which is essentially to fit feature extraction and feature recovery potential distribution.
[0077] The rate-distortion control module 130 can determine the mean and variance (i.e., feature distribution) of the quantized image features through two convolutional layers, such as Figure 3As shown in the figure, the convolution kernel size of the two convolution layers is 3×3, the convolution step size is 1, the number of convolution channels is 192, and the convolution layer that determines the variance is followed by a nonlinear function ( Figure 3 (not shown) to ensure that the variance is always greater than 0, the nonlinear function is, for example, an exponential (exp) function; the convolution layer that determines the mean determines the mean by multiplying with n~N(0,σ).
[0078] The feature distribution determined by the above two convolutional layers is the actual feature distribution. The distance between the actual feature distribution and the theoretical feature distribution (ie, Gaussian mixture distribution) can be calculated, and the rate distortion control module 130 is trained by minimizing the distance through formula (2).
[0079] For ease of calculation, the rate-distortion control module 130 may be trained by calculating an evidence lower bound (ELBO) equivalent to the KL divergence. The ELBO is used to determine the characteristic coefficients and probability prior coefficients output by the rate-distortion module 130 .
[0080] The above describes in detail the training method of the rate-distortion control module of VAE100. The following describes the overall training method of VAE100.
[0081] In the training phase, the quantized image features can be directly input into the decoder 160 for feature recovery. The decoder 160 performs feature recovery through four decoding units, such as Figure 3 As shown in the figure, each decoding unit contains a deconvolution layer and an inverse generalized divisive normalization (IGDN) layer. The convolution kernel size of the deconvolution layer is 3×3, the convolution step is 2, and the convolution channels are 256, 128, 64, and 3 respectively. The above four decoding units can also be called image transformation modules. Another 3×3×256 deconvolution layer is used for the features after convolution quantization to maintain symmetry with the encoding end.
[0082] After feature recovery, the decoder 160 can obtain YUV features, and can convert the YUV features into RGB images, which are the reconstructed decoded images. By comparing the decoded image and the training image, the mean square error (MSE) can be obtained. The MSE is the reconstruction error of the training image. The MSE can be used as the loss function of the VAE 100 to train the encoder 110 and the decoder 160 through back propagation.
[0083] Since the quantized image features are directly fed from the encoder 110 to the decoder 160, the above training method may also be referred to as end-to-end training. End-to-end training can train the encoder and the decoder simultaneously, thereby improving training efficiency.
[0084] After VAE100 training is completed, the image can be compressed and decompressed. Below, the compression and decompression process of VAE100 is introduced using the test image as an example.
[0085] like Figure 4 As shown, the method 400 for compressing an image provided by the present application includes:
[0086] S410, acquiring a test image.
[0087] The test image may be an RGB image, for example, an image in the Kodak24 data set (512×768 color image) may be used as the test image. The test image may also be other types of images, and the present application does not limit the specific form of the test image.
[0088] S420 , compressing the test image by using a variational autoencoder and generating a code stream, wherein the variational autoencoder is trained based on method 200 .
[0089] The VAE used in the above compressed images is trained based on the noisy training images and has stronger robustness. The VAE can use the global context information around the disturbed pixels for encoding, improve the information utilization of the test images at low bit rates, and thus improve the compression effect of the test images. In addition, when using a noisy channel to transmit the bitstream, the negative impact of the noisy channel can be reduced.
[0090] In the process of compressing the test image through VAE100, the image features are first extracted from the test image through the encoder 100; the image features are then quantized through the quantization module 120, such as rounding quantization, to obtain quantized image features; then, the characteristic coefficients of the quantized image features are determined through the rate-distortion control module 130; finally, the arithmetic coding module 140 arithmetically encodes the quantized image features according to the characteristic coefficients and the probability a priori coefficients to generate a code stream, and the characteristic coefficients and the probability a priori coefficients are used to determine the bit rate of the arithmetic coding.
[0091] The above-mentioned image features are, for example, YUV features, which are three-channel features extracted from RGB images. Compared with directly extracting single-channel features from RGB images, the above-mentioned scheme enables VAE100 to extract potential high-dimensional features of the test image and improve the compression effect of the test image.
[0092] Figure 5 A decompression method provided by the present application is shown, and the method 500 includes:
[0093] S510, receiving a code stream.
[0094] S520, obtaining a test image feature from the bitstream
[0095] S530: Decompress the image features using a variational autoencoder.
[0096] The VAE used in the above decompressed image is trained based on the noisy training image, has stronger robustness, and can improve the information utilization of the test image under low bit rate conditions. Therefore, decompression based on the above VAE can improve the fidelity of the decoded image.
[0097] After the arithmetic decoding module 150 recovers the test image features from the bitstream, the image features can be reconstructed through the decoder 160. For example, the YUV features can be recovered from the test image features through the sigmoid function and tanh function in the decoder 160, and the YUV features can be converted into an RGB image, thereby completing the reconstruction of the decoded image.
[0098] Next, the beneficial effects of the image compression method and decompression method provided by the present application compared with the prior art are introduced.
[0099] Five existing technologies are selected and tested on the Kodak24 dataset (512×768 color images) with the trained VAE100, and the results shown below are obtained.
[0100] VAE100: 0.0808 bits per pixels (bpp) with a peak signal to noise ratio (PSNR) of 28.047 decibels (dB).
[0101] JPEG: PSNR at 0.1447bpp is 15.258dB.
[0102] JPEG2000: PSNR at 0.1137bpp is 27.609dB.
[0103] Better portable graphics (BPG): 0.0846bpp with a PSNR of 29.298dB.
[0104] Reference 1: The PSNR of 0.1156bpp is 28.030dB.
[0105] Reference 2: The PSNR of 0.0758bpp is 27.429dB.
[0106] Among them, document 1 is the “Proceedings of the 5 th“End-to-end optimized image compression” published at the “International Conference on Learning Representations (ICLR)”; Document 2 is “Joint autoregressive and hierarchical priors for learned image compression” published by D. Minnen et al. at the “Neural Information Processing Systems (NIPS)” conference.
[0107] It can be seen from the above results that the PSNR of VAE100 is improved by more than 1.88dB compared with the PSNR of document 1, and is improved by about 0.71dB compared with the PSNR of document 2. Therefore, the VAE100 provided in this application has better rate-distortion performance and can be applied to noisy channel transmission with a signal-to-noise ratio greater than 15dB.
[0108] In addition, the decoder size of VAE100 is about 36 megabytes (MB), which is 15% of the decoder size in Reference 2, and the decoding time is 3.5% of Tucodec.
[0109] The above describes in detail an example of a method for image compression and decompression based on VAE provided by the present application. It is understandable that, in order to implement the above functions, the corresponding device includes a hardware structure and / or software module corresponding to each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0110] The present application can divide the functional units of the device according to the above method example. For example, each function can be divided into each functional unit, or two or more functions can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the present application is schematic and is only a logical functional division. There may be other division methods in actual implementation.
[0111] Figure 6The schematic diagram of the structure of a device for training VAE provided by the present application is shown. The device 600 includes a receiving unit 620 and a processing unit 610.
[0112] The receiving unit 620 is used to: obtain a training image;
[0113] The processing unit 610 is used to: add a first noise to the training image to obtain a noisy training image; and train a variational autoencoder using the noisy training image, wherein the variational autoencoder is used to compress and decompress the noisy training image.
[0114] Optionally, the energy of the first noise is smaller than the energy of the training image.
[0115] Optionally, the first noise is Gaussian noise or Poisson noise.
[0116] Optionally, the processing unit 610 is specifically used to: extract image features from the noisy training image; add a second noise to the image features for quantization to obtain quantized image features, wherein the second noise is uniform noise; determine the feature distribution of the quantized image features; determine the distance between the feature distribution and the multivariate distribution; and train the variational autoencoder according to the distance.
[0117] Optionally, the image features include YUV features.
[0118] Optionally, the upper and lower limits of the distribution of the second noise are [-0.5, +0.5].
[0119] Optionally, the processing unit 610 is further used to: determine a reconstruction error of the variational autoencoder reconstructing the training image; and train the variational autoencoder according to the reconstruction error.
[0120] The specific manner in which the device 600 executes the VAE training method and the beneficial effects produced can be found in the relevant description in the method embodiment.
[0121] Figure 7 The schematic diagram of the structure of a device for compressing an image provided by the present application is shown. The device 700 includes a receiving unit 720 and a processing unit 710 .
[0122] The receiving unit 720 is used to: obtain a test image;
[0123] The processing unit 710 is used to compress the noisy test image and generate a code stream through a variational autoencoder, where the variational autoencoder is trained by the device 600.
[0124] The specific manner in which the device 700 executes the method for compressing images and the beneficial effects produced can refer to the relevant description in the method embodiment. Optionally, the device 700 and the device 600 are the same device.
[0125] Figure 8 The schematic diagram of the structure of a device for decompressing an image provided by the present application is shown. The device 800 includes a receiving unit 820 and a processing unit 810 .
[0126] The receiving unit 820 is used to: receive a code stream;
[0127] The processing unit 810 is used to: obtain test image features from the bitstream; and decompress the image features using a variational autoencoder, where the variational autoencoder is trained by the device 600.
[0128] The specific manner in which the device 800 performs the method for decompressing an image and the beneficial effects produced can refer to the relevant description in the method embodiment. Optionally, the device 800 and the device 600 are the same device.
[0129] Fig. 9 A structural schematic diagram of an electronic device provided by the present application is shown. Fig. 9 The dotted line in the figure indicates that the unit or the module is optional. The device 900 can be used to implement the method described in the above method embodiment. The device 900 can be a terminal device, a server or a chip.
[0130] The device 900 includes one or more processors 901, which can support the device 900 to implement the method in the method embodiment. The processor 901 can be a general-purpose processor or a special-purpose processor. For example, the processor 901 can be a central processing unit (CPU). The CPU can be used to control the device 900, execute software programs, and process data of software programs. The device 900 can also include a communication unit 905 to implement signal input (reception) and output (transmission).
[0131] For example, the device 900 may be a chip, the communication unit 905 may be an input and / or output circuit of the chip, or the communication unit 905 may be a communication interface of the chip, and the chip may be a component of a terminal device, a network device, or other electronic device.
[0132] For another example, the device 900 may be a terminal device or a server, and the communication unit 905 may be a transceiver of the terminal device or the server, or the communication unit 905 may be a transceiver circuit of the terminal device or the server.
[0133] The device 900 may include one or more memories 902, on which a program 904 is stored. The program 904 can be executed by the processor 901 to generate instructions 903, so that the processor 901 performs the method described in the above method embodiment according to the instructions 903. Optionally, data (such as VAE) can also be stored in the memory 902. Optionally, the processor 901 can also read the data stored in the memory 902, which can be stored at the same storage address as the program 904, or the data can be stored at a different storage address from the program 904.
[0134] The processor 901 and the memory 902 may be provided separately or integrated together, for example, integrated on a system on chip (SOC) of the terminal device.
[0135] The specific manner in which the processor 901 executes the method embodiment (the method for training VAE or the method for compressing an image or the method for decompressing an image) can refer to the relevant description in the method embodiment.
[0136] It should be understood that each step of the above method embodiment can be completed by a hardware-based logic circuit or a software-based instruction in the processor 901. The processor 901 can be a CPU, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, such as discrete gates, transistor logic devices, or discrete hardware components.
[0137] The present application also provides a computer program product, which, when executed by the processor 901, implements the method described in any method embodiment of the present application.
[0138] The computer program product may be stored in the memory 902 , for example, a program 904 , which is converted into an executable target file that can be executed by the processor 901 after preprocessing, compiling, assembling, linking and other processing processes.
[0139] The present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a computer, the method described in any method embodiment of the present application is implemented. The computer program can be a high-level language program or an executable target program.
[0140] The computer-readable storage medium is, for example, a memory 902. The memory 902 may be a volatile memory or a nonvolatile memory, or the memory 902 may include both a volatile memory and a nonvolatile memory. Among them, the nonvolatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0141] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described devices and equipment and the technical effects produced can refer to the corresponding processes and technical effects in the aforementioned method embodiments, and will not be repeated here.
[0142] In several embodiments provided in the present application, the disclosed systems, devices and methods can be implemented in other ways. For example, some features of the method embodiments described above can be ignored or not performed. The device embodiments described above are merely schematic, and the division of units is only a logical function division. There may be other division methods in actual implementation, and multiple units or components may be combined or integrated into another system. In addition, the coupling between the units or the coupling between the components may be direct coupling or indirect coupling, and the above coupling includes electrical, mechanical or other forms of connection.
[0143] It should be understood that in the various embodiments of the present application, the size of the serial number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0144] In addition, the terms "system" and "network" are often used interchangeably in this article. The term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0145] In short, the above is only a preferred embodiment of the technical solution of this application, and is not intended to limit the protection scope of this application. Any modification, equivalent replacement, improvement, etc. made within the principles of this application should be included in the protection scope of this application.
Claims
1. A method for training a variational autoencoder, characterized in that: include: Get training images; Adding a first noise to the training image to obtain a noisy training image; Training a variational autoencoder using the noisy training image, wherein the variational autoencoder is used to compress and decompress the noisy training image; The step of training the variational autoencoder by using the noisy training image comprises: Extracting image features from the noisy training image; Adding a second noise to the image feature for quantization to obtain a quantized image feature, wherein the second noise is uniform noise; determining a feature distribution of the quantified image feature; determining a distance between the characteristic distribution and a multivariate distribution; The variational autoencoder is trained according to the distance.
2. The method according to claim 1, characterized in that The energy of the first noise is smaller than the energy of the training image.
3. The method according to claim 1, characterized in that The first noise is Gaussian noise or Poisson noise.
4. The method according to claim 1, characterized in that: The image characteristics include YUV characteristics.
5. The method according to claim 1, characterized in that The upper and lower limits of the distribution of the second noise are [-0.5, +0.5].
6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: Determining a reconstruction error of the variational autoencoder to reconstruct the training image; The variational autoencoder is trained according to the reconstruction error.
7. A method for compressing an image, characterized in that: include: Get a test image; The test image is compressed and a code stream is generated by a variational autoencoder, wherein the variational autoencoder is trained based on the method described in any one of claims 1 to 6.
8. A method for decompressing an image, characterized in that: include: Receive code stream; Acquire test image features from the code stream; The image features are decompressed by a variational autoencoder, wherein the variational autoencoder is trained based on the method according to any one of claims 1 to 6.
9. A device for training a variational autoencoder, characterized in that: It includes a receiving unit and a processing unit. The receiving unit is used to: obtain a training image; The processing unit is used to: add a first noise to the training image to obtain a noisy training image; train a variational autoencoder using the noisy training image, and the variational autoencoder is used to compress and decompress the noisy training image; The processing unit is specifically used for: Extracting image features from the noisy training image; Adding a second noise to the image feature for quantization to obtain a quantized image feature, wherein the second noise is uniform noise; determining a feature distribution of the quantified image feature; determining a distance between the characteristic distribution and a multivariate distribution; The variational autoencoder is trained according to the distance.
10. The device according to claim 9, characterized in that The energy of the first noise is smaller than the energy of the training image.
11. The device according to claim 9, characterized in that The first noise is Gaussian noise or Poisson noise.
12. The device according to claim 9, characterized in that The image characteristics include YUV characteristics.
13. The device according to claim 9, characterized in that The upper and lower limits of the distribution of the second noise are [-0.5, +0.5].
14. The device according to any one of claims 9 to 13, characterized in that The processing unit is also used for: Determining a reconstruction error of the variational autoencoder to reconstruct the training image; The variational autoencoder is trained according to the reconstruction error.
15. A device for compressing an image, characterized in that: It includes a receiving unit and a processing unit. The receiving unit is used to: obtain a test image; The processing unit is used to compress the test image and generate a code stream through a variational autoencoder, wherein the variational autoencoder is trained based on the method described in any one of claims 1 to 6.
16. A device for decompressing an image, characterized in that: It includes a receiving unit and a processing unit. The receiving unit is used to: receive a code stream; The processing unit is used to: obtain test image features from the code stream; and decompress the image features through a variational autoencoder, wherein the variational autoencoder is trained based on the method described in any one of claims 1 to 6.
17. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 6.
18. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to perform the method of claim 7 .
19. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to perform the method of claim 8 .
