{'fraction_non_alphanumeric': 0.043486499289436285, 'fraction_numerical': 0.01596399810516343, 'mean_word_length': 4.477685521536066, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Fidelity-Controllable Extreme Image Compression with Generative Adversarial Networks

We propose a GAN-based image compression method working at extremely low bitrates below 0.1bpp. Most existing learned image compression methods suffer from blur at extremely low bitrates. Although GAN can help to reconstruct sharp images, there are two drawbacks. First, GAN makes training unstable. Second, the reconstructions often contain unpleasing noise or artifacts. To address both of the drawbacks, our method adopts two-stage training and network interpolation. The two-stage training is effective to stabilize the training. Moreover, the network interpolation utilizes the models in both stages and reduces undesirable noise and artifacts, while maintaining important edges. Hence, we can control the trade-off between perceptual quality and fidelity without re-training models. The experimental results show that our model can reconstruct high quality images. Furthermore, our user study confirms that our reconstructions are preferable to state-of-the-art GAN-based image compression model. The code will be available.


I. INTRODUCTION
Image compression is an important technique for efficient image storage. Recently, machine-learning based image compression methods have been studied [1]- [4]. Some approaches outperform engineered codecs, such as JPEG, JPEG2000, and BPG [5]. Generally, machine-learning based methods are trained to minimize the rate-distortion object function in endto-end fashion.
min R + λD (1) R, D and λ are a rate term, a distortion term, and a Lagrange multiplier, respectively. R represents the entropy of latent codes, which is estimated by an entropy model. D means difference between the original image and the compressed one, e.g., mean squared error (MSE) and multi-scale structural similarity (MS-SSIM). λ determines the desired ratedistortion trade-off. The compression ratio is high when λ is small, however, the compressed images suffer from blur. Especially at a very low bitrate, perceptual quality of a reconstruction becomes so poor.
To tackle the problem, some methods [6]- [9] adopt generative adversarial networks (GAN). Although GAN makes distortion high, perceptual quality becomes better. Moreover, they produce less blurry compressed images even at low bitrates. However, there are two main drawbacks in GANbased methods. First, GAN-based methods suffer from unstable training. Second, reconstructions often contain undesirable noise or artifacts.
In this paper, we focus on the very low bitrate below 0.1 bit per pixel (bpp) compression. We propose a novel GAN-based image compression method that overcomes the aforementioned two problems. In order to make training stable, we utilize a two-stage training [9]. In the first stage, we train both of the encoder and decoder by optimizing (1) without GAN modules. In the second stage, we fine-tune only the decoder with GAN. Since this training strategy makes the optimization simple, training becomes stable. Moreover, inspired by recent advance in super resolution [10], we merge two decoders with/without GAN to suppress noises and artifacts. This enables us to control the balance between perceptual quality and fidelity of reconstructions. Therefore, our reconstructions can avoid degradation while maintaining high perceptual quality. Futhermore, inspired by [4], we utilize Gaussian mixture model (GMM) for flexible entropy model. As shown in Fig. 1, the proposed method yields visually more pleasing results than the engineered codec BPG [5] and another GAN-based compression model Agustsson et al. [6] at extreme low bitrates. BPG is blurry and [6] suffers from excessive noise. In contrast, the proposed method can reconstruct a high quality and high fidelity image.
The main contributions of this paper are followings: • We combine the compression method [4] with GAN and achieve to reconstruct high quality images at extreme low bitrates (below 0.1bpp). • We propose to merge two decoders with or without GAN into one decoder so that we can suppress undesirable noise and artifacts in reconstructions. • Our user study verified that the proposed method achieved better visual quality than the existing GAN-based method [6].

II. RELATED WORKS A. Generative Adversarial Networks
Generative adversarial networks (GAN) [11] is an active area of research. GAN has two components, generator G and discriminator D. These networks are trained to optimize the adversarial min-max problem: x and z are a real image and a latent code, respectively. The generator learns to fool the discriminator, whereas the discriminator learns to distinguish real and fake images. In this way, the generator can generate photo-realistic images. GAN has been used in image restoration tasks such as superresolution [10], image deblurring [12], or image-inpainting [13] as well as image generation because GAN helps the model to reconstruct realistic images.

B. Learned Image Compression
Recently, a lot of deep-learning based image compression methods have been proposed [1]- [4], [14]- [16]. [1] proposes end-to-end trainable image compression system which optimize rate-distortion trade-off (1). Some works investigate the effective entropy model. [2] introduced hyperprior networks that utilize side information to estimate variance parameters of distributions of latent codes. [3], [15] combined a hyperprior with a 2D PixelCNN-based [17] context model. These methods estimate the mean and variance of the distribution of latent codes. [14] adopts 3D-CNN in the context model and uses an importance map for adaptive bit allocation. [4] utilizes the Gaussian mixture model instead of a single Gaussian distribution to achieve a more flexible entropy model. Other works focus on the architectures of networks. [18] proposes a multi-scale encoder-decoder network. [16] adopts non-local attention modules to capture both local and global features. Since the methods mentioned above learn to optimize ratedistortion trade-off (1), the reconstructions suffer from blur at low bitrates.
Some methods [6]- [9], [19] adopt GAN framework to reconstruct realistic images. [7] introduces adversarial training and pyramidal decomposition. However, [7] adopts a complex and heuristic training procedure for stable training, and it is a non-standard GAN training. [6], [8] achieved to reconstruct realistic images at low bitrates. These methods use no rate term in their loss functions for stable training, but it can lead to suboptimal bitrates. [19] can generate photo-realistic images at every bitrate. However, this method focuses on domainspecific datasets such as face or bedroom images. [9] proposes two-stage training for stable training. The compression model can reconstruct high perceptual quality images. Some methods [6]- [9] tackle the problem of unstable training. However, they cannot reduce the undesirable noise or artifacts which may change the impression of the image. Our method utilizes the two-stage training [9] and a network-interpolation [10] to tackle both the problems.

III. PROPOSED METHOD
We show the overall pipeline of our compression system in Fig. 2. In this section, we will explain details of the architecture, the two-stage training, and the network interpolation.

A. Image Compression Model
We developed our image compression model on the basis of the state-of-the-art model [4] with two main renovations. First, we add an additional discriminator to adopt adversarial training for improving perceptual quality. Second, we remove hyperprior networks of [4] because the model learns to make the entropy of side information zero at extremely low bit rate setting.
As shown in Fig. 3, our model has five components: an encoder E, a quantizer Q, a decoder G, a context-based entropy model C, and a discriminator D.
The encoder E transforms a real image x into a latent code y. It consists of six residual blocks, two attention modules, and two convolution layers. We use simplified attention modules to reduce the calculation cost.
The quantizer Q quantizes y and produces the quantized code z. Following to [1], we use additive uniform noise U(0.5, −0.5) for quantization during training, and we use ROUND(·) during inference.
The entropy model C consists of one masked convolution layer and three 1×1 convolution layers, as shown in Fig. 3 (a). The masked convolution layer extracts information from the known subset of z, therefore, it works as the context. Then, we estimate the parameters of distributions p(z) through the rest three convolution layers. Since we use a Gaussian mixture model to represent p(z i ), it is defined by using 3K parameters: θ C denotes the parameters of C, and z <i represents the known subset of z at the i-th element, such as z <i = (z 1 , · · · , z i−1 ). Then, we transform z into a bit stream through the entropy coding. In this way, C can control the bit allocation. It learns to reduce bits of simple regions and allocate more bits to complex regions over the images. The decoder G generates a reconstrcutionx from z. It is a reverse structure of the encoder. We adopt subpixel convolutions for upsampling.
The discriminator D is trained to distinguish x fromx. Our discriminator is based on the multi-scale discriminator, which was proposed in [20]. The multi-scale discriminator has three sub-discriminators. Each sub-discriminator has an identical architecture but works at different scales as shown in Fig. 3(b).

B. Two-stage Training
Our goal is to minimize the loss function L in Eq. 5. There are three trade-off terms: rate L R , distortion L d , and perception L adv . The details are described in section III-D.
We trained the model to optimize (5) in end-to-end manner. However, (5) is hard for minimizing. As shown in Fig. 4, the reconstructions suffer from noises, blur, or artifacts and perceptual qualities are quite low. According to [21], there is a triple trade-off between rate, distortion, and preception. Hence, the end-to-end training failed because the model had to optimize three trade-off terms at the same time.
To tackle this problem, we utilize a two stage training [9]. Fig. 2 shows the training scheme. In the first stage, we train the encoder E, decoder G 1 , and entropy model C to optimize rate-distortion trade-off, that is, we use no adversarial loss (λ adv = 0). In the second stage, we initialize the parameters of the decoder G 2 with G 1 and fine-tune only G 2 to optimize distortion-perception trade-off. Since the parameters of the encoder and entropy model are fixed, z and p(z) do not change through the second stage. Thus we can set λ R to 0.
This training method has three advantages. First, the twostage training avoids optimizing triple trade-off directly. The model is trained to optimize double trade-off twice and it is effective for a stable training. Second, after the first stage, the decoder can reconstruct plausible images. Therefore, the discriminator cannot distinguish between real and fake easily even at the very beginning of training. It can lead to a balanced adversarial training. Third, we can control the balance between perceptual quality and fidelity of reconstructions through network interpolation [10] without re-training the model. Therefore, the two-stage training is also effective to tackle the problem of noise or artifact. We will describe the details in the next subsection.

C. Network Interpolation
It is desirable that reconstructions are realistic and similar to their original images. However, there is a trade-off between   distortion and perceptual quality. Thus, improving perceptual quality using adversarial training leads to a high distortion. The reconstructions often contain undesirable noises or artifacts and the impression can be changed. It is a serious problem in image compression.
To tackle this problem, we use the network interpolation [10]. After two-stage training, we have two decoders: G 1 and G 2 as shown in Fig. 2. The outputs of G 1 are high fidelity but blurry because we use no adversarial loss at the first stage. Whereas, the outputs of G 2 are good perceptual quality but noisy. Since these decoders share the same encoder and entropy model, we can reconstruct two images from the same latent code. Consequently, we can obtain more desirable images by interpolating the two decoders.
There are two interpolation methods. The first method is a network interpolation. Fig. 5 shows convolution kernels of the two decoders. It shows that though the scales of the parameters are changed after fine-tuning, the patterns of the kernels are not changed significantly. Therefore, we interpolate all the corresponding parameters of the two decoders by (6).
θ G , θ G 1 , and θ G 2 are the parameter of the interpolated decoder G , G 1 , and G 2 , respectively. α ∈ [0, 1] is the interpolation parameter. By adjusting α, we can continuously control the distortion-perception trade-off without re-training the model. Another method is an image interpolation. We produce imagex by merging reconstructions of the two decoders pixel by pixel.x = (1 − α)x 1 + αx 2 (7) x ,x 1 , andx 2 are the interpolated reconstruction, the reconstruction of G 1 and G 2 , respectively.

D. Loss function
We define two loss functions L 1st and L 2nd for the first and second stages, respectively.
For the first stage, we define the loss function L 1st as (8), where N is the number of pixels of the image x. We use the rate term L R and the distortion term L d . L R represents an estimated bitrate of z. In this stage, we use mean squared error (MSE) between x andx as the distortion loss.
For the second-stage, the loss function is defined in (10). We use MSE L d , adversarial loss L adv , and VGG loss L vgg . For the adversarial training, we adopt Least-Squares GAN [22].
The VGG loss L vgg is the L1 distance between the feature maps of VGG-19 [23]. As in [10], we use the feature map obtained in the fourth convolution before the fifth max-pooling layer. It helps the model to reconstruct sharp image.

A. Experiments Details
For training, we used 256 × 256 patches extracted from 118287 images in COCO dataset [24]. For evaluation, we used Kodak PhotoCD image dataset [25]. We set the batch size to 8. We trained the whole model for 500k iterations in the first stage and fine-tuned only the decoder for 300k iterations in the second stage. The learning rate is set to 2 × 10 −5 and halved at [150k, 300k] iterations. We applied Adam optimizer [26]. The number of mixture K is set to 3.
For the first training, λ (1) d depends on our ideal bitrates. We trained four models with different compression rates. For the second training, we minimize the loss in (10) with λ (2) d = 0.01, λ adv = 1, and λ VGG = 20. Note that, when we calculate MSE, the ranges of x andx are [0, 255]. We use network interpolation to reduce undesirable noises. We set the interpolation parameter α to 0.8.

B. Qualitative Result
We compare our method on the Kodak dataset with the stateof-the-art engineered compression codec BPG [5] (in the 4:2:0 chroma format), the GAN-based image compression method Agustsson et al. [6], and the PSNR-oriented compression method Cheng et al. [4] at extreme low bitrate.

C. User Study
We performed a user study to compare our method and Agustsson et al. [6]. [6] has two models: 0.03bpp model and 0.06bpp model. We chose 31 pairs of the reconstructions of ours and [6] so that the difference of bitrates between them is less than 0.005bpp and 0.01bpp for the 0.03bpp model and the 0.06bpp model, respectively. The summary of the pairs are shown in Table I. The average bitrates of ours and [6] 0.03bpp model are 0.0332bpp and 0.0333bpp, respectively, and ours and [6] 0.06bpp model are 0.0644bpp and 0.0678bpp, respectively. We showed the users the original image and two reconstructions. The users were requested to evaluate which reconstruction is preferable as compressed image on a scale of 1 to 5. We asked 19 users.
As shown in Fig. 7, our method outperforms Agustsson et al. in both 0.03bpp model and 0.06bpp model. More than 60% of the answers are "Ours is preferable" or "Ours is slightly preferable". Especially, our method achieves high score against [6] 0.03bpp model. This indicates that our method provides good performances even at extreme low bitrates (around 0.03bpp). Fig. 8 shows an example which our reconstruction is highly evaluated. Over 90% users answered "Ours is preferable" or "Ours is slightly preferable" to this image. When we focus on the background of the image, the reconstruction of Agustsson et al. looks better. However, the faces of the birds collapse and the reconstruction looks unnatural. In contrast, our method succeeds in reconstructing the faces because it can allocate more bits to complex regions. Thus, a lot of users value our method highly.

D. Network Interpolation
We compare the two interpolation methods: network interpolation (6) and image interpolation (7). We change the interpolation parameter α from 0 to 1 with an interval of 0.2. As shown in Fig. 9, in both methods, when we decrease α, we can reduce noises but the reconstructions become blurry. In contrast, when we increase α, the reconstructions become sharper but they suffer from artifacts or noises. We can balance noise and blur without re-training the model by adjusting α.

Original Ours
Agustsson et al. [6] BPG [5] Cheng et al. [4] 0 Though both methods can reduce noises, the network interpolation works better than the image interpolation in image compression as well as super-resoluton [10]. In Fig. 9, though the network interpolation reduces the noise at α = 0.8, the image interpolation suffers from noise even at α = 0.6. The network interpolation can reduce the noise while it keeps the image sharp. In contrast, the image interpolation reduces noises as well as edges.

E. Ablation Study
First, we analyze the effects of the entropy model which utilizes the Gaussian mixture model and the context model. Agustsson et al. [6] 0.034bpp Original 0% 20% 40% 60% 80% 100% Ours is preferable Ours is slightly preferable Neutral Fig. 8. An example of user study results. Over 90% users answered "Ours is preferable" or "Ours is slightly preferable".
We trained two models: w/o GMM and w/o context. We will explain the details. w/o GMM: We use a single Gaussian model instead of a Gaussian mixture model in the entropy model. Therefore, the entropy model estimates mean and standard deviation parameters of the distribution of quantized code.
w/o context model: We use a simple entropy model which has no layers. We assume the distribution p(z) follows Gaus-  sian models which have a learnable standard deviation. Fig. 10 shows the average bitrate and PSNR of Kodak dataset in the first stage. Note that since the entropy model does not affect the second stage, we evaluate them on the first stage. Our full model outperforms w/o GMM and w/o context. It indicates that the Gaussian mixture model is effective even below 0.05bpp.
Next, we evaluate the training scheme and loss functions. We trained four models for comparison. Detailed settings are as follows.
w/o 2nd stage: We do not fine-tune the model. The model is trained to optimize rate-distortoin trade-off and adversarial training is not used in this setting.
end-to-end: We train this model in end-to-end manner. The loss function is: We set λ R , λ d , λ adv , and λ vgg to 2.4, 0.01, 1, and 20, respectively.
w/o VGG loss: This model is trained using two-stage training. We use no VGG loss in the second stage.
w/o net-interp: This model is trained in the same way as our full model, however, we do not use network interpolation.
In Fig. 11, we provide comparison of the baselines and our full model. The reconstructions of w/o fine-tuning are blurry. Since this model is trained to optimize rate-distortion trade-off, the perceptual quality become worse. The end-to-end trained model suffers from unnatural noise and artifacts. Though the reconstructions are not blurry, perceptual qualities are poor. The w/o VGG loss model reconstructs relatively plausible images, however, it fails to generate fine texture. For instance, in the bottom image in Fig. 11, the leaves of the tree are blurry. In contrast, the w/o net-interp generates fine details. It shows that VGG loss helps the model to add finer textures to reconstructions. However, the reconstructions contain noises. Our full model can reconstruct visually pleasing images. Network interpolation reduces noise while maintaining fine details.

V. CONCLUSION
We proposed GAN-based extreme image compression method. Our method utilizes Gaussian mixture model in entropy model and we showed that it works well even at very low bitrates. We adopt the two-stage training and the network interpolation to tackle the two main problems of GAN-based compression methods: unstable training and undesirable noises or artifacts. Our reconstructions are perceptually high quality and high fidelity. Moreover, our user study shows the proposed method outperforms Agustsson et al. [6] in terms of the quality as compressed images.