# Improved Retinex-Theory-Based Low-Light Image Enhancement Algorithm
## 3 Proposed Method
### Loss Function  
To further improve the decomposition and enhancement effects, this paper adopts a series of loss functions. We will describe each of these loss functions in detail.  
The decomposition loss function \(L_{Decom}\) consists of three components: the reconstruction loss, the reflectance component consistency loss, and the illumination smoothness loss. The formula for the decomposition loss function is as follows:  
\[L_{Decom}=L_{re}+\lambda_{1}L_{r}+\lambda_{2}L_{i} \tag{1}\]  
Figure 5: Structure of the Decom-Net.  
Figure 6: Structure of the Enhance-Net.  
where \(L_{re}\) denotes reconstruction loss, \(L_{r}\) denotes reflection component consistency loss, and \(L_{i}\) denotes illumination smoothness loss. \(\lambda_{1}\) and \(\lambda_{2}\) denote the coefficients of reflection component loss and illumination component loss, respectively.  
Based on the decomposition of the low-light image into illumination and reflectance maps, as well as the illumination and reflectance maps of a normal-light image, this paper proposes the following formula for image reconstruction:  
\[L_{re}=\lambda_{3}\sum\limits_{i=1}^{N}\parallel R_{n}\circ I_{l}-S_{l} \parallel_{1}+\lambda_{4}\sum\limits_{i=1}^{N}\parallel R_{l}\circ I_{n}-S_{n }\parallel_{1}+\sum\limits_{i=1}^{N}\parallel R_{l}\circ I_{l}-S_{l} \parallel_{1}+\sum\limits_{i=1}^{N}\parallel R_{n}\circ I_{n}-S_{n} \parallel_{1} \tag{2}\]  
where \(\lambda_{3}\) and \(\lambda_{4}\) represent their respective coefficients. \(S_{n}\), \(S_{l}\), \(R_{n}\), \(I_{n}\), \(R_{l}\), and \(I_{l}\) represent the normal-light image, low-light image, reflection and illumination maps of the normal-light image, and reflection and illumination maps of the low-light image, respectively.  
The reflection component consistency loss is defined as follows:  
\[L_{r}=\parallel R_{l}-R_{n}\parallel_{1} \tag{3}\]  
The illumination smoothness loss is a minimization model that weights the gradient of the reflectance map, and its expression is as follows:  
\[L_{i}=\sum\limits_{i}\parallel\
abla I_{i}\circ\exp\left(-\lambda_{g}\
abla R _{i}\right)\parallel_{1} \tag{4}\]  
where \(\
abla\) denotes the horizontal and vertical gradients of the image, and \(\lambda_{g}\) is the balance coefficient.  
The enhancement loss function consists of the relighting loss and the color constancy loss, which are expressed as follows:  
\[L_{En}=L_{light}+\lambda_{5}L_{col} \tag{5}\]  
where \(L_{En}\) denotes enhancement loss, \(L_{col}\) denotes color constancy loss, and \(\lambda_{5}\) is the coefficient of noise reduction loss and color constancy loss.  
\[L_{light}=\parallel R_{l}*\hat{I}-S_{n}\parallel_{1} \tag{6}\]  
where \(\hat{I}\) is the output of the Enhance-Net.  
The color constancy loss is based on the assumption of the grey world color constancy theory, which assumes that the average color of each sensor channel in an image is gray. The goal of the color constancy loss process is to eliminate any biases that may appear in the enhanced image. The equation for the color constancy loss is as follows:  
\[L_{col}=\sum_{\forall(P,Q)\in Y}(T^{p}-T^{q})^{2},Y\in\{(R,G),(R,B),(G,B)\} \tag{7}\]  
where \(T^{p}\) denotes the average intensity value of the \(p\) channels in the enhanced image method.