{'fraction_non_alphanumeric': 0.03822896079761659, 'fraction_numerical': 0.01595823132061001, 'mean_word_length': 4.689209598925994, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Learning to Correct Overexposed and Underexposed Photos

Capturing photographs with wrong exposures remains a major source of errors in camera-based imaging. Exposure problems are categorized as either: (i) overexposed, where the camera exposure was too long, resulting in bright and washed-out image regions, or (ii) underexposed, where the exposure was too short, resulting in dark regions. Both under- and overexposure greatly reduce the contrast and visual appeal of an image. Prior work mainly focuses on underexposed images or general image enhancement. In contrast, our proposed method targets both over- and underexposure errors in photographs. We formulate the exposure correction problem as two main sub-problems: (i) color enhancement and (ii) detail enhancement. Accordingly, we propose a coarse-to-fine deep neural network (DNN) model, trainable in an end-to-end manner, that addresses each sub-problem separately. A key aspect of our solution is a new dataset of over 24,000 images exhibiting a range of exposure values with a corresponding properly exposed image. Our method achieves results on par with existing state-of-the-art methods on underexposed images and yields significant improvements for images suffering from overexposure errors.


Introduction
The exposure used at capture time directly affects the overall brightness of the final rendered photograph. Digital cameras control exposure using three main factors: (i) capture shutter speed, (ii) f-number, which is the ratio of the focal length to the camera aperture diameter, and (iii) the ISO value to control the amplification factor of the received pixel signals. In photography, exposure settings are represented by exposure values (EVs), where each EV refers to different combinations of camera shutter speeds and f-numbers that result in the same exposure effect-also referred to as 'equivalent exposures' in photography.
Digital cameras can adjust the exposure value of captured images for the purpose of varying the brightness levels. This adjustment can be controlled manually From MIT-Adobe FiveK [38] Overexposure Underexposure Fig. 1: The first column shows photographs with over-and underexposure errors. Results from current commercial software and the proposed method are shown.
by users or performed automatically in an auto-exposure (AE) mode. When AE is used, cameras adjust the EV to compensate for low/high levels of brightness in the captured scene using through-the-lens (TTL) metering that measures the amount of light received from the scene [1].
Exposure errors can occur due to several factors, such as errors in measurements of TTL metering, hard lighting conditions (e.g., very low lighting and backlighting), dramatic changes in the brightness level of the scene, or errors made by users in the manual mode. Such exposure errors are introduced early in the capture process and are thus hard to correct after rendering the final 8-bit image. This is due to the highly nonlinear operations applied by the camera image signal processor (ISP) afterwards to render the final 8-bit standard RGB (sRGB) image [2]. Correcting images with such errors is a challenging task even for well-established image enhancement software packages as shown in Fig. 1. Although both overand underexposure errors are common in photography, most prior work is mainly focused on correcting underexposure errors [3][4][5][6][7] or generic image quality enhancement [8,9].
Contributions We propose a coarse-to-fine deep learning method for exposure error correction of both over-and underexposed sRGB images. Our approach formulates the exposure correction problem as two main sub-problems: (i) color and (ii) detail enhancement. We propose a coarse-to-fine deep neural network (DNN) model, trainable in an end-to-end manner, that begins by correcting the global color information and subsequently refines the image details. In addition to our DNN model, a key contribution to the exposure correction problem is a new dataset containing over 24,000 images rendered from raw-RGB to sRGB with different exposure settings. Each image in our dataset is provided with a corresponding properly exposed reference image. Lastly, we present an extensive set of evaluations and ablations of our proposed method with comparisons to the state of the art. We demonstrate that our method achieves results on par with previous methods dedicated to underexposed images and yields significant improvements on overexposed images.

Related Work
The focus of our paper is on correcting exposure errors in camera-rendered 8bit sRGB images. We refer the reader to [10][11][12][13] for representative examples for rendering linear raw-RGB images captured with low light or exposure errors. The related work is organized into three categories: (i) exposure error correction, (ii) high dynamic range (HDR) restoration and generic image enhancement, and (iii) related paired datasets.
Exposure Correction Traditional methods for exposure correction rely on image histograms to re-balance image intensity values aiming to correct exposure errors and enhance image contrast [14][15][16][17][18]. Alternatively, tone curve adjustment is used to correct images with exposure errors. This process is performed by relying either solely on input image information [19] or trained deep learning models [20,21]. The majority of prior work adopts the Retinex theory [22] by assuming that improperly exposed images can be formulated as a pixel-wise multiplication of target images, captured with correct exposure settings, by illumination maps. Thus, the goal of these methods is to predict illumination maps to recover the well-exposed target images. Representative Retinex-based methods include [3,4,[22][23][24][25][26] and the most recent deep learning ones [5][6][7]. Most of these methods, however, are restricted to correcting underexposure errors [3][4][5][6][7]. In contrast to the majority of prior work, our work is the first deep learning method to explicitly correct both overexposed and underexposed photographs.
HDR Restoration and Image Enhancement HDR restoration is the process of reconstructing scene radiance HDR values from one or more low dynamic range (LDR) input images. Prior work either requires access to multiple LDR images [27][28][29] or uses a single LDR input image, which is converted to an HDR image by hallucinating missing information [30,31]. Ultimately, these reconstructed HDR images are mapped back to LDR for perceptual visualization. This mapping can be directly performed from the input multi-LDR images [32,33], the reconstructed HDR image [34], or directly from the single input LDR image without the need for radiance HDR reconstruction [8,9]. There are also methods that focus on general image enhancement that can be applied to enhancing images with poor exposure. In particular, work by [35,36] was developed primarily to enhance images captured on smartphone cameras by mapping captured images to appear as high-quality images captured by a DSLR. Our work does not seek to reconstruct HDR images or general enhancement, but instead is trained to explicitly address exposure errors.
Emulates camera ISP processes based on metadata in each DNG file  Fig. 2: Dataset overview. Our dataset contains images with different exposure error types and their corresponding properly exposed reference images. Shown is a t-SNE visualization [37] of all images in our dataset and the low-light (LOL) paired dataset (outlined in red) [5]. Notice that LOL covers a relatively small fraction of the possible exposure levels, as compared to our introduced dataset. Our dataset was rendered from linear raw-RGB images taken from the MIT-Adobe FiveK dataset [38]. Each image was rendered with different relative exposure values (EVs) by an accurate emulation of the camera ISP processes.  [7] and the low-light (LOL) paired dataset [5]. Unlike existing datasets for exposure correction, we introduce a large image dataset rendered with a wide range of exposure errors. Fig. 2 shows a comparison between our dataset and the LOL dataset in terms of the number of images and the variety of exposure errors in each dataset. The LOL dataset covers a relatively small fraction of the possible exposure levels, as compared to our introduced dataset. Our dataset is based on the Adobe-MIT FiveK dataset [38] and is accurately rendered by adjusting the high tonal values provided in camera sensor raw-RGB images to realistically emulate camera exposure errors. An alternative worth noting is to use a large HDR dataset to produce training data-for example, the Google HDR+ dataset [12]. One drawback, however, is that this dataset is a composite of a varying number of smartphone captured raw-RGB images that were first aligned to a composite raw-RGB image. The target ground truth image is based on an HDR-to-LDR algorithm applied to this composite raw-RGB image [8,12]. We opt instead to use the FiveK dataset as it starts with a single highquality raw-RGB image and the ground truth result is generated by an expert photographer.

Our Dataset
To train our model, we need a large number of training images rendered with realistic over-and underexposure errors and corresponding properly exposed ground truth images. As discussed in Sec. 2, such datasets are currently not publicly available. For this reason, our first task was to create a new dataset. Our dataset is rendered from the MIT-Adobe FiveK dataset [38], which has 5,000 raw-RGB images and corresponding sRGB images rendered manually by five expert photographers [38].
For each raw-RGB image, we use the Adobe Camera Raw SDK [39] to emulate different EVs as would be applied by a camera [40]. Adobe Camera Raw accurately emulates the nonlinear camera rendering procedures using metadata embedded in each DNG raw file [40,41]. We render each raw-RGB image with different digital EVs to mimic real exposure errors. Specifically, we use the relative EVs −1.5, −1, +0, +1, and +1.5 to render images with underexposure errors, a zero gain of the original EV, and overexposure errors, respectively. The zero-gain relative EV is equivalent to the original exposure settings applied onboard the camera during capture time.
As the ground truth images, we use images that were manually retouched by an expert photographer (referred to as Expert C in [38]) as our target correctly exposed images, rather than using our rendered images with +0 relative EV. The reason behind this choice is that a significant number of images contain backlighting or partial exposure errors in the original exposure capture settings. The expert adjusted images were performed in ProPhoto RGB color space [38] (rather than raw-RGB), which we converted to a standard 8-bit sRGB color space encoding.
In total, we generated 24,330 8-bit sRGB images with different digital exposure settings. We discarded a small number of images that had misalignment with their corresponding ground truth image. These misalignments were due to different usage of the DNG crop area metadata by Adobe Camera Raw SDK and the expert. Our dataset is divided into three sets: (i) training set of 17,675 images, (ii) validation set of 750 images, and (iii) testing set of 5,905 images. The training, validation, and testing sets, use different images taken from the FiveK dataset. This means the training, validation, and testing images do not share any images in common. Fig. 2 shows examples of our generated 8-bit sRGB images and the corresponding properly exposed 8-bit sRGB reference images.  Fig. 4: Overview of our image exposure correction architecture. We propose a coarse-to-fine deep network to progressively correct exposure errors in 8-bit sRGB images. Our network first corrects the global color captured at the final level of the Laplacian pyramid and then the subsequent frequency layers.

Our Method
Given an 8-bit sRGB input image, I, rendered with the incorrect exposure setting, our method aims to produce an output image, Y, with fewer exposure errors than those in I. As we target both over-and underexposed errors, our input image, I, is expected to contain regions of nearly over-or under-saturated values with corrupted color and detail information. We propose to correct color and detail errors of I in a sequential manner. Specifically, we propose to process a multi-resolution representation of I, rather than directly dealing with the original form of I. We use the Laplacian pyramid [42] as our multiresolution decomposition, which is derived from the Gaussian pyramid of I.

Coarse-to-Fine Exposure Correction
Let X represent the Laplacian pyramid of I with n levels, such that X (l) is the l th level of X. The last level of this pyramid (i.e., X (n) ) captures low-frequency information of I, while the first level (i.e., X (1) ) captures the high-frequency information. Such frequency levels can be categorized into: (i) global color information of I stored in the low-frequency level and (ii) image coarse-to-fine details stored in the mid-and high-frequency levels. These levels can be later used to reconstruct the full-color image I. Fig. 3 motivates our coarse-to-fine approach to exposure correction. Figs. 3-(A) and (B) show an example overexposed image and its corresponding wellexposed target, respectively. As observed, a significant exposure correction can be obtained by using only the low-frequency layer (i.e., the global color information) of the target image in the Laplacian pyramid reconstruction process, as shown in Fig. 3-(C). We can then improve the final image by enhancing the details in a sequential way by correcting each level of the Laplacian pyramid, as shown in Fig. 3-(D). Practically, we do not have access to the properly exposed image in Fig. 3-(B) at the inference stage, and thus our goal is to predict the missing color/detail information of each level in the Laplacian pyramid.
Inspired by this observation and the success of coarse-to-fine architectures for various other computer vision tasks (e.g., [43][44][45][46]), we design a DNN that corrects the global color and detail information of I in a sequential manner using the Laplacian pyramid decomposition. The remaining part of this section explains the technical details of our model (Sec. 4.2), including details of the losses (Sec. 4.3), implementation and training (Sec. 4.4), and inference phase (Sec. 4.5).

Coarse-to-Fine Network
Our image exposure correction architecture sequentially processes the n-level Laplacian pyramid X of image I to produce the final corrected image Y. The proposed model consists of n sub-networks. Each of these sub-networks is a U-Net-like architecture [47] with untied weights. We allocate the network capacity in the form of weights based on how significantly each sub-problem (i.e., global color correction and detail enhancement) contributes to our final result. Fig. 4 provides an overview of our network. As shown, the largest (in terms of weights) sub-network in our architecture is dedicated to processing the global color information in I (i.e., X (n) ). This sub-network (shown in yellow in Fig. 4) processes the low-frequency level X (n) and produces an upscaled image Y (n) . The upscaling process scales up the output of our sub-network by a factor of two using strided transposed convolution with trainable weights. Next, we add the first mid-frequency level X (n−1) to Y (n) to be processed by the second sub-network in our model. This sub-network enhances the corresponding details of the current level and produces a residual layer that is then added to Y (n) + X (n−1) to reconstruct image Y (n−1) , which is equivalent to the corresponding Gaussian pyramid level n − 1. This refinement-upsampling process proceeds until the final output image, Y, is produced. Our network is fully differentiable and thus can be trained in an end-to-end manner.

Losses
We train our model end-to-end to minimize the following loss function: where L rec denotes the reconstruction loss, L pyr the pyramid loss, and L adv the adversarial loss.
Reconstruction Loss: We use the L 1 loss function between the reconstructed and properly exposed reference images. This loss can be expressed as follows:  where h and w denote the height and width of the training image, respectively, and p is the index of each pixel in our corrected image, Y, and the corresponding properly exposed reference image, T, respectively. The individual losses are described below.
Pyramid Loss: To guide each sub-network to follow the Laplacian pyramid reconstruction procedure, we introduce dedicated losses at each pyramid level. Let T (l) denote the l th level of the Gaussian pyramid of our reference image, T, after upsampling by a factor of two. We use a simple interpolation process for the upsampling operation [27]. Our pyramid loss is computed as follows: where h l and w l are twice the height and width of the l th level in the Laplacian pyramid of the training image, respectively, and p is the index of each pixel in our corrected image at the l th level Y (l) and the properly exposed reference image at the same level T (l) , respectively. The pyramid loss not only gives a principled interpretation of the task of each sub-network but also results in less visual artifacts compared to training using only the reconstruction loss (see Adversarial Loss: To perceptually enhance the reconstruction of the corrected image output in terms of realism and appeal, we also consider an adversarial loss as a regularizer. This adversarial loss term can be described by the following equation [48]: where S is the sigmoid function and D is a discriminator DNN that is trained together with our main network.

Implementation and Training Details
In our implementation, we use a Laplacian pyramid with four levels (i.e., n = 4) and thus we have four sub-networks in our model. We provide the implementation details of our network, the discriminator network used in the adversarial training process, and the training details below.

Main Network
Our main network consists of four sub-networks with ∼7M parameters trained in an end-to-end manner. Each sub-network accepts a different representation of the input image extracted from the Laplacian pyramid decomposition. The first sub-network is a four-layer encoder-decoder network with skip connections (i.e., U-Net-like architecture [47]). The output of the first convolutional (conv) layer has 24 channels. Our first sub-network has ∼4.4M learnable parameters and it accepts the low-frequency band level of the Laplacian pyramid, i.e., X (4) . The result of the first sub-network is then upscaled using a 2×2×3 transposed conv layer with three output channels and a stride of two. This processed layer is then added to the first mid-frequency band level of the Laplacian pyramid (i.e., X (3) ) and is fed to the second sub-network.
The second sub-network is a three-layer encoder-decoder network with skip connections. It has 24 channels in the first conv layer of the encoder, with a total of ∼1.1M learnable parameters. The second sub-network processes the upscaled input from the first sub-network and outputs a residual layer, which is then added back to the input to the second sub-network followed by a 2×2×3 transposed conv layer with three output channels and a stride of two. The result is added to the second mid-frequency band level of the Laplacian pyramid (i.e., X (2) ) and is fed to the third sub-network, which generates a new residual that is added back again to the input of this sub-network.
The third sub-network has the same design as the second network. Finally, the result is added to the high-frequency band level of the Laplacian pyramid (i.e., X (1) ) and is fed to the fourth sub-network to produce the final processed image.
The final sub-network is a three-layer encoder-decoder network with skip connections and has ∼482.2K learnable parameters, where the output of the first conv layer in its encoder has 16 channels. We provide the details of the main encoder-decoder architecture of each sub-network in Fig. 6-(A).

Discriminator Network
In the adversarial training of our network, we use a light-weight discriminator network with ∼1M learnable parameters. We provide the details of the discriminator in Fig. 6-(B). Notice that unlike our main network, we resize all input image patches to have 256 × 256 pixels before being processed by the discriminator. The output of the last layer in our discriminator is a single scalar value which is then used in our loss during the optimization. [49] to initialize the weights of our encoder and decoder conv layers, while the bias terms are initialized to zero. We minimize our loss functions using the Adam optimizer [50] with a decay rate β 1 = 0.9 for the exponential moving averages of the gradient and a decay rate β 2 = 0.999 for the squared gradient. We use a learning rate of 10 −4 to update the parameters of our main network and a learning rate of 10 −5 to update our discriminator's parameters.

Training Details We use He et al.'s method
We train our network on patches with different dimensions. Training begins without the adversarial loss, L adv , then L adv is added to enhance the results of our initial training [51]. Specifically, we begin our training without L adv on 176,590 patches with dimensions of 128 × 128 pixels extracted randomly from our training images for 40 epochs. The mini-batch size is set to 32. The learning rate is decayed by a factor of 0.5 after the first 20 epochs. Then, we continue training on another 105,845 patches with dimensions of 256×256 pixels for 30 epochs with a mini-batch size of eight. At this stage, we train our main network without L adv for 15 epochs and continue training for another 15 epochs with L adv . The learning rates for the main network and the discriminator network are decayed by a factor of 0.5 every 10 epochs. Finally, we fine-tune the trained networks on another 69,515 training patches with dimensions of 512×512 pixels for 20 epochs with a mini-batch size of four and a learning rate decay of 0.5 applied every five epochs.
We discard any training patches that have an average intensity less than 0.02 or higher than 0.98. We also discard homogeneous patches that have a gradient magnitude less than 0.06. We randomly left-right flip training patches for data augmentation.
In the adversarial training, we optimize both the main network and the discriminator in an iterative manner. At each optimization step, the learnable parameters of each network are updated to minimize its own loss function. The discriminator is trained to minimize the following loss function [48]: where r (T) refers to the discriminator loss of recognizing the properly exposed reference image T, while c (Y) refers to the discriminator loss of recognizing our corrected image Y. The r (T) and c (Y) loss functions are given by the following equations:

Inference Stage
Our network is fully convolutional and can process input images with different resolutions. While our model requires a reasonable memory size (∼7M parameters), processing high-resolution images requires a high computational power that may not always be available. Furthermore, processing images with considerably higher resolution (e.g., 16-megapixel) than the range of resolutions used in the training process can affect our model's robustness with large homogeneous image regions. This issue arises because our network was trained on a certain range of effective receptive fields, which is very low compared to the receptive fields required for images with very high resolution. To that end, we use the bilateral guided upsampling method [52] to process high-resolution images. First, we resize the input test image to have a maximum dimension of 512 pixels. Then, we process the downsampled version of the input image using our model, followed by applying the fast upsampling technique [52] with a bilateral grid of 22×22×8 cells. This process allows us to process a 16-megapixel image in ∼4.5 seconds on average. This time includes ∼0.5 seconds to run our network on an NVIDIA GeForce GTX 1080 TM GPU and ∼4 seconds on an Intel Xeon E5-1607 @ 3.10 GHz machine for the guided upsampling process. Note the runtime of guided upsampling step can be significantly improved with a Halide implementation [53].

Empirical Evaluation
We compare our method against several existing methods for exposure correction and image enhancement. We first present quantitative results and comparisons in Sec. 5.1, followed by qualitative comparisons in Sec. 5 Fig. 7: We evaluate the results of input images against all five expert photographers' edits from the FiveK dataset [38].

Quantitative Results
To evaluate our method, we use our test set, which consists of 5,905 images rendered with different exposure settings, as described in Sec. 3. Specifically, our test set includes 3,543 well-exposed/overexposed images rendered with +0, +1, and +1.5 relative EVs, and 2,362 underexposed images rendered with −1 and −1.5 relative EVs. We adopt the following three standard metrics to evaluate the pixel-wise accuracy and the perceptual quality of our results: (i) peak signal-to-noise ratio (PSNR), (ii) structural similarity index measure (SSIM) [54], and (iii) perceptual index (PI) [55]. The PI is given by: where both Ma [56] and NIQE [57] are no-reference image quality metrics. For the pixel-wise error metrics -namely, PSNR and SSIM -we compare the results not only against the properly exposed rendered images by Expert C but also with all five expert photographers in the MIT-Adobe FiveK dataset [38]. Though the expert photographers may render the same image in different ways due to differences in the camera-based rendering settings (e.g., white balance, tone mapping), a common characteristic over all rendered images by the expert photographers is that they all have fairly proper exposure settings [38] (see Fig. 7). For this reason, we evaluate our method against the five expert rendered images as they all represent satisfactory exposed reference images.

Input images
Results from DPED [35] Our results Properly exposed ref. images  Table 1 summarizes the quantitative results obtained by each method. As shown in the top portion of the table, our method achieves the best results for overexposed images under all metrics. In the underexposed image correction setting, our results (middle portion of table) are on par with the state-of-the-art methods. Finally, in contrast to most of the existing methods, the results in the bottom portion of the table show that our method can effectively deal with both types of exposure errors.

Method
Expert A Expert B Expert C Expert D Expert E Avg. PI PSNR SSIM PSNR SSIM PSNR SSIM PSNR SSIM PSNR SSIM PSNR SSIM +0, +1, and +1.5 relative EVs (3,543 properly exposed and overexposed images) HE [14] * Table 1: Quantitative evaluation on our introduced test set. The best results are highlighted with green and bold. The second-and third-best results are highlighted in yellow and red, respectively. We compare each method with properly exposed reference image sets rendered by five expert photographers [38]. For each method, we present peak signal-to-noise ratio (PSNR), structural similarity index measure (SSIM) [54], and perceptual index (PI) [55]. We denote methods designed for underexposure correction in gray. Non-deep learning methods are marked by * . The terms U and S stand for unsupervised and supervised, respectively. Notice that higher PSNR and SSIM values are better, while lower PI values indicate better perceptual quality.

Input images
Results from Deep UPE [9] Our results Properly exposed ref. images

Qualitative Results
We compare our method qualitatively with a variety of previous methods. Note we show results using the model trained with the adversarial loss term, as it produces perceptually superior results (see the perceptual metric results in Tables  1 and 2). Figs. 8 and 9 show our results on different overexposed and underexposed images, respectively. As shown, our method provides compelling results for both exposure errors. We also compare our method with the most recent method for overexposure correction [26] in Fig. 10 -the source code of [26] is not yet  available; the result is taken directly from the original paper [26]. As shown, our results are arguably visually superior to the other methods, even when input images have hard backlight conditions, as shown in the second row in Fig. 9 and the example in Fig. 12.
We also ran our model on several images from Flickr that are outside our introduced dataset, as shown in Figs. 1, 11, and 12. As with the images from our proposed dataset, our results on the Flickr images are arguably superior to the compared methods.
Our method produces unsatisfactory results in regions that have insufficient semantic information, as shown in Fig. 13. For example, the input image shown in the first row in Fig. 13 is completely saturated and contains almost no details in the region of the man's face. We can see that our network cannot constrain the color inside the face region due to the lack of semantic information. It also can be observed that our method may introduce noise when the input image has very dark regions, as shown in the second example in Fig. 13. These challenging conditions prove difficult for other methods as well.

Ablation Studies
This section presents details on the ablation studies that were performed to validate the architecture and loss function.

Loss Function
Our loss function in Eq. 1 includes three main terms. The first term is the standard reconstruction loss (i.e., L 1 loss). The second and third terms consist of the pyramid and adversarial losses, respectively, which are introduced to further improve the reconstruction and perceptual quality of the output images. In the following part of this section, we discuss the effect of these loss terms.
Pyramid Loss Impact In Fig. 5, we show the output of each sub-network when we train our model with and without the pyramid loss. We observe that the pyramid loss helps to provide additional supervision to guide each sub-network to follow a coarse-to-fine reconstruction. In this ablation study, we aim to quantitatively evaluate the effect of the pyramid loss on our final results.
We train two light-weight models of our main network with and without our pyramid loss term. Each model has four 3-layer U-Nets with a total of ∼4M learnable parameters, where the number of output channels of the first encoder in each U-Net is set to 24.
The training is performed on a sub-set of our training data for ∼150,000 iterations on 80,000 128×128 patches, ∼100,000 iterations on 40,000 256×256 patches, and ∼25,000 iterations on 25,000 512×512 patches. Table 3 Table 3: Results of our ablation study on 500 images randomly selected from our validation set. We show the effects of: (i) the pyramid loss, L pyr , and (ii) the number of levels, n, in the main network. The best PSNR/SSIM values are indicated with bold for each experiment.
show that the pyramid loss not only helps in providing a better interpretation of the task of each sub-network but also improves the final results.
Adversarial Loss Impact In Tables 1 and 2, we show quantitative results of our method with and without the adversarial loss term. Our trained model with the adversarial loss term achieves better perceptual quality (i.e., lower PI values [55]) than training without the adversarial loss term. Fig. 15 shows qualitative comparisons of our results with and without the adversarial loss. As shown, the network trained without the adversarial training tends to produce darker images and slightly unrealistic colors in some cases, while the adversarial regularization improves the perceptual quality of our results.

Number of Laplacian Pyramid Levels
We repeat the same experimental setup described in Sec. 5.3.1 with a varying number of Laplacian pyramid levels (sub-networks). Specifically, we train a network with n = 1 levels-this network is equivalent to a vanilla U-Net-like architecture [47]. Additionally, we train another network with n = 2 (i.e., two sub-networks).
For a fair comparison, we fix the total number of parameters in each model by changing the number of filters in the conv layers. Specifically, we set the number of output channels of the first layer in the encoder to 48 for the trained model with n = 1, while we decrease it to 34 for the two-sub-net model (i.e., n = 2) to have approximately the same number of learnable parameters. Thus, the trained  Table 3 shows the results obtained by each model on the same random validation image subset used to study the pyramid loss impact in Sec. 5.3.1. Fig.  14 shows a qualitative comparison. As can be seen, the best quantitative and qualitative results are obtained using the four-sub-net model (i.e., n = 4 levels).

Concluding Remarks
We proposed a coarse-to-fine deep learning model for overexposed and underexposed image correction. We employed the Laplacian pyramid decomposition to process input images in different frequency bands. Our method is designed to sequentially correct each of the Laplacian pyramid levels in a multi-scale manner, starting with the global color in the image and progressively addressing the image details. Our method is enabled by generating a large dataset of over 24,000 images rendered with different exposure errors. Each image in our introduced dataset has a reference image properly rendered by a well-trained photographer with well-exposure compensation. Through extensive evaluation, we showed that our method produces compelling results compared to available solutions for cor-recting images rendered with exposure errors. We believe that our dataset will help future work on improving exposure correction for photographs.