# HSVNet: Reconstructing HDR Image from a Single Exposure LDR Image with CNN
## 3 Method
### Mask  
One of our main objectives is to infer color details in over/underexposed regions from the LDR image. It is essential to understand the characteristics of saturated regions in the HSV color space. \(H\) is relatively irrelevant for finding saturated pixels since the over/underexposed regions hold little information on the hue of the color. Therefore, we design a mask with \(S\) and \(V\) values that can separate saturated regions and unsaturated regions. We consider saturated areas to have the following characteristics: saturated areas have small \(S\) and high or low \(V\) (see Figure 7). We first build a saturation mask \(M_{d}\) to differentiate between high saturation values and a value mask \(M_{u}\) to distinguish bright and dark values. Then, we combine them into the final mask, \(M_{f}\), as shown in Equation (9):  
\[M_{d} =\left(\frac{c}{x_{s}+c}\right)^{s^{\prime}} \tag{7}\] \[M_{u} =4(1-v_{min})(x_{v}-0.5)^{2}+v_{min}\] (8) \[M_{f} =M_{d}M_{u} \tag{9}\]  
Figure 5: (**a**) Hue plane in a hexagonal model. (**b**) Loss function for the H channel (\(L_{h}\)) where \(x=d_{h}(H_{1},H_{2})\). where \(x\) is input image, \(x_{s}\) and \(x_{v}\) are input image's \(S\) and \(V\), values respectively, and \(c\), \(s^{\prime}\), and \(v_{min}\) are parameters for the mask. For the saturation mask \(M_{d}\), the weight is inversely proportional to the pixel's \(S\) value, which means a pixel has a higher weight for a lower \(S\) (see Figure 8). The weight for the saturation mask is determined by adjusting \(c\) and \(s^{\prime}\). The weight is always 1 for the smallest \(S\), when \(x_{s}=0\). Increasing \(c\) allows a more gradual descent of \(M_{d}\), where high \(S\) pixels are not sifted much. Increasing \(s^{\prime}\) results in a more curved and steeper function. Therefore, the network focuses more on the low saturated regions with smaller \(c\) and bigger \(s^{\prime}\). For the value mask \(M_{u}\), a function is U-shaped between 0 and 1, where a pixel has a higher weight as \(V\) approaches two borders, 0 and 1, as shown in Figure 8. \(v_{min}\in[0,1]\) determines the weight for the value mask. The weight is 1 for the smallest and the biggest value, when \(x_{v}=0\) and \(x_{v}=1\). Since lower \(v_{min}\) makes the lower midpoint of \(M_{u}\), the network focuses more on bright or dark areas with lower \(v_{min}\). By the experiments on different parameters for the mask, in ranges \(s^{\prime}\in[1,15]\), \(c\in[0.5,1.5]\), and \(v_{min}\in[0.1,0.9]\), we use \(s^{\prime}=1.0\), \(c=1.0\), and \(v_{min}=0.7\) in this paper. Then, we use \(M_{f}\) for \(S\) and \(V\) masks, \(M_{s}=M_{v}=M_{f}\), and \(1-M_{f}\) for \(H\), \(M_{h}=1-M_{f}\). The mask applied to our proposed loss function is as follows. \[L_{h} =\frac{1}{N}{\sum(1-M_{f})Min(6d_{h}(g_{h},y_{h}),1)} \tag{10}\] \[L_{s} =\frac{1}{N}{\sum M_{f}|}{\hat{y}_{s}-y_{s}|}\] (11) \[L_{v} =\frac{1}{N}{\sum M_{f}|}{\hat{y}_{v}-y_{v}|} \tag{12}\]  
We suppress the influence of the \(H\) channel on the saturated regions when learning the network since Hue is unreliable in these regions. Therefore, we use the inverted \(M_{f}\) for the mask of hue, \(M_{h}=1-M_{f}\). Figure 9 shows that the predicted HDR images could have local artifacts when the identical mask is applied to all \(H\), \(S\), and \(V\) channels. Figure 6: Result images with and without masks. As shown in Figure 6, the result tends to be similar to the input image when mask is not applied. Additionally, when the same mask is applied to \(H\), \(S\), \(V\), many results show artifacts (second column of Figure 9). Table 1 shows that the result with the inverted mask performs better than the result with no mask or with the identical mask. We adopt 4 full-reference metrics to compare the performances of loss functions: L1 loss (Mean Absolute Error) [36], HDR-VDP-2.2 Q score [37], PU21-PSNR [38], and PU21-SSIM [38]. The HDR-VDP Q score suggested by [PERSON] et al. is a visual metric especially for HDR images.