Swin-Transformer for Image Compression
Swin-Transformer for Image Compression
iew
model for image compression
Yujin Zhanga , Jixiang Chenga,∗, Zhidan Lia
a Schoolof Electrical Engineering and Information,
Southwest Petroleum University, Chengdu, P.R. China 610500
ev
Abstract
r
With the development of deep learning technology, the application of deep learn-
ing to image compression has received extensive attention. Although the varia-
er
tional autoencode based methods have surpassed traditional compression meth-
ods in terms of rate-distortion performance, they still possess the inherent de-
fect of convolutionary neural network, i.e., ignoring the correlation between lo-
pe
cal features and global semantic information. Inspired by the recent research of
Swin-Transformer, which leverages local perceptual attention and global percep-
tual attention to capture the correlation between spatially adjacent elements and
global semantic information, this paper proposes a Swin-Transformer based en-
tropy model for image compression, called SwimTransEntropy. This model ap-
plies a Swim-Ttransformer based codec, decouples the mean and variance param-
ot
eters of the entropy model and uses fusion context autoregressive to improve the
accuracy and efficiency of entropy coding. In addition, an asymmetric decoder
that blends traditional convolutionary neural network and Swin-Transformer is
tn
∗ Corresponding author.
Email addresses: 849190069@[Link] (Yujin Zhang), chengjixiang0106@[Link]
(Jixiang Cheng), dan.807@[Link] (Zhidan Li)
Pr
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
1. Introduction
iew
With vigorous development of information technology, images have become
an important information carrier. A large amount of image data will cause huge
transmission and storage pressure. To effectively solve this problem, image com-
pression methods are widely used. Image compression methods can be divided
into lossless compression and lossy compression. In lossless compression, the re-
construction result does not change any information of the original image, there-
ev
fore it is often used in scenes that require finely describing image details. On the
contrary, lossy image compression does not store the original image data, but the
lossy image information. On the premise of not losing image reconstruction abil-
ity, the redundant information of the image can be reduced, and the image can be
r
better restored without losing effective information. Although lossy compression
will cause some unimportant information lost and cannot fully restore the original
er
image information, it achieves a higher compression ratio and requires less stor-
age space, and is usually applied to compress natural images. Therefore, lossy
image compression is one of the most important basic supporting technologies in
pe
computer vision.
The traditional lossy image compression methods such as JPEG [1], JPEG2000
[2] and BPG [3] use well-designed basic modules, including transformation, quan-
tization and coding, to realize image compression. The most common method
JPEG is a hybrid method that uses discrete cosine transform [4] to separate high-
frequency information from low-frequency information, allocates bits according
ot
to the importance of the signal to reduce information redundancy, and uses statis-
tical coding to improve compression performance. To eliminate information re-
dundancy, the statistical coding method often uses statistical characteristics of the
tn
results under various evaluation indicators. In recent years, with the rapid de-
velopment of deep learning, deep learning based image compression methods,
especially the lossy compression methods, have gradually surpassed traditional
methods and attracted great attention from both research and engineering fields.
ep
Currently, most deep learning based image compression methods are end-to-
end methods using variational autoencoder (VAE) [5]. As research has progressed,
significant progress has been made in various technical components of the archi-
tecture. Based on VAE, the image is converted into compressible latent features
Pr
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
and then the features are quantized. Through hyperprior module [6], autoregres-
iew
sive module [7], and entropy module [6], the statistical distribution of potential
features are construct and the entropy model is estimated. The potential features
are compressed into bit stream by arithmetic coding [8]. For decoding, arith-
metic coding decompresses and dequantizes the bit stream, and then reconstructs
the image by decoder. As the quantizers are non-differentiable, they can be ap-
proximated via binarization [9], additive uniform noise [10] or random rounding
ev
[11] for directional propagation during the training phase. Although the great
progress has been made, a key issue with VAE based model is that the convolu-
tion only considers the semantic information in the artificially designed receptive
field, rather than the global semantic information. The high-level semantic in-
r
formation is obtained by crudely fusing the low-level feature information, which
ignores the correlation between the part and the whole.
Inspired by the success of the attention mechanism in natural language pro-
er
cessing [12] and computer vision [13, 14], many researchers use attention mecha-
nism to obtain the correlation weight between each feature and all other features to
guide latent feature adaptive processing, that is, allocating more bits to challeng-
pe
ing areas such as edges and textures for better rate-distortion (RD) performance.
However, attention mechanism still does not change the inherent ignorance of
the correlation between local features and global semantic information in con-
volutionary neural network(CNN). The multi-head attention mechanism in trans-
former [15] can enhance the ability of focusing on multiple places and effectively
ot
alleviate the above problem. Recent studies [16–18] show that transformer can
achieve better performance compared than convolutional neural network in vision
tasks. The Vision transformer [17] starts from the low-level features for global
association. The global correlation of the input is modelled by a multi-head at-
tn
tention mechanism, and the intermediate features are continuously linearly trans-
formed by a fully connected layer. Swin-Transformer [19] is a layered transformer
specifically designed for visual tasks with the two main features, the sliding win-
dow and the hierarchical structure. On the one hand, sliding windows compute
rin
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
relations. On this basis, this paper proposes an Swin-Transformer based entropy
iew
model with a high compression ratio for image compression, called SwinTransEn-
troy. First, the model uses a Swin-Transformer based coder to capture the corre-
lation between spatially adjacent elements and global semantic information. Sec-
ond, the model decouples the mean and variance parameters of the entropy model
and uses fusion context autoregressive model to improve parameter estimation ac-
curacy. Finally, an asymmetric decoder combining CNN and Swin-Transformer
ev
is applied to reconstruct the image. Extensive experimental results show that our
method outperforms state-of-the-art (SOTA) image compression methods on fun-
damental metrics. The novelties of this work are as follows:
r
by exploiting its local attention mechanism, global attention mechanism
and hierarchical structure to gradually expand receptive field to obtain more
er
compact latent features. To the best of our knowledges, this is the first work
of applying the Swin-Transformer to image compression task.
2. We decouple the mean and variance of the entropy model, and design the
pe
fusion context autoregressive model to improve the accuracy of the entropy
model. The fusion context autoregressive model expands the autoregressive
model into three mask convolutions with kernel sizes of 3*3, 5*5, and 7*7,
and uses the add method for data fusion to achieve more accurate entropy
estimation.
ot
related work and gives the motivation of the work. Section 3 details the proposed
method. Section 4 presents the experimental results on several public datasets.
Conclusions are made in Section 5.
ep
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
end-to-end methods based on VAE [10]. The schematic diagram of basic lossy
iew
image compression methods based on VAE is shown in Figure 1. The model
mainly includes codec module, hyper prior module, context autoregressive mod-
ule and entropy model. The codec consists of an encoder and a decoder that are
implemented by deep neural networks. The original image is encoded into latent
features which are then quantized and encoded into a bit stream. During encod-
ing and decoding, the adopted probability distribution function and cumulative
ev
distribution function depend on the estimation of the entropy model. The hyper
prior module consists of a hyperencoder and a hyperdecoder. The autoregressive
module is a context model. The hyper prior and autoregressive modules are com-
bined and applied to the entropy model in order to improve the accuracy of the
r
entropy estimation. In this section, we briefly reviewed some related work on
each module.
Input
Image
Encoder
er Hyper
Encoder
pe
Quantization Quantization
Arithmetic Decoder
Arithmetic Decoder
Output Hyper
Decoder
Image Decoder
tn
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
to improve the ability of capturing statistical characteristics of the image. Hu [26]
iew
proposed a deeper analytical transformation method for latent features to perform
more complex synthetic analytical transformations on image features while pre-
serving information. Liu [27] applied a 3D-CNN to capture redundant information
within and between channels. Ayzik [28] introduced side information to assist the
decoder side for fast image decoding. Mentzer [29] used a generative adversarial
network as a distortion metric in the training phase to guide the decoder to gener-
ev
ate more realistic texture [Link] work [30] proposed a gain unit to assign
a small weight to the channels that do not contribute prominently to the recon-
structed image in order to eliminate channel redundancy. Cheng [21] proposed
to use attention mechanism to increase the attention to complex regions for en-
r
coding and decoding modules. Later, Gao [31] proposed an attention guided two
layer image compression that uses compressive sensing to compress information.
Qian [32] proposed a dual-attention fusion mechanism to segment high-frequency
er
and low-frequency information of the input image and perform channel and space
fusion for their potential features.
pe
2.2. Hyperprior Module
The latent features extracted by the encoder have spatial redundant informa-
tion. The fully decomposed entropy model cannot capture such redundant infor-
mation while a hyperprior module can. Balle [6] proposed an entropy estimation
model with hyperprior for the first time, which introduces side information to
ot
introduced a gain unit into the hyperprior module to improve the ability of extract-
ing uneven channel redundancy in latent features, so that the network can allocate
more bits to the channels that affect the quality of reconstruction.
rin
uncertainty in the context autoregressive module. On the other hand, the con-
text autoregressive module can help the hyperprior module to introduce more side
information [6] without compromising encoding rate, because the prediction is
based only on the causal context, i.e., the already decoded latent features. Inspired
Pr
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
by the success of autoregressive priors in probabilistic generative models, Minnen
iew
[7] first introduced the contextual autoregressive model, using the neighbourhood
correlation of predicted pixels to improve the performance of the entropy model.
Guo [33] proposed a 3D autoregressive module, which divides the discrete vari-
ables into two groups according to the channel dimension. To some extent, this
module can exploit the redundancy of two sets of potential features in the chan-
nel dimension to achieve more effective bit rate prediction. Cui [22] proposed
ev
a parallel context autoregressive module to extend mask convolution in order to
fully exploit the correlation between predicted pixels. However, since there is a
causal relationship in the original unidirectional context autoregressive module,
serial operations are required during the decompressing stage, which takes much
r
longer time. He [34] proposed a parallelized checkerboard context model and
modified the decoding order, which accelerates the decoding without affecting
the performance. Also, the work [33] extended the context autoregressive model
er
to a bidirectional parallel context autoregressive model to speed up the decoding
process.
pe
2.4. Entropy Module
Accurate entropy estimation is one of the key factors in achieving good image
compression performance. In end-to-end compression methods, the actual dis-
tribution of latent features is unknown and is estimated by the entropy module.
When the estimation is close to the actual distribution, the cross-entropy between
ot
two distributions is small, and when the two distributions are equal, the cross en-
tropy reaches the minimum and the theoretical minimum average code length is
achieved. Balle [6] proposed an SGM-based entropy model that uses a hyper prior
network to model each potential feature variable into a zero mean Gaussian distri-
tn
bution. Later, Minnen [7] further improved the entropy model by adding a context
autoregressive module and considering mean prediction. Minnen [21] proposed
an entropy model based on a discretised Gaussian mixture model (GMM), which
uses the discrete Gaussian mixture likelihood to estimate the distribution of la-
rin
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
2.5. Motivation
iew
Inspired by the successful application of Transformer in the field of computer
vision, Qian et, al. [32] first proposed a Transformer-based image compression
model called Entroformer, which uses the mutil-head attention in Transformer
to extract global redundant information. However, the Transformer has not been
fully explored in the field of image compression. On the one hand, since multi-
head attention is computed over the entire feature map, the computational com-
ev
plexity is proportional to the square of the image size. On the other hand, the orig-
inal transformer does not have multi-scale prediction capabilities, which limits its
application. For image compression tasks, more compact latent features need to be
obtained by the encoder. Therefore, not only global semantic information, but also
r
local semantic information is required. The sliding window in Swin-Transformer
computes self-attention in locally non-overlapping windows and allows cross-
window connections. Through windows multi-head self-attention (W-MSA) and
er
shifted windows multi-head self-attention (SW-MSA), Swin-Transformer can dy-
namically focus on adjacent elements and enhance the ability of local information
extraction, as well as the global attention ability.
pe
The entropy model based on discrete GMM achieves reasonable performance
in terms of rate-distortions, but during encoding and decoding, the probability dis-
tribution function (PDF) and cumulative distribution function (CDF) are dynam-
ically generated for each pixel, which results in redundancy and is time consum-
ing. In contrast, entropy models based on single gaussian model (SGM) construct
ot
fixed PDF and CDF tables for entropy encoding with lower computational cost.
To accelerate the serial processing steps in autoregressive context models, He [34]
proposes a parallelizable checkerboard context model that changes decoding order
to speed up decoding without affecting performance.
tn
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
3. Proposed SwinTransEntropy model
iew
3.1. Overall model structure
In this section, we present our lossy image compression scheme in detail.
The overall structure follows the general VAE based framework in Figure 1. The
schematic diagram of our method is illustrated in Figure 2.
Encoder
HyperEncoder
LinerEmbedding
PatchPartition
PatchMerging
PatchMerging
PatchMerging
ev
SwinͲTBlock
SwinͲTBlock
SwinͲTBlock
SwinͲTBlock
LeakyRelu
LeakyRelu
y
Conv2d
Conv2d
Conv2d
Conv2d
Conv2d
Conv2d z
FusionContextModel
Q
x x2 x2 x6 x2
Mask Mask Mask
yො Convolution
3*3
Convolution
5*5
Convolution
7*7
add Q
zො
r
AE AE
LeakyRelu
LeakyRelu
LeakyRelu
ConvT2d
ConvT2d
ConvT2d
ConvT2d
bitstream (ʅ漓ʍ) LeakyRelu concat bitstream
LeakyRelu
LeakyRelu
ConvT2d
ConvT2d
ConvT2d
ConvT2d
Decoder
AD
er HyperDecoder
AD
PatchExpanding
PatchExpanding
yො
PatchExpanding
zො
DeͲEmbedding
ResidualBlock
SwinͲTBlock
SwinͲTBlock
SwinͲTBlock
SwinͲTBlock
DeͲPartition
pe
LeakyRelu
LeakyRelu
Conv2d
Conv2d
Conv2d
Conv2d
Conv2d
Conv2d
xො x2 x2 x6 x2 x9
autoregressive module work together to obtain the entropy parameters for entropy
coding. Meanwhile, the side information z is extracted through a hyperencoder,
i.e., z = HyperE ncoder(y) and quantized into ẑ, which is entropy encoded and
compressed into a bitstream. Then ẑ is used to accurately estimate the entropy of
rin
ŷ is recoved from bitstream and entropy parameters. Finally, the image x̂ is recon-
structed via decoder, i.e., x̂ = Decoder(ŷ).
Pr
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
3.2. Swin-Transformer based encoder
iew
Transformer was originally proposed in NLP fields and then extended to Vision-
Transformer for computer vision tasks. Vision-Transformer uses multi-head atten-
tion to improve the ability of focusing on multiple locations, and to model global
semantic information. Compared to Vision Transformer, Swin-Transformer is
more efficient and has a higher accuracy. Swin-Transformer uses a hierarchi-
cal construction method similar to convolutional neural networks. Through patch
ev
merging, extracted feature is down-sampled to increase the receptive field of the
next window attention on the original image, thus achieving a multi-scale feature
extraction capability.
The core module of Swin-Transformer is the Swin-Transformer block shown
r
in Figure 3. Windows multi-head self-attention (W-MSA) is to divide the fea-
ture map into multiple disjoint areas and Multi-Head Self-Attention is performed
er
in each window. As W-MSA limits the attention only to each window, Shifted
Windows Multi-Head Self-Attention (SW-MSA) is further applied that introduces
cross-connection between windows, making Swin-Transformer to obtain near-
global attention capability. For more information, see [19].
pe
MLP MLP
ot
LN LN
tn
W-MSA SW-MSA
LN LN
rin
10
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
with height H and width W , the shape of an image is changed from [H,W, 3] to
[H/K,W /K, K × K × 3]. Then, a linear transform is performed through the lin-
iew
ear embedding layer and the shape of the image is changed from [H/K,W /K,C].
Such a feature extraction process is repeated over different image sizes with four
stages. Stage1 is composed of a linear embedding layer and repeated stacked
Swin-Transformer block, and the remaining three stages are composed of patch
merging and repeated stacked Swin-Transformer block. Finally, the dimension of
ev
feature information is reduced by a convolution layer. To avoid too much spatial
redundant information in the patches, we set the patch size K to 2.
r
LinerEmbedding
PatchPartition
PatchMerging
PatchMerging
PatchMerging
SwinͲTBlock
SwinͲTBlock
SwinͲTBlock
SwinͲTBlock
InputImage
Conv2d
x2 x2
er x6 x2
pe
Figure 4: Structure diagram of encoder.
the tensors producted by 3*3, 5*5 and 7*7 mask convolution. We hope that the
additional context provided by 3*3 and 7*7 mask convolution can improve the
prediction accuracy. In addition, the entropy parameters, i.e., mean value µ and
variance σ , are decoupled in order to make the entropy estimation of potential
information more accurate and efficient.
rin
layer. Then, the feature is up-sampled by stacking 9 residual blocks and 4 Swim-
Transformer blocks. By combining traditional CNN and Swin-Transformer, the
layer of the decoder module is increased so that the decoder has enough capacity
to learn the reconstruction ability.
Pr
11
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
Pr
ep
Conv2d Conv2d
ChannelNorm
x9
ResidualBlock
(ʅ,ʍ)
rin
Relu
x2
SwinͲTBlock
Conv2d
ConvT2d ConvT2d
PatchExpanding
ChannelNorm LeakyRelu LeakyRelu
tn
ConvT2d ConvT2d
+
LeakyRelu LeakyRelu
x6
SwinͲTBlock
ConvT2d ConvT2d
ot
PatchExpanding LeakyRelu LeakyRelu
12
ConvT2d ConvT2d
3*3
MaskConvolution
x2
SwinͲTBlock
pe
5*5
PatchExpanding
add
concat
MaskConvolution
er
x2
r
MaskConvolution
DeͲEmbedding
Figure 5: Sturctural diagram of fusion context autoregressive model.
ev
DeͲPartition
Reconstruction
iew
ed
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
3.5. Loss Function
iew
For model training, the loss function used is
L = λ d (x, x̂) + R(y) (2)
where, d (x, x0 ) is an image distortion measure, and Mean-Squared Loss (MSE) is
usually applied, R(y) is the bit rate of latent information y, expressed as
ev
R(y) = − log2p(ŷ|ẑ) (ŷ | ẑ) + log2 pẑ (ẑ) (3)
and λ is a parameter weighting image distortion and bit rate. Different λ will
results in different compression ratios.
r
4. Experimental results
4.1. Experimental setup
4.1.1. Datasets
er
The image compression task is an unsupervised task that does not require ad-
ditional label files. To validate the performance of our proposed methods, we
pe
conduct a series of experiments. We randomly sample 300K images from the
Open Images dataset, and randomly crop them to a size of 256×256 as training
set. Two public datasets, i.e., Kodak image set [36] and Tecnick SAMPLING im-
age set [37], are used for evaluation. It is generally believed that the performance
results on these qualified image test sets are representative and can be generalized
ot
to other untested natural images. The Kodak image set contains 24 lossless im-
ages with a resolution of 768 × 512. The Tecnick image set consists of 40 lossless
images with a resolution of 1200× 1200. In addition, to investigate the effective-
tn
ness of our proposal, ablation experiments are performed on two more datasets,
i.e, CLIC2020 validation set [38] and DIV2K validation set [39]. The CLIC2020
image set and The DIV2K image set use the validation set images, which consist
of 41 and 100 images, respectively.
rin
13
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
4.1.3. Trainging setting
iew
The parameter λ controls the bit rate, and we use a set of values {0.0018, 0.0035,
0.0067, 0.013, 0.025, 0.0485} to train our model, where each value corresponding
to a rate-distortion point. All models are trained for 1.2M steps using the Adam
optimizer [42] with a batch size of 16, The learning rate is set to 1 × 10−4 for 70K
iterations, and drops to 1 × 10−5 for the rest 50K iterations. We train our model
on a server with Intel Xeon Platinum 6164 CPU, NVIDIA 3090Ti GPU and 64GB
ev
RAM.
r
reflects the compression ratio of the image. For images with the same aspect ratio,
the smaller the BPP, the higher the compression ratio. Peak signal-to-noise ratio
(PSNR) and multiscale structural similarity index measure (MS-SSIM) are used
er
to evaluate image quality. PSNR is based on an element-wise difference compari-
son, which reflects pixel-level distortion. MS-SSIM measures image similarity in
terms of brightness, contrast, and structure, and is the most widely used percep-
pe
tual metric for evaluating (and training) deep learning-based image compression
models. The unit of PSNR and MS-SSIM is dB, and a higher value indicates bet-
ter performance. LPIPS [43], measures the distance in the feature space of a deep
neural network originally trained for image classification, is adapted for predict-
ing the similarity of distorted patches, which is validated to predict human scores
ot
The RD curves using PSNR and MS-SSIM as distortion metrics are given in
Figure 7. It is noting that some methods are not considered in the comparison be-
cause the model parameters on a particular data set are not available. Figure 7(a)
gives the RD curves of each competing method on the Kodak Image Set under
rin
PSNR quality assessment. The average performance on the dataset shows that our
method (MSE-optimized) outperforms all the competing deep image compres-
sion methods optimized with the same metric. Figure 7(b) gives the RD curves of
each comparison method on Kodak under the MS-SSIM quality assessment. The
ep
14
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
image set with PSNR and MS-SSIM metrics, and in general the results are simi-
iew
lar to the Kodak Image Collection. Therefore, we can conclude that our method
achieves the best performance among all the methods.
36 20
34 18
ev
32 16
MS-SSIM
PSNR
Proposed[MSE]
30 JPEG2000 14
BPG Proposed[MSE]
Balle[MSE](ICLR2018) JPEG2000
Minnen[MSE](NIPS2018) BPG
28 12
Hu[MSE](AAAI2020) Balle[MSE](ICLR2018)
r
Lee[MSE](ICLR2019) Minnen[MSE](NIPS2018)
Cheng[MSE](CVPR2020) Hu[MSE](AAAI2020)
26 Cui[MSE](CVPR2021) 10 Lee[MSE](ICLR2019)
Qian[MSE](ICLR2022) Cheng[MSE](CVPR2020)
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8
40
39
Proposed[MSE]
JPEG2000
BPG
Bits Per Pixel
(a) er 22
21
Proposed[MSE]
JPEG2000
BPG
Bits Per Pixel
(b)
pe
Minnen[MSE](NIPS2018) Minnen[MSE](NIPS2018)
Hu[MSE](AAAI2020) Hu[MSE](AAAI2020)
Lee[MSE](ICLR2019) Lee[MSE](ICLR2019)
38 Cheng[MSE](CVPR2020) 20 Cheng[MSE](CVPR2020)
VVC-intra(VTM11.0) VVC-intra(VTM11.0)
37 19
MS-SSIM
PSNR
36 18
35 17
34 16
ot
33 15
32 14
0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.05 0.10 0.15 0.20 0.25 0.30 0.35
tn
(c) (d)
Figure 7: RD Performance evaluations on the Kodak and Tecnick dataset. (a) Kodak Image Set,
evaluated with MSE. (b) Kodak Image Set, evaluated with MS-SSIM. (c) Tecnick Image Set,
rin
evaluated with MSE. (d) Tecnick Image Set, evaluated with MS-SSIM.
ity assessment method LPIPS is used. Lower LPIPS values indicate better visual
quality. In this experiments, we compare the visual quality of images recon-
structed by our method with Cheng, VVC intra profile, BPG and JPEG2000 at
Pr
15
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
different rates. For a fair comparison with traditional image codecs, all evaluated
iew
codecs are optimized under MSE distortion. As shown in Figure 8(a), on the Ko-
dak image set, our proposed method achieves better perceptual quality than cheng,
JPEG2000, BPG, and VVC intra profiles. Figure 8(b) shows the LPIPS results on
the Tecnick Image Set. Our proposed method still achieves better visual quality
than Cheng, JPEG2000, and BPG, and comparable visual quality to VVC internal
profiles.
ev
0.45
Proposed[MSE] Proposed[MSE]
Cheng[MSE](CVPR2020) Cheng[MSE](CVPR2020)
0.40 VVC-intra(VTM11.0) 0.25 VVC-intra(VTM11.0)
BPG BPG
JPEG2000 JPEG2000
0.35
0.20
r
0.30
LPIPS
0.25 LPIPS
0.15
0.20
0.15
0.10
er 0.10
pe
0.05 0.05
0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.05 0.10 0.15 0.20 0.25 0.30 0.35
Bits Per Pixel Bits Per Pixel
(a) (b)
Figure 8: LPIPS Evaluation for MSE-optimized methods. (a) Kodak Image Set. (b) Tecnick Image
Set.
ot
tion results. For fair comparison with conventional image codecs, all evaluated
codecs are optimized under MSE distortion. Since deep learning based image
compression methods cannot strictly limit the BPP of images, we can only com-
pare different compression methods when the BPP values are similar. Fig.9 gives
rin
the reconstructed images kodim19 from Kodak dataset generated by our method,
classical image compression codecs BPG and JPEG2000, and learning-based im-
age compression methods Cheng and Minnen. For the compared methods, we can
obsereve blurring artifacts. In contrast, our method can well recover image details
ep
16
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
iew
r ev
(a) Ground truth. (b) Proposed, bpp=0.119. (c) Cheng, BPP=0.129.
er
pe
ot
Figure 9: Image comparison of different compression methods with similar compression ratios
tn
another model with K setting to 4 and embeding dimention setting to 96, with
network structure remaining unchanged. The network is trained under the same
training strategy and tested on Kodak dataset. We choose the models trained
with hyperparameter λ set to (0.0018, 0.0035, 0.0067). We plot the rate-distortion
ep
curves in Figure 10. According to the curves, patch size K settting to 2 is perfer-
able in terms of PSNR and MS-SSIM. The reason is a larger path size will bring
too much spatial redundant information for each window.
Pr
17
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
15.0
iew
31.0
14.5
30.5
14.0
30.0
13.5
MS-SSIM
29.5
13.0
PSNR
29.0
12.5
28.5 12.0
ev
28.0 11.5
K=2[MSE] K=2[MSE]
27.5 K=4[MSE] 11.0 K=4[MSE]
0.08 0.10 0.12 0.14 0.16 0.18 0.20 0.22 0.24 0.26 0.08 0.10 0.12 0.14 0.16 0.18 0.20 0.22 0.24 0.26
Bits Per Pixel Bits Per Pixel
r
(a) (b)
Figure 10: The influence of patch size K in the proposed method.
results show that decoupling trick is benificial to further improve PSNR and MS-
SSIM while not sacrificing compression rate.
4.3.3. Effectivenss of fusion contextual autoregressive
tn
In [7], the author proved experimentally that 5*5 mask convolution is better
than 3*3 and 7*7 convolution. In our method we propose a fusion contextual
autoregressive model to improve model prediction accuracy, which fuses the ten-
sors output by 3*3, 5*5 and 7*7 mask convolution. To verify the effectiveness,
rin
we compare the performance with the version using single mask convolution, i.e.,
autoregressive model with 5*5 mask convolution. We use the model trained with
hyperparameter λ set to 0.0035. The two cases are quantitatively compared using
PSNR and MS-SSIM on Kodak, Tecnick, CLIC2020 and DIV2K datasets, and the
ep
results are listed in Table 2. The results show that our method can further improve
PSNR and MS-SSIM values to some extent, verifying our strategy is valid.
Pr
18
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
iew
Table 1: Effectivenss of entropy parameters decoupling strategy.
With entropy Without entropy
Datasets Metric
parameters decoupling parameters decoupling
bpp 0.154 0.158
Kodak PSNR↑ 29.430 29.365
ev
MS-SSIM↑ 12.850 12.817
bpp 0.081 0.083
Tecnick PSNR↑ 33.809 33.732
MS-SSIM↑ 15.215 15.169
r
bpp 0.109 0.111
CLIC2020 PSNR↑ 31.390 31.323
MS-SSIM↑ 14.080 14.038
DIV2K
bpp
PSNR↑
MS-SSIM↑
er
0.150
30.260
14.330
0.154
30.189
14.289
pe
19
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
4.3.4. Effectivenss of asymmetric decoder
iew
In our method, we combine the traditional CNN and Swin-Transformer to con-
truct an asymmetric decoder so that the decoder has enough capacity to learn the
reconstruction ability. To verify the effectiveness, we compare the performance
with the version using symmetric decoder. We also use the model trained with
hyperparameter λ set to 0.0035. The two cases are quantitatively compared using
PSNR and MS-SSIM on Kodak, Tecnick, CLIC2020 and DIV2K datasets, and
ev
the results are listed in Table3. According to the results, the use of asymmetric
decoder can also improve PSNR and MS-SSIM values, verifying its effectiveness.
r
Datasets Metric Asymmetric decoder Symmetric decoder
bpp 0.154 0.161
Kodak
Tecnick
PSNR↑
MS-SSIM↑
bpp
PSNR↑
er
29.430
12.850
0.081
33.809
29.330
12.840
0.084
33.554
pe
MS-SSIM↑ 15.215 15.148
bpp 0.109 0.112
CLIC2020 PSNR↑ 31.390 31.271
MS-SSIM↑ 14.080 14.056
bpp 0.150 0.155
ot
5. Conclusion
In this paper, we propose a Swin-Transformer based entropy model for image
compression. The model utilizes a Swin-Transformer based encoder that can bet-
rin
ter capture correlations and global semantic information between spatially adja-
cent elements, decouples the mean and variance parameters entropy model and use
a fusion context autoregressive to obtain accurate entropy estimation and efficient
entropy coding, and uses an asymmetric decoder with more layers to increase the
ep
20
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
Next, we will further explore more efficient and lightweight feature extraction
iew
module for image compression tasks.
Acknowledgements
This work was supported by the National Natural Science Foundation for
Young Scientists of China (61603319, 61601385).
ev
References
[1] Gregory K Wallace. The jpeg still picture compression standard. Communi-
cations of the ACM, 34(4):30–44, 1991.
r
[2] David S Taubman, Michael W Marcellin, and Majid Rabbani. Jpeg2000:
Image compression fundamentals, standards and practice. Journal of Elec-
tronic Imaging, 11(2):286–287, 2002.
er
[3] Bellard Fabrice. BPG image format. [Link] 2014.
pe
[4] Nasir Ahmed, T Natarajan, and Kamisetty R Rao. Discrete cosine trans-
form. IEEE transactions on Computers, 100(1):90–93, 1974.
[5] Diederik P Kingma and Max Welling. Auto-encoding variational bayes.
arXiv preprint arXiv:1312.6114, 2013.
ot
[6] Johannes Ballé, David Minnen, Saurabh Singh, Sung Jin Hwang, and Nick
Johnston. Variational image compression with a scale hyperprior. arXiv
preprint arXiv:1802.01436, 2018.
tn
[7] David Minnen, Johannes Ballé, and George D Toderici. Joint autoregressive
and hierarchical priors for learned image compression. Advances in neural
information processing systems, 31, 2018.
rin
[8] Detlev Marpe, Heiko Schwarz, and Thomas Wiegand. Context-based adap-
tive binary arithmetic coding in the h. 264/avc video compression standard.
IEEE Transactions on circuits and systems for video technology, 13(7):620–
636, 2003.
ep
[9] George Toderici, Sean M O’Malley, Sung Jin Hwang, Damien Vincent,
David Minnen, Shumeet Baluja, Michele Covell, and Rahul Sukthankar.
Variable rate image compression with recurrent neural networks. arXiv
preprint arXiv:1511.06085, 2015.
Pr
21
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
[10] Johannes Ballé, Valero Laparra, and Eero P Simoncelli. End-to-end opti-
iew
mized image compression. arXiv preprint arXiv:1611.01704, 2016.
[11] Lucas Theis, Wenzhe Shi, Andrew Cunningham, and Ferenc Huszár.
Lossy image compression with compressive autoencoders. arXiv preprint
arXiv:1703.00395, 2017.
[12] Volodymyr Mnih, Nicolas Heess, Alex Graves, et al. Recurrent models of
ev
visual attention. Advances in neural information processing systems, 27,
2014.
[13] Jie Hu, Li Shen, and Gang Sun. Squeeze-and-excitation networks. In Pro-
r
ceedings of the IEEE conference on computer vision and pattern recognition,
pages 7132–7141, 2018.
er
[14] Zilong Zhong, Zhong Qiu Lin, Rene Bidart, Xiaodan Hu, Ibrahim Ben Daya,
Zhifeng Li, Wei-Shi Zheng, Jonathan Li, and Alexander Wong. Squeeze-
and-attention networks for semantic segmentation. In Proceedings of the
IEEE/CVF conference on computer vision and pattern recognition, pages
pe
13065–13074, 2020.
[15] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones,
Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you
need. Advances in neural information processing systems, 30, 2017.
ot
Glasgow, UK, August 23–28, 2020, Proceedings, Part I 16, pages 213–229.
Springer, 2020.
[17] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn,
rin
[18] Robin Strudel, Ricardo Garcia, Ivan Laptev, and Cordelia Schmid. Seg-
menter: Transformer for semantic segmentation. In Proceedings of the
IEEE/CVF international conference on computer vision, pages 7262–7272,
2021.
Pr
22
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
[19] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen
iew
Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer
using shifted windows. In Proceedings of the IEEE/CVF international con-
ference on computer vision, pages 10012–10022, 2021.
[20] Johannes Ballé, Valero Laparra, and Eero P Simoncelli. End-to-end opti-
mization of nonlinear transform codes for perceptual quality. In 2016 Picture
Coding Symposium (PCS), pages 1–5. IEEE, 2016.
ev
[21] Zhengxue Cheng, Heming Sun, Masaru Takeuchi, and Jiro Katto. Learned
image compression with discretized gaussian mixture likelihoods and atten-
tion modules. In Proceedings of the IEEE/CVF Conference on Computer
r
Vision and Pattern Recognition, pages 7939–7948, 2020.
[22] Ze Cui, Jing Wang, Shangyin Gao, Tiansheng Guo, Yihui Feng, and Bo Bai.
er
Asymmetric gained deep image compression with continuous rate adapta-
tion. In Proceedings of the IEEE/CVF Conference on Computer Vision and
Pattern Recognition, pages 10532–10541, 2021.
pe
[23] Jooyoung Lee, Seunghyun Cho, and Munchurl Kim. An end-to-end joint
learning scheme of image compression and quality enhancement with im-
proved entropy minimization. arXiv preprint arXiv:1912.12817, 2019.
[25] Johannes Ballé, Valero Laparra, and Eero P Simoncelli. Density modeling
tn
[26] Yueyu Hu, Wenhan Yang, and Jiaying Liu. Coarse-to-fine hyper-prior mod-
rin
[27] Haojie Liu, Tong Chen, Peiyao Guo, Qiu Shen, Xun Cao, Yao Wang, and
Zhan Ma. Non-local attention optimized deep image compression. arXiv
ep
[28] Sharon Ayzik and Shai Avidan. Deep image compression using decoder side
information. In Computer Vision–ECCV 2020: 16th European Conference,
Pr
23
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
Glasgow, UK, August 23–28, 2020, Proceedings, Part XVII 16, pages 699–
iew
714. Springer, 2020.
[29] Fabian Mentzer, George D Toderici, Michael Tschannen, and Eirikur
Agustsson. High-fidelity generative image compression. Advances in Neural
Information Processing Systems, 33:11913–11924, 2020.
[30] Shangyin Gao, Yibo Shi, Tiansheng Guo, Zhongying Qiu, Yunying Ge,
ev
Ze Cui, Yihui Feng, Jing Wang, and Bo Bai. Perceptual learned image com-
pression with continuous rate adaptation. 2023.
[31] Ge Gao, Pei You, Rong Pan, Shunyuan Han, Yuanyuan Zhang, Yuchao Dai,
and Hojae Lee. Neural image compression via attentional multi-scale back
r
projection and frequency decomposition. In Proceedings of the IEEE/CVF
International Conference on Computer Vision, pages 14677–14686, 2021.
er
[32] Yichen Qian, Ming Lin, Xiuyu Sun, Zhiyu Tan, and Rong Jin. Entroformer:
A transformer-based entropy model for learned image compression. arXiv
preprint arXiv:2202.05492, 2022.
pe
[33] Zongyu Guo, Yaojun Wu, Runsen Feng, Zhizheng Zhang, and Zhibo Chen.
3-D context entropy model for improved practical image compression. In
Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern
Recognition Workshops, pages 116–117, 2020.
ot
[34] Dailan He, Yaoyan Zheng, Baocheng Sun, Yan Wang, and Hongwei Qin.
Checkerboard context model for efficient learned image compression. In
Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern
tn
24
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]
ed
[38] Radu Timofte et. al. George Toderici, Wenzhe Shi. Workshop and challenge
iew
on learned image compression (clic2020), 2020.
[39] Eirikur Agustsson and Radu Timofte. Ntire 2017 challenge on single im-
age super-resolution: Dataset and study. In Proceedings of the IEEE confer-
ence on computer vision and pattern recognition workshops, pages 126–135,
2017.
ev
[40] Benjamin Bross, Jianle Chen, Jens-Rainer Ohm, Gary J. Sullivan, and Ye-
Kui Wang. Developments in international video coding standardization after
avc, with an overview of versatile video coding (vvc). Proceedings of the
IEEE, 109(9):1463–1493, 2021.
r
[41] Jooyoung Lee, Seunghyun Cho, and Seung-Kwon Beack. Context-adaptive
entropy model for end-to-end optimized image compression. arXiv preprint
arXiv:1809.10452, 2018.
er
[42] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic opti-
pe
mization. arXiv preprint arXiv:1412.6980, 2014.
[43] Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver
Wang. The unreasonable effectiveness of deep features as a perceptual met-
ric. In Proceedings of the IEEE conference on computer vision and pattern
recognition, pages 586–595, 2018.
ot
tn
rin
ep
Pr
25
This preprint research paper has not been peer reviewed. Electronic copy available at: [Link]