# Dual-Branch Luminance-Chrominance Attention Network for Hydraulic Concrete Image Enhancement
## 3 Methods
### Loss Function  
In our approach, a hybrid loss function was designed to train the DBLCANet-HCIE model, which was obtained by weighting the luminance branch loss, the chrominance branch loss, and the luminance-chrominance fusion loss. The overall loss formula is as follows:  
\[\mathbf{\mathcal{L}}_{total}=\mathbf{\mathcal{L}}_{YCbCr}+\alpha_{1}\mathbf{\mathcal{L}}_{ Y}+\alpha_{2}\mathbf{\mathcal{L}}_{CbCr} \tag{8}\]  
where \(\mathbf{\mathcal{L}}_{Y}\) and \(\mathbf{\mathcal{L}}_{CbCr}\) X1 and X2 are used to optimize the LAB and CRB, respectively \(\mathbf{\mathcal{L}}_{YCbCr}\) is the loss function optimized by the YCBCR image enhancement model. \(\alpha_{1}\) and \(\alpha_{2}\) are hyperparameters that balance the contributions of \(\mathbf{\mathcal{L}}_{Y}\) and \(\mathbf{\mathcal{L}}_{CbCr}\). After extensive experimentation, the optimal values for \(\alpha_{1}\) and \(\alpha_{2}\) were set to 0.15, as this combination yielded the most favorable trade-off between training stability and enhancement performance.  
To address the challenges of hydraulic concrete image enhancement, including defect visibility improvement and surface texture preservation, \(\mathbf{\mathcal{L}}\) synergistically combines the structural similarity (SSIM) loss, edge-aware loss, and Charbonnier loss. It is expressed as follows:  
\[\mathbf{\mathcal{L}}=\beta_{1}\mathbf{\mathcal{L}}_{SIM}+\beta_{2}\mathbf{\mathcal{L}}_{ Charb}+\beta_{3}\mathbf{\mathcal{L}}_{edge} \tag{9}\]  
where \(\beta_{1}\), \(\beta_{2}\), and \(\beta_{3}\) are weight hyperparameters reflecting the contribution degrees of each sub-loss. After extensive experimentation, the optimal values for \(\beta_{1}\), \(\beta_{2}\), and \(\beta_{3}\) were set to 0.6, 0.3, and 0.1, respectively, as this combination yielded the most favorable trade-off between training stability and enhancement performance.  
The SSIM loss preserves the global structural consistency between enhanced and reference images through luminance, contrast, and pattern comparisons within local windows. The SSIM [47] is calculated as follows:  
\[\text{SSIM}\left(\hat{I},I_{G}\right)=\frac{(2\mu_{I}\mu_{I_{G}}+C_{1})(2 \sigma_{I_{G}}+C_{2})}{(\mu_{I}^{2}+\mu_{I_{G}}^{2}+C_{1})(\sigma_{I}^{2}+ \sigma_{I_{G}}^{2}+C_{2})} \tag{10}\]  
where \(\hat{I}\) and \(I_{G}\) are the recovered image and ground-truth image, \(\mu_{\hat{I}}\) and \(\mu_{I_{G}}\) are the average values for image \(\hat{I}\) and image \(I_{G}\) within local windows, \(\sigma_{\hat{I}}\) and \(\sigma_{I_{G}}\) are the variances of image \(\hat{I}\) and image \(I_{G}\), \(\sigma_{I_{G}}\) denotes the covariance between image \(\hat{I}\) and image \(I_{G}\), and \(C_{1}\) and \(C_{2}\) are two fixed small constants to avoid division by zero. The SSIM loss [48] is calculated as follows:  
\[\mathbf{\mathcal{L}}_{SIMM}=1-\text{SSIM}\left(\hat{I},I_{G}\right) \tag{11}\]The Charbonnier loss [49] serves as a noise-resilient alternative to conventional L1 norms, combining the advantages of gradient stability and outlier robustness. Its formulation is as follows:  
\[\mathcal{L}_{\text{Charbonnier}}=\frac{1}{CHW}\sum_{c=1}^{C}\sum_{i=1}^{H}\sum_{ j=1}^{W}\sqrt{\left(\tilde{I}^{c,ij}-I_{\text{G}}^{c,ij}\right)^{2}+\epsilon^{2}} \tag{12}\]  
where \(\epsilon\) ensures continuous gradients while maintaining robustness to the sensor noise and compression artifacts prevalent in field-captured concrete images. \(\epsilon\) was set to 0.001.  
To explicitly enforce edge consistency between enhanced and reference images, we propose a gradient alignment loss based on Sobel operators. Its formulation is as follows:  
\[\mathcal{L}_{edge}=\frac{1}{HW}\sum_{i=1}^{H}\sum_{j=1}^{W}\sqrt{\left(\
abla _{x}\tilde{I}^{ij}-\
abla_{x}\tilde{I}_{\text{G}}^{i}\right)^{2}+\left(\
abla _{y}\tilde{I}^{ij}-\
abla_{y}\tilde{I}_{\text{G}}^{i,j}\right)^{2}+\epsilon^{2}} \tag{13}\]  
where \(\
abla_{x}\) and \(\
abla_{y}\) represent the horizontal and vertical gradient operators, respectively. \(\epsilon\) was again set to 0.001.