In Low Dynamic Range (LDR) to High Dynamic Range (HDR) conversion, there exists a nonlinear mapping between the radiance in a scene and the recorded pixel values of an image. While existing deep learning models achieve compelling visual results through single-task learning, our insight is that these models implicitly assume that one consistent nonlinear mapping exists for all possible scenes. In reality, every scene has a unique nonlinear mapping dependent on the complex interactions between lighting, camera system, processing, etc. Instead of treating all LDR scene images as part of a single LDR-to-HDR conversion task, our approach treats each LDR scene as a unique task sampled from the task distribution of all possible scenes.
To learn the common pattern inherent in all LDR-to-HDR conversion tasks, we propose the use of a meta-learning framework for computing a set of meta-parameters that can quickly be optimized for a specific task given given task-specific information. The MetaHDR model uses model-agnostic meta-learning (MAML)  as the meta-learning framework of choice (see Fig. 1).
Through meta-learning, we learn a set of meta-parameters that capture the common patterns between separate nonlinear mappings. This way, given a few specific examples of LDR images, we can quickly adjust the nonlinear mapping to accommodate the specific LDR-to-HDR conversion task at hand.
2 Related Work
Conversion from LDR-to-HDR has been a long-standing task. Debevec and Malik developed a method to fuse together multiple LDR images captured at different exposures to create an HDR image . In their method, each pixel in each LDR image is given a weight depending on how illuminated or saturated it is. All of the LDR images are combined to create one HDR image which will effectively highlight the well-exposed regions of each LDR image.
Later work tries to create an HDR image from a single camera shot. Nayar et al. applied an optical encoding mask to the camera sensor in order to capture different exposures of the scene . Then, the recorded pixel values are mapped to an HDR image using a developed image processing algorithm. Additionally, Bist et al. applied a variable gamma correction to the image depending on the determined light source in the scene .
There have been attempts to pass one LDR image via some deep learning pipeline with the goal of hallucinating an HDR image. In Eilertsen et al., an input LDR image is passed through a deep U-Net style CNN architecture to output an HDR image . Santos et al. appended an additional fine-tuning stage after passing an LDR image through a deep CNN in order to further correct the over-exposed and under-exposed regions of an image .
Alternatively, it is possible to combine optical hardware with deep learning to produce an HDR image. In Metzler et al., an optical encoder parameterized by a PSF and a CNN decoder are used to create an end-to-end LDR-to-HDR pipeline that reconstructs HDR images without hallucination . Martel et al.
developed neural sensors which use neural networks in order to optimize per-pixel shutter functions which can be used to create an HDR image.
The overall MetaHDR model is outlined in Fig. 2. Given our task distribution of LDR-to-HDR conversions (i.e. all scenes ), each task consists of multiple exposures from the same scene as well as corresponding ground truth HDR labels for both task-specific training samples and task-specific testing samples . For each iteration, we produce task-specific by adapting the meta-parameters using each exposure and HDR pair within .
With our adapted , we forward pass our test exposure and generate its corresponding HDR counterpart. A loss is computed between the predicted HDR image and the ground truth HDR image. The meta-parameters are then adjusted based on the gradients from the inner update loop.
Over all iterations of the training procedure, our model weights encapsulate a general solution that is close to many nonlinear mappings but specific to none.
The dataset used  had 450 scenes111At the time of downloading the data, there were 450 scenes. Recently, the author chose to remove some of the images for aesthetic reasons. where each scene had three LDR images of exposure values -2, 0, +2 and one HDR image. Each image in the dataset was . An example set of three LDR images of different exposures and the corresponding HDR image is shown in Fig. 3.
Because there were only three LDR exposures per scene in the dataset, we attempted to simulate other exposures via linear global tone mapping. We did this by clamping the HDR image to be within a percentile of values, linearly interpolating the pixels within the chosen percentile range to be within 0 and 1, and then applying a gamma correction factor with. Although some simulated exposures were promising, sometimes the simulated exposure would saturate too many pixels. This would cause the original HDR image to not be recoverable. Therefore, we decided to use the original dataset without any simulated exposures. Note that due to compute limitations, we cropped each image about the center to .
3.2 Inner Model Architecture
Within each task-specific adaptation step, the input images go through a UNet architecture . This choice was motivated by the performance of existing single-task models, which use UNets to perform HDR reconstruction .
The UNet’s contracting layers and expanding layers are organized into blocks which consist of a sequence of contraction and expansion layers. Each block is a predefined sequence of identical convolutions, activations, maximum-pools, and batch normalizations. The bottom block as well as the top block (i.e. the block that leads to the output image) differ from the other expanding and contracting blocks. At each contracting block, the number of channels is doubled while the number of dimensions is halved.
convolution operations are done with a stride of 1 and a padding of 1. The universal activation function used in all architecture references to activation is the ReLU activation function. Max pooling is applied between each contracting block. The following sections detail the specifications of each block in the UNet.
Each contracting block consists of two 2D convolution operations terminated with the activation function. The first convolution doubles the number of channels. The second one does not. A 2D batch normalization is done between the convolution operations and the activation function.
The bottom block is an augmented contracting block. After performing the same sequential structure as a contracting block, an extra 2D convolutional upsample is done. This operation halves the number of channels present.
Taking the concatenated result (which consists of the previous block and a sub-portion of the corresponding contracting block), each expanding block performs one 2D convolution. This operation halves the number of channels. The second convolution is identical, except it keeps the channel number equal. Finally, the 2D convolutional upsample is performed. Every convolution is followed by the activation function.
The top block consists of two convolutions. The first 2D convolutional layer halves the number of channels. The second does not change the channel number. The final layer is a 2D convolution that maps the channels to the 3 output RGB channels. The final convolutional layer is followed with a sigmoid activation to force the pixel values to be between 0 and 1.
3.3 MAML Framework
MetaHDR uses the learn2learn PyTorch package, giving us confidence that the gradient adaptations and updates are implemented correctly. Given that each task consists of two LDR images for adaptation, we characterize the meta-learning problem as a 2-way 1-shot regression problem. We trained MetaHDR with a batch size of 5 tasks, for 200 meta-iterations. Task-specific adaptation was performed over 3 iterations per meta-iterations. The meta-learning learning rate was 0.005 and the task-specific adaptation learning rate was 0.01.
During meta-test time, adaptation can only occur if users have the ability to generate a plausible set of task-specific adaptation labels. For this purpose, we use an existing single-shot deep CNN based approach to HDR image reconstruction known as HDR-CNN . For this reason, the ground truth labels used in task-specific adaptation during meta-training are also generated using the pretrained HDR-CNN model. The impact of training in this manner was studied, and results are discussed in subsequent sections.
3.4 Loss Function
The loss function used balanced
loss with a penalty term for having a low cosine similarity. Theterm forces pixels to be numerically close to each other while the 1 - cosine similarity term forces pixels color similarity between the input and target image.
is the rgb-vector at the j-th pixel location for the i-th image andis the predicted rgb-vector at the j-th pixel location for the i-th image. Note also that the term is calculated for every pixel in every channel of the image and then averaged across the entire image.
We also experimented with using the VGG architecture based Learned Perceptual Image Patch Similarity (LPIPS) metric  as a loss function. LPIPS is a perceptual similarity metric that uses deep neural networks to capture the many nuances of human perception.
We applied our methodology to a held out meta-test set and report our findings here. The meta-test set consisted of 45 scenes of three LDR images and one ground truth HDR image. We evaluated on the model that had the highest meta-validation score during training. For quantitative evaluation, we used SSIM and PSNR values to compare the predicted HDR and the true HDR image. Capturing image similarity within a performance metric is a historically difficult task and is often use-case dependent. Our choice of SSIM and PSNR as performance metrics was based on their general applicability across many different applications.
4.1 Qualitative Results
Fig. 4 shows example single-shot outputs where we pass each meta-test image through our model without any adaptation at meta-test time.
Fig. 5 shows example adaptation outputs. For adaptation at meta-test time, we first simulate what an HDR image may look like using HDR-CNN . Then, for two of the three exposures, we adapt the task-specific parameters (from the meta-parameters) for the task at hand using the simulated labels for those two exposures. Finally, for the held out test image, we predict its corresponding HDR image.
In general, we see an improvement from single-shot to adaptation which is expected because the meta-parameters, , are specific to no nonlinear mappings and only encapsulate a general solution.
From a visual perspective, the images do fill in many saturated pixels correctly. For example, in the cabin in Fig. 3(a) and Fig. 4(a), the algorithm was able to fill in the over-exposed regions correctly. Additionally, for the dice in Fig. 3(b) and Fig. 4(b), the underexposed regions were filled in correctly. However, there are some imperfections. Although the methodology was able to keep the structure of the tree in Fig. 3(c) and Fig. 4(c), it was unable to recover the areas of the window in the background as well as the blue and gray color of the wall.
4.2 Quantitative Results
Evaluation metrics for MetaHDR using different labeling schemes for model adaptation at meta-train and meta-test time can be found in Table 1. Additionally, evaluation metrics for MetaHDR using various loss functions can be found in Table 2.
From Table 1, we observe more concretely that adaptation does produce quantitatively better HDR image reconstruction results. Comparing the use of ground truth HDR labels and the use of simulated HDR labels, we see that using simulated HDR labels during meta-training does not significantly hurt quantitative performance (see columns 2,3 and 4,5). Similarly, using simulated HDR labels during meta-test also results in comparable results to using ground truth labels for adaptation (see bottom two rows). These results reinforce the validity of our meta-test HDR label simulation approach.
|SSIM ()||PSNR (dB) ()|
|LDR No Recon.||0.489||12.200|
|Adaptation with True HDR||0.683||0.701||19.967||20.125|
|Adaptation with Simulated HDR||0.687||0.698||19.753||19.790|
Loss Function Results.
At the center of LDR-to-HDR image reconstruction is the question of how to quantitatively measure the similarity between two images. When defining our model, we performed multiple experiments to determine the best loss function to use from a short list of possible contenders (i.e. ExpandNet Loss, LPIPS, and -regularized LPIPS). Our results show that measuring image similarity using LPIPS as a loss function makes it difficult for the meta-learner to hone in on the common structure in LDR-to-HDR conversion (see Table 2). When using LPIPS out of the box, the meta-learner’s output after 200 meta-iterations reduces the overall quality of the generated HDR images. We also found that regularizing the LPIPS loss with loss led to some improvement relative to its vanilla counterpart. Interestingly, this improvement was only present when using the ground truth labels. Compared to the baseline LDR image metrics, both LPIPS loss based models fail to produce adequate quantitative results. We believe that the cause of this is the combination of SSIM as our performance metric and the use of LPIPS as a loss function. Namely, one of the arguments for using LPIPS is that it better captures structures important for human perception; something that SSIM does not attempt to do.
|SSIM ()||PSNR (dB) ()|
|LDR No Recon.||0.489||12.200|
Comparison to state-of-the-art.
Existing state-of-the-art single-shot deep learning approaches to HDR image reconstruction generally perform well both quantitatively and qualitatively. As a comparison, we evaluated the HDR-CNN pretrained model  on the same hidden test set and got a SSIM of 0.704 with PSNR of 18.072 dB. We found this to be comparable to the results we achieved with MetaHDR. One concern we have is the size and scope of the dataset we used. Namely, its small size and pre-partitioned labels were optimal for our purposes. However, there are many possible scenes that have not been represented. Still, we find it encouraging that our model, trained on this small dataset, is able to perform comparably to HDR-CNN, which was trained on a significantly larger and more diverse dataset.
In conclusion, our novel approach to data-driven HDR image reconstruction is capable of generating any nonlinear mapping specific to the scene in question. It is able to perform single-shot and few-shot HDR image reconstruction using conventional imaging equipment and achieve performance comparable to state-of-the-art deep learning pipelines for the images tested on.
The strong baseline single-shot performance of MetaHDR as well as its adaptability when given more exposures from a scene make its utilization uniquely intuitive. One would naturally expect that a model both perform well and perform better when given more data. Indeed, it is neither limited by the need for a wide range of exposures like existing heuristic driven methods nor limited to one single nonlinear mapping like existing data driven methods[4, 12].
5.2 Limitations and Challenges
Challenges with our model include color retention from input to output and the appearance of unwanted artifacts in the predicted HDR image. As shown in Fig. 6, our model was able to successfully recover the image. However, our model added artifacts in the windows which were not there originally. Interestingly, despite these artifacts, the example shown achieved an SSIM of 0.768 and a PSNR of 21.329 dB. This leads us to believe that these issues are more indicative of a need for better performance metrics / loss functions and less indicative of an issue with our meta-learning approach. Adjusting our model to remove artifacts and increase color retention will be especially challenging because these quantitative metrics still believe that the model is performing well.
5.3 Future Work
In the future, we would like to explore more loss functions that prioritize color saturation from input to output. This would help remove any artifacts from predicted HDR images as well as improve overall quality of the images. Additionally, we have seen other proposed loss functions specifically tailored for LDR-to-HDR conversion. For example, IRLoss  uses a weight matrix to force the model to adjust saturated pixels more significantly that non-saturated pixels. This could prove beneficial in giving the model a useful prior to build off of, and alleviate some of our model’s challenges.
Furthermore, we have already seen that there is a disconnect between what quantitatively constitutes a good reconstruction and what qualitatively presents itself as a good reconstruction. One avenue to explore is the use of better performance metrics (like LPIPS) which would ideally help us capture more important image similarity within the loss.
Finally, we were limited to using 450 scenes with three exposures per scene and one ground truth HDR image. We would like to find or collect a dataset with more scenes and/or more exposures in order to further improve our model.
This work was completed as a Final Project for EE 367 / CS 448I: Computational Imaging and Display at Stanford University. We would like to thank our professor, Dr. Gordon Wetzstein, for his valuable instruction throughout the quarter and our project mentor, Cindy Nguyen, for giving us useful insights.
-  (2020-08) Learn2learn: a library for Meta-Learning research. External Links: Cited by: §3.3.
-  (2017) Tone expansion using lighting style aesthetics. Computers & Graphics 62, pp. 77–86. Cited by: §2.
-  (2008) Recovering high dynamic range radiance maps from photographs. In ACM SIGGRAPH 2008 classes, pp. 1–10. Cited by: §2, Table 1, Table 2, §5.1.
-  (2017-11) HDR image reconstruction from a single exposure using deep cnns. ACM Transactions on Graphics 36 (6), pp. 1–15. External Links: Cited by: §2, §3.2, §3.3, §4.1, §4.2, Table 1, Table 2, §5.1, §5.3.
Model-agnostic meta-learning for fast adaptation of deep networks.
International Conference on Machine Learning, pp. 1126–1135. Cited by: §1.
-  (2020) Dynamic range expansion using cumulative histogram learning for high dynamic range image generation. IEEE Access 8, pp. 38554–38567. Cited by: §3.1.
Expandnet: a deep convolutional neural network for high dynamic range expansion from low dynamic range content. In Computer Graphics Forum, Vol. 37, pp. 37–49. Cited by: §3.4, §3.4.
-  (2020) Neural sensors: learning pixel exposures for hdr imaging and video compressive sensing with programmable sensors. IEEE Transactions on Pattern Analysis and Machine Intelligence. Cited by: §2.
-  (2020) Deep optics for single-shot high-dynamic-range imaging. In , pp. 1375–1385. Cited by: §2.
-  (2000) High dynamic range imaging: spatially varying pixel exposures. In Proceedings IEEE Conference on Computer Vision and Pattern Recognition. CVPR 2000 (Cat. No.PR00662), Vol. 1, pp. 472–479 vol.1. External Links: Cited by: §2.
-  (2015) U-net: convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pp. 234–241. Cited by: §3.2.
-  (2020-07) Single image hdr reconstruction using a cnn with masked features and perceptual loss. ACM Transactions on Graphics 39 (4). External Links: Cited by: §2, §5.1.
The unreasonable effectiveness of deep features as a perceptual metric. In CVPR, Cited by: §3.4.