S-Net: A Scalable Convolutional Neural Network for JPEG Compression Artifact Reduction

Recent studies have used deep residual convolutional neural networks (CNNs) for JPEG compression artifact reduction. This study proposes a scalable CNN called S-Net. Our approach effectively adjusts the network scale dynamically in a multitask system for real-time operation with little performance loss. It offers a simple and direct technique to evaluate the performance gains obtained with increasing network depth, and it is helpful for removing redundant network layers to maximize the network efficiency. We implement our architecture using the Keras framework with the TensorFlow backend on an NVIDIA K80 GPU server. We train our models on the DIV2K dataset and evaluate their performance on public benchmark datasets. To validate the generality and universality of the proposed method, we created and utilized a new dataset, called WIN143, for over-processed images evaluation. Experimental results indicate that our proposed approach outperforms other CNN-based methods and achieves state-of-the-art performance.


Introduction
Image restoration for reducing lossy compression artifacts has been well-studied, especially for the JPEG compression standard 1 . JPEG is a popular lossy image compression standard because it can achieve high compression ratio with only minimal reduction in visual quality. The JPEG compression standard divides an input image into 88  blocks and performs discrete cosine transform (DCT) on each block separately. The 64 DCT coefficients thus obtained are quantized based on standard quantization tables that are adjusted with different quality factors. Losses such as blackness, ringing artifacts, and blurring artifacts are mainly introduced by quantizing the DCT coefficients.
Recently, deep-neural-network-based approaches 2,3 have been used to significantly improved the JPEG compression artifact reduction performance in terms of peak signal-to-noise ratio (PSNR). However, these methods have several limitations. First, most existing methods 2,4,5 focus on the construction performance of grayscale images and try to restore each channel separately when applied to color images. However, this will introduce palpable chromatic aberrations in the reconstructed image. Second, many methods 3, 4 based on the ResNet 6 architecture try to optimize the performance by increasing the number of residual blocks in networks. Although this is an effective optimization method, determining the exact depth for maximizing the network performance without traversing all depths remains challenging. Third, as found for super-resolution convolutional neural network (SRCNN) 7 , CNN-based image restoration algorithms can be used for encoding, transforming, and decoding. Most existing CNN-based algorithms use only one decoder at the end of the network; alternatively, they use a stack of layers at the tail of the network as a decoder. This is called a columnar architecture.
However, we believe that a columnar architecture contains too many layers between the input layer and the loss layer. Increased network depth could make it much harder for training layers around the bottom, although residual connections 8 or some excellent optimizers 9 could mitigate this problem. Therefore, if we use only some layers of the transforming part, the results could degrade considerably. To solve these problems, first, we use color image pairs to train the network to restore color images directly. Second, we present a symmetric encoder-decoder model to finish the encoding and decoding tasks independently. Third, based on the greedy theory, we propose a scalable CNN called S-Net to maximize the performance of each convolutional layer in the network. We also prove that it is helpful to evaluate the influence of depth on the network performance.
We trained our models on the newly provided DIV2K 10 dataset and evaluated them on public benchmark datasets (LIVE1 11 and BSDS500 12 ). The proposed architecture achieved stateof-the-art performance on all datasets in terms of PSNR and structural similarity index (SSIM).

Related Work
Deep convolutional networks (DCNs) are trained for image restoration tasks by converting an input image into a feature space and building nonlinear mappings between the features of the input and the target images. To exploit error back-propagation, groups of convolutional filters that construct DCNs are learned during the training procedure so that they can be used for convoluting an input image for a specific image restoration task. SRCNN is the first DCN-based image restoration method that has been proposed for image super-resolution (SR). It uses bicubic interpolation to up-sample the low-resolution image and train a three-layer CNN to restore the up-sampled image. Based on SRCNN, ARCNN 2, 13 , a four-layer CNN, was proposed to reduce JPEG compression artifacts. However, because ARCNN does not use a pooling layer and a fully connected layer, the result deteriorated with increasing network depth, and it was difficult to guarantee convergence unless the weights of the convolutional layers were initialized carefully.
Furthermore, because DCNs show promise for high-level computer vision tasks 14,15 , many DCN-based algorithms for image restoration tasks tried to improve the network construction based on high-level computer vision algorithms. Ledig et al. 16 used a generative adversarial network (GAN) 17 to reconstruct high-resolution images by the bicubic interpolation of downsampled low-resolution images. Li et al. 18 used GAN to solve the image dehazing problem.
Other studies applied inception modules 15,19 to image SR. Shi et al. 20 24 and a rectified linear unit (ReLU) 25 layer to the output of each convolutional layer and deconvolutional layer 26,27 to learn the intrinsic representations and successfully solved the image restoration and image classification problems using the same pretrained networks. However, these two approaches based on a convolutional autoencoder did not provide an explicit presentation of the relationship between the whole network and each encoderdecoder pair in it. By contrast, symmetrically connected convolutional layer pairs were more likely to be deformed residual structures rather than encoder-decoder pairs. Lim et al. 8 proposed a very deep network with 32 residual blocks for single-scale SR (EDSR) and an even deeper network with 80 residual blocks for multiscale SR (MDSR).
In general, DCN-based methods for image restoration tasks like compression artifact reduction (AR) and SR focus on improving performance by increasing the number of parameters in the network. However, larger-scale networks always incur higher computational costs and longer training procedures that may sometimes be unaffordable. Higher costs are also incurred to evaluate whether the best performance is achieved by the network. This study focuses on maximizing the network performance by using fewer parameters and minimizing the training procedure time.

Proposed Method
This section describes the proposed network architecture and implementation. First, we propose a convolutional encoder-decoder architecture to extract features from an input image and recover the input image from the feature domain. Then, we introduce the characterization of the greedy loss architecture for building a scalable CNN. Finally, we discuss the implementation of our proposed architecture.  activation layer. Let X be the input; the encoder and decoder blocks are expressed as:

Symmetric Convolutional Encoder-Decoder Model
where i W and i B respectively represent the parameters of the i th convolutional filters and bias, and  is the convolution operation.
The two blocks have the same number of layers and a symmetric convolutional kernel size. Moreover, unlike in the case of the encoder block, we tried to formulate a decoder block with transposed convolutional layers 30 instead of convolutional layers. However, although the relationship between convolution and transposed convolution seems like a key-lock relationship, this change does not result in any improvement in the datasets in our benchmark.

Greedy Loss Architecture
Although increasing the network depth is a simple way to improve performance, a deeper network does not always result in better performance. It is difficult to ensure the appropriate depth that maximizes the network performance without testing various depths. To solve this problem, we propose a greedy loss architecture to maximize the performance of each convolutional unit in the network. We use the encoder-decoder architecture to translate inputs from the image domain to the feature domain and to ensure that each output of a convolutional unit is limited to a fixed feature domain. We connect the decoder and loss layer after the output of each convolutional unit and hope that each unit can map the JEPG compressed features to the original features. Convolutional units at different depths clearly receive different gradients from backpropagation; specifically, shallower ones receive more gradients than deeper ones, and this could be helpful for optimizing the performance of shallower layers. On the other hand, the greedy loss architecture constrains the output of each convolutional unit; this is conductive for avoiding gradient explosion 19 when training large-scale convolutional networks. Furthermore, it is feasible to determine the network performance with different depths without training the whole network repeatedly by analyzing the loss from each convolutional unit with fixed depth. Section 4 discusses the experimental evaluation of the network performance.  Figure 3 shows an overview of our network architecture.
Unlike other deep neural networks in which all parts have to operate in combination in order for the network to function, these three parts construct a scalable convolutional neural network in which the operation of even one part enables the network to function normally. For example, if part of the nonlinear feature mapper is removed, the network can give a comparatively good result. Moreover, even if the nonlinear feature mapper is completely removed, the symmetrically encoder-decoder pairs can still give quite improved outputs.

Architecture
The encoder and decoder are both formulated using two convolutional layers with a ReLU activation layer. Table 1 lists the construction of the encoder and decoder. Because the second convolutional layer of the decoder is connected to the loss layer, its number of channels depends on the channel size of the input/output images. A nonlinear feature mapper is formulated by a series of shortcut connections. Because these shortcut connections in low-level image processing using DCNs are always constructed using only convolutional layers, we call these fullconvolutional shortcut connections as convolutional units. We denote these convolutional units There are active discussions about the problem of deeper networks or wider networks 31,32 .
The creators of ResNet preferred deeper networks and tried to make the network as thin as possible in order for it to have only a few parameters. Some recently proposed DCN-based methods for image restoration adopted this strategy to construct their networks. However, the wide ResNet (WRN) 33

Convolutional Unit
Residual connections have been widely and successfully used in many image restoration algorithms 16,34,35 . A convolutional unit constructed with residual connection is the basic component of a network, and it plays an important role in the network performance. Here, we compare two widely used convolutional units: classic residual structure, the simplest residual connection structure in which the residual branch is constructed using a convolutional layer and a ReLU activation layer, and advanced residual structure, first proposed by Peng et al. 36 for boundary refining in image segmentation and which shows great performance for image restoration tasks 8,35 . Although the batch-normalization layer is a basic component in the residual connection structure, it has been found that removing them from the network can improve the network performance for image SR tasks 8 . We found that this modification is also effective for AR tasks and therefore applied this modification to our network. Figure 4 shows the configuration of both structures. The residual branch of the advanced residual structure contains two convolutional layers and a ReLU activation layer. Table 2 lists the parameters of our networks constructed using these two different convolutional units.
Several researchers replaced the ReLU layer in networks with a parametric rectified linear unit (PReLU) 2, 5, 37 layer. PReLU imports a learnable parameter  to restrict the negative output, whereas ReLU compulsively cuts the negative output to zero.
We tried using PReLU layers to replace ReLU layers in our network. However, doing so did not result in any improvement; instead, it increased the computational and memory costs. Therefore, we use only ReLU as the activation function in our following experiments.

Training
PSNR is the most universal evaluation indicator for image restoration tasks. It can be represented as follows: where Y is the target image; X , the restored image; and MSE, the mean square error. To We used the adaptive moment estimation (Adam) 9 method as the optimizer during the training procedure. Adam is a recently proposed optimization algorithm that has been proved to be effective for training very deep networks. We used the default parameters (beta_1 = 0.9, beta_2 = 0.999, epsilon = ) 9 as specified in the original paper. Experimental Evaluation

Dataset
The DIV2K 10 dataset has been recently proposed in the NTIRE2017 challenge for single-image SR 10 . The dataset consists of 1000 2K-resolution images, of which 800 are training images, 100 are validation images, and the remaining 100 are testing images. Because the testing dataset was prepared for image SR and the ground truth has not been not released, we could not compare performances using this dataset. Instead, we evaluated the performance of our proposed method and compared it with other state-of-the-art methods on other known datasets.

Training
For training, we extracted 48×48 RGB image patches from training images in the DIV2K dataset with random steps from 37 to 62 as the input. Although the JPEG compression algorithm is applied to each 8×8 patch, taking a random step to avoid integral multiples of eight can significantly enhance the network performance, as in the case of DDCN 4 . The initial learning rate was set to 10 -4 at the start of the training procedure, and subsequently halved after every set of 10 4 batch updates until it was below10 -6 . All network models for different convolutional units were trained with 2×10 5 batch updates. Considering the limitation of computational resources, the batch size was set to 16. We first trained models with JPEG quality of 40 (QF40) to evaluate the performance of different convolutional units. Then, we fine-tuned the pre-trained QF40 models for JPEG qualities of 10 (QF10) and 20 (QF20) with initial learning rate of 1×10 -5 and 4×10 4 batch updates. During fine-tuning, the learning rate was also halved after every set of 10 4 batch updates until it reached 10 -6 or below. We performed the experiments using the Keras framework with a TensorFlow backend on an NVIDIA K80 GPU server. Training of the QF40 model took five days and two days was required to fine-tune the QF20 and QF10 models.

Greedy Loss Architecture Performance Evaluation
We measured the PSNR and SSIM with only the y-channel considered, and used standard MATLAB library functions for the evaluations. We trained the network models with the convolutional unit of the advanced residual structure using the columnar architecture and greedy loss architecture for the JPEG quality of 40. For fairness, these two models were trained with the same image patches and same learning rate during the whole training procedure. Figure 5 shows the results in terms of PSNR and SSIM for the LIVE1 dataset. We compared the performances of the two network models after 2×10 5 batch updates on the LIVE1 dataset. Although the greedy approach may lead to a local optimum, the model trained using the greedy loss architecture showed better performance in terms of both PSNR and SSIM compared with the model trained using the columnar architecture. Furthermore, the proposed model showed better performance for intermediate outputs than the columnar architecture. Figure 6 shows the reconstructed images.
The greedy loss architecture significantly improved the consistency of color accuracy and texture sharpness in different metrics. With some convolutional units removed from the network, the result obtained using the greedy loss architecture was obviously more stable than that obtained using the columnar architecture. We also compared S-Net with columnar architecture CNNs with 1-8 convolutional units.

Comparisons to State-of-the-Art
We compared our models with the state-of-the-art models ARCNN 2 , DDCN 4 Table 3, our model constructed with convolutional units of the advanced residual structure showed significant improvements compared to the other methods for all public benchmark datasets. Figure 9 shows some qualitative results for the BSDS500 dataset. We also compared the computational efficiency of the proposed method with those of other state-of-the-art methods. All algorithms were implemented on a K80 GPU server with a single GPU core. We measured the computational efficiency in terms of million color pixels per second (MCP/s). However, because there is a significant difference between the qualities of the images reconstructed by ARCNN and other state-of-the-art methods, ARCNN is not included in this comparison although it is quite fast. Figure 10 shows the computational efficiencies. S-Net with one and two convolutional units shows improved image quality and computational efficiency.

Extensional Performance Evaluation on the WIN143 Dataset
However, we noticed that the images in both LIVE1 and BSDS500 are typically everyday scenes.
Further, few shooting skills or post processing technologies were utilized when getting these images. We call images acquired like this normal images. However, because we believe that these limitations may not thoroughly show the generality and universality of algorithms, as a supplement, we created an extensional dataset, called WIN143, to evaluate the algorithm performance on specially acquired or post processed images. The WIN143 dataset contains 143 desktop wallpapers with a resolution of 1920×1080 that are always used in the Windows 10 operating system. The images in WIN143 were collected from the internet and are specially shot or carefully post processed, or even generated by computer graphics technologies. Here, we call images such as these over-processed images. Compared to daily shot images, the over-processed images always get higher contrast and saturation, and their complexity and unexpected changes are obviously enhanced. The extensional experiment on the WIN143 dataset was conducted with a JPEG quality of 20. Because the original resolution of the images in the WIN143 dataset was too large for them to be placed in memory, we reduced the image height and width by half using the bicubic interpolation algorithm. The performance comparison results in terms of PSNR and SSIM are shown in Table 4. The performance difference between ARCNN and S-Net is significantly magnified that 28 of 143 images restored by ARCNN get even worse results in terms of PSNR while S-Net remains good performances as before. Figure 11 shows the qualitative results for the WIN143 dataset. The images restored by S-Net have higher color and intensity accuracy, especially in the dark and the smooth areas. Further, S-Net is better able to distinguish the true textures and fake textures created by JPEG compression.

Conclusion
This study investigated the effects of increased network depth on network performance and proposed a scalable CNN called S-Net for JPEG compression artifact reduction. By applying a symmetric convolutional encoder-decoder model and a greedy loss architecture, S-Net dynamically adjusts the network depth. We proved that this greedy theory-based architecture does not sink into a local optimum and achieves better results than a specifically trained network under the same conditions. Furthermore, the proposed architecture is also helpful for discovering the minimal network scale with maximum possible network performance. With the greedy loss architecture, the evaluation results for the depth of the network were quickly obtained after training once, whereas several training sessions had to be applied with the conventional architecture. We compared our approach with other state-of-the-art algorithms on public benchmark datasets and achieved top ranking. We also created an over-processed image dataset, called WIN143, using images obtained from the internet. The results of extensional performance evaluation on the WIN143 dataset successfully validated the generality and universality of the proposed algorithm.
Instrumentation, Zhejiang University. His major research interests include embedded systems, networking multimedia systems, and electronic instrumentation systems.

Fig. 11
Comparison of our model with state-of-the-art methods for QF20 JPEG compression artifact reduction on the WIN143 dataset. Table 1 Construction of convolutional encoder-decoder model. Table 2 Size of parameters of proposed architectures. Table 3 Comparison of our approaches with existing methods on public benchmark datasets.
Boldface indicates the best performance.