{'fraction_non_alphanumeric': 0.038203478022730386, 'fraction_numerical': 0.013213747774887033, 'mean_word_length': 4.814888535031847, 'pattern_counts': {'":': 0, '<': 0, '<?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}}
Convolutional Neural Networks Considering Local and Global features for Image Enhancement

In this paper, we propose a novel convolutional neural network (CNN) architecture considering both local and global features for image enhancement. Most conventional image enhancement methods, including Retinex-based methods, cannot restore lost pixel values caused by clipping and quantizing. CNN-based methods have recently been proposed to solve the problem, but they still have a limited performance due to network architectures not handling global features. To handle both local and global features, the proposed architecture consists of three networks: a local encoder, a global encoder, and a decoder. In addition, high dynamic range (HDR) images are used for generating training data for our networks. The use of HDR images makes it possible to train CNNs with better-quality images than images directly captured with cameras. Experimental results show that the proposed method can produce higher-quality images than conventional image enhancement methods including CNN-based methods, in terms of various objective quality metrics: TMQI, entropy, NIQE, and BRISQUE.


INTRODUCTION
The low dynamic range (LDR) of modern digital cameras is a major factor that prevents cameras from capturing images as well as human vision. This is due to the limited dynamic range that imaging sensors have, resulting in low-contrast images. Enhancing such images reveals hidden details.
Various kinds of research on single-image enhancement have been reported [1][2][3][4][5]. Most image enhancement methods can be divided into two types: histogram equalization (HE)-based methods and Retinex-based methods. However, both HE-and Retinex-based methods cannot restore lost pixel values due to quantizing and clipping. The problem leads to banding artifacts in enhanced images. For this reason, image enhancement methods based on convolutional neural networks (CNNs) are expected to solve the problem that traditional methods have.
CNNs have been successfully used in many image-to-image translation tasks such as single image super-resolution, image inpainting, and image segmentation. Recently, CNN-based image enhancement methods have also been developed [6][7][8][9][10][11]. Most of these methods employ a U-Net [12]-based network architecture. However, U-Net cannot extract global features of images when large input images are given or when U-Net itself does not have a sufficient number of layers. In this case, output images are often distorted because both local and global features are needed for image enhancement, whereas only local ones are needed for other tasks such as superresolution.
In this paper, we propose a novel CNN architecture that considers local and global features for image enhancement. The proposed architecture consists of three networks: a local encoder, a global encoder, and a decoder. The use of the local encoder and the global encoder enables us to extract both local and global features, even when large images are given as inputs. In the decoder, these features are combined to produce enhanced images. The proposed CNNs can be trained with small images, and images of various sizes can be enhanced by the CNNs without distortions. In addition, we utilize tone-mapped images from existing high dynamic range (HDR) images for the training [13,14]. Target LDR images mapped from HDR ones have better quality than those directly captured from cameras because HDR images contain more information.
We evaluate the effectiveness of the proposed image enhancement network in terms of the quality of enhanced images in a number of simulations, where the tone mapped image quality index (TMQI), discrete entropy, naturalness image quality evaluator (NIQE), and blind/referenceless image spatial quality evaluator (BRISQUE) are utilized as quality metrics. Experimental results show that the proposed method outperforms state-of-the-art contrast enhancement methods in terms of those quality metrics. Furthermore, the proposed method does not cause distortions in output images, unlike CNNs that do not consider global features.

RELATED WORK
Many image enhancement methods have been studied [1][2][3][4][5]15]. Among the methods, HE has received the most attention because of its intuitive implementation quality and high efficiency. It aims to derive a mapping function such that the entropy of a distribution of output luminance values can be maximized. However, HE often causes over-enhancement. To avoid this, numerous improved methods based on HE have also been developed [1, 2]. Another way for enhancing images is to use the Retinex theory [16]. Retinex-based methods [3, 4] decompose images into reflectance and illumination, and then enhance images by manipulating illumination. However, without the use of CNNs, these methods cannot restore lost pixel values due to clipping and quantizing.
Recently, a few CNN-based methods were proposed for single image enhancement [6][7][8][9][10][11]. Chen's method [6] provides highquality RGB images from single raw images taken under low-light conditions, but this method cannot be applied to RGB color images that are not raw images. Yang's et al. [7] proposed a method for enhancing RGB images by using two CNNs. This method generates intermediate HDR images from input RGB images, and then produces high-quality LDR images. However, generating HDR images from single images is a well-known outstanding problem [17,18] [6][7][8][9] only handle local image information, so output images can be distorted by CNNs due to a lack of global image information required for image enhancement, which is addressed later in this paper. Therefore, we aim to improve the performance of image enhancement by using a novel network architecture that considers both local and global image information. Figure 1 shows an overview of our training procedure and predicting procedure. In the training, all input LDR images x and target LDR images y are generated from HDR images by using a virtual camera [17] and tone mapping, respectively. This enables us to generate high-quality target images.

PROPOSED METHOD
After the training, various LDR images are applied to the proposed CNNs as input images, where the CNNs then generate highquality LDR images. Detailed training conditions are described in Section 3.2. 3.1. Network architecture Figure 2 shows the overall network architecture of the proposed method. The architecture consists of three networks: a local encoder, a global encoder, and a decoder. The local encoder and the decoder in the proposed method are almost the same as those used in U-Net [12]. Concatenated skip connections between the local encoder and the decoder is also utilized like in U-Net. Although U-Net works very well for various image-to-image translation problems, its use for image enhancement often causes distortions in output images [19]. This is due to its network architecture that cannot handle global image information (see Section 4). For this reason, we utilize the global encoder and combine features extracted by both encoders to prevent the distortions. The input for the local encoder is a H ×W pixels 24-bit color LDR image. For the global encoder, the input image is resized to a fixed size (128 × 128).
The proposed CNNs have five types of layers as shown in Fig.  5: 3 × 3 Conv.+ BN + ReLU which calculates a 3 × 3 convolution with a stride of 1 and a padding of 1. After convolution, batch normalization [20] and the rectified linear unit activation function [21]  convolution without padding. The number of filters in the layer is 64.

Training
Numerous LDR images taken under various conditions, x, and corresponding high-quality images, y, are needed to train the CNNs in the proposed method. However, collecting a sufficient number is difficult. We therefore utilize HDR images E to generate both x and y by using a virtual camera [17] and a tone mapping operation with Mertens's fusion method [22], respectively. The use of HDR images also makes it possible to generate better-quality images than those directly captured with cameras. For training, 831 HDR images were collected from online available databases [23][24][25][26][27][28].
The training procedure of our CNNs is shown as follows. i Select 16 HDR images from the 831 HDR images at random. ii Generate 16 pairs of an input and target LDR images (x, y) from each HDR image. Each pair is generated in accordance with the following steps. where (i, j) denotes a pixel. Shutter speed ∆t is calculated as ∆t(v) = 0.18 · 2 v /G(Ẽ) as in [13] by using a uniform random number v in the range [−4, 0]. G(Ẽ) is the geometric mean of luminance ofẼ, (e) Generate an input LDR image x from X by using a virtual cameraf , as where η and γ are random numbers that follow normal distributions with a mean of 0.6 and a variance of 0.1 and with a mean of 0.9 and a variance of 0.1, respectively. Note that eq. (1) is applied to the luminance of X, and RGB pixel values of x are then obtained so that the RGB value ratios of x are equal to those of X. (f) Generate a target LDR image y fromẼ by using a tone mapping operatorf as y =f (Ẽ). Here, Mertens's multi exposure fusion method [22] is used in the tone mapping operator:f (Ẽ) = F(Y (−2) , Y (0) , Y (2) ), where, similarly to X, exposure Y (u) i,j is given as Y   iii Predict 16 LDR imagesŷ from 16 input LDR images x by using the CNNs. iv Evaluate errors between predicted imagesŷ and target images y by using the mean squared error. v Update filter weights ω and biases b in the CNNs by backpropagation.
In our experiments, the CNNs were trained with 500 epochs, where the above procedure was repeated 51 times in each epoch. In addition, each HDR image had only one chance to be selected, in Step i in each epoch. He's method [29] was used for initializing of the CNNs. In addition, the Adam optimizer [30] was utilized for optimization, where parameters in Adam were set as α = 0.002, β1 = 0.9, and β2 = 0.999.

SIMULATION
We evaluated the effectiveness of the proposed method by using four objective quality metrics.

Simulation conditions
In this experiment, test LDR images were generated from 283 HDR images that were not used for training, in accordance with Steps ii(a)-(e). In addition, test LDR images were resized to 512 × 512 pixels in Step ii(b).
The quality of LDR imagesŷ generated by the proposed method was evaluated by four objective quality metrics: the tone mapped image quality index (TMQI) [31], discrete entropy, the naturalness image quality evaluator (NIQE) [32], the blind/referenceless image spatial quality evaluator (BRISQUE) [33], where the original HDR imageẼ was utilized as a reference for TMQI, and a database [34,35] was used to build a model in BRISQUE.
The proposed method was compared with five conventional methods: histogram equalization (HE), contrast-accumulated histogram equalization (CACHE) [2], simultaneous reflectance and illumination estimation (SRIE) [4], low-light image enhancement via illumination map estimation (LIME) [3], and deep reciprocating HDR transformation 1 (DRHT) [7], where SRIE and LIME are Retinex-based methods and DRHT is a CNN-based one. Table 1 illustrates the average scores of the objective assessment for 283 images, in terms of TMQI, entropy, NIQE, and BRISQUE. In the case of TMQI, a larger value means a higher similarity between a target LDR image and an original HDR image. A larger value for entropy and BRISQUE indicates that a target LDR image has higher quality. By contrast, a smaller value for NIQE indicates that a target LDR image has less distortions such as noise or blur. As shown in Table 1, the proposed method provided the highest average scores for entropy, NIQE, and BRISQUE, in the six methods. HE also provided high TMQI scores, but HE cannot restore lost pixel values and is well known to often causes over-enhancement in bright areas [9]. For these reasons, the proposed method outperforms the conventional methods in terms of the four metrics. Figure 3 shows an example of the images enhanced by the six methods. From the figure, it is confirmed that the proposed method produced a higher-quality image that clearly represents dark areas in the image. The clarity of the image generated by DRHT is low due to the difficulty of generating an intermediate HDR image. In addition, the proposed method enhanced images without banding artifacts due to the quantized pixel values in the input images, but images enhanced by HE and CACHE include banding artifacts as shown in Fig. 4. This is because CNNs enhance images by taking into account local information around each pixel in images, whereas HE-based methods perform pixel-wise operations. The result denotes that the proposed method can not only enhance images, but also restore lost pixel values due to the quantization. Figure 5 illustrates that the effectiveness of the global encoder in the proposed network architecture. When the global encoder was not employed, CNNs caused images to be distorted, creating block-like  artifacts. In contrast, the distortions were prevented when the global encoder was employed. Hence, the global encoder is effective to prevent distortions in enhanced images.

Results
An enhanced image result from an image that directly captured with a digital camera is shown in Fig. 6, where the input image was selected from [36]. From the figure, it is confirmed that the proposed method is also effective for ordinary images, even when HDR images are only used to train CNNs.
Those experimental results show that the proposed network architecture is effective for enhancing single images.

CONCLUSION
In this paper, we proposed a novel CNN  architecture consists of a local encoder, a global encoder, and a decoder. The global encoder can effectively prevent distortions due to the lack of global image information required for image enhancement. Furthermore, the use of HDR images for training enables us to obtain higher-quality target images than those captured with cameras. Experimental results showed that the proposed method outperformed state-of-the-art conventional image enhancement methods including Retinex-and CNN-based methods, in terms of TMQI, entropy, NIQE, and BRISQUE. In addition, visual comparison results demonstrated that the proposed method can effectively enhance images without distortions such as banding and block artifacts. The performance of the proposed method depends on that of tone mapping. Hence, developing high-performance tone mapping operators will also be useful to image enhancement.