# Advancing Nighttime Object Detection through Image Enhancement and Domain Adaptation
## 4 Discussion
### Evaluation Indicators  
In this study, we evaluate the models using AP, API, APm, and APs. These metrics reflect the average precision, large object precision, medium object precision, and small object precision, respectively. AP measures the overall accuracy of the model in predicting positive classes, with higher values indicating a better capability to capture positive samples. AP is one of the primary evaluation metrics used in object detection tasks, as it reflects the model's accuracy across multiple categories. An increase in AP indicates improved detection performance across all categories. We use the strictest metric by default, setting all IoU (Intersection over Union) thresholds to 0.5:0.95. Calculating the average AP over IoU thresholds from 0.5 to 0.95 (with intervals of 0.05) allows for a more accurate assessment of the model's overall performance under different IoU conditions. API: Large objects with an area greater than 96 \(\times\) 96 pixels. APm: Medium objects with an area between 32 \(\times\) 32 and 96 \(\times\) 96 pixels. APs: Small objects with an area less than 32 \(\times\) 32 pixels. The following formulas demonstrate how different metrics are calculated:  
\[AP=\frac{TP+TN}{TP+TN+FP+FN} \tag{17}\]  
\[API,APm,APs=\frac{1}{n}\int_{0}^{1}p_{i}(r) \tag{18}\]  
True Positives (TP) represent the number of positive samples correctly predicted as positive. False Positives (FP) represent the number of negative samples incorrectly predicted as positive. False Negatives (FN) represent the number of positive samples incorrectly predicted as negative. True Negatives (TN) represent the number of negative samples correctly predicted as negative.  
In the image enhancement comparison experiment, we employed three scoring criteria: PSNR, SSIM, and LPIPS, which represent peak signal-to-noise ratio, structural similarity, and learned perceptual image patch similarity, respectively. For PSNR and SSIM, higher values indicate better performance. For LPIPS, lower values are preferred. Their calculation methods are detailed as follows:  
\[PSNR=20\cdot\log_{10}\frac{MAX_{I}}{\sqrt{MSE}} \tag{19}\]  
\begin{table}
\begin{tabular}{c c} \hline
**Parameters** & **Configuration** \\ \hline CPU & Intel Xeon Gold 5320 @ 2.20 GHz \\ GPU & RTX A4000(16 GB) \(\times\)3 \\ System & Ubuntu 20.04 \\ Deep learning architecture & PyTorch1.11.0 + Python 3.8 + Cuda11.3 \\ Training Epochs & 60,000 \\ Batch size & 12 \\ exponential moving average (EMA) & 0.999 \\ Base & 0.04 \\ threshold & 0.8 \\ \hline \end{tabular}
\end{table}
Table 1: Environment and parameterization of the experiment.  
MAX\({}_{\text{I}}\) represents the maximum value of the image pixels, while MSE denotes the mean squared error between the original image and the compressed image.  
\[SSIM(x\,,\,y)=\frac{\left(2\mu_{x}\mu_{y}\,+C_{1}\right)\left(2\sigma_{xy}+C_{2 }\right)}{\left(\mu_{x}^{2}+\mu_{y}^{2}+C_{1}\right)\left(\sigma_{x}^{2}+\sigma _{y}^{2}+C_{2}\right)} \tag{20}\]  
where \(\mu_{x}\) and \(\mu_{y}\) are the mean values of image blocks x and y, \(\sigma_{x}^{2}\) and \(\sigma_{y}^{2}\) are the variances of image blocks x and y, and \(\sigma_{xy}\) is the covariance of image blocks x and y.  
C\({}_{\text{1}}\) and C\({}_{\text{2}}\) are small constants used to stabilize the denominator, \(C_{1}=\left(K_{\text{I}}\text{L}\right)^{2}\), \(C_{2}=\left(K_{\text{2}}\text{L}\right)^{2}\), where \(K_{\text{1}}\) = 0.01 and \(K_{\text{2}}\) = 0.03; L represents the dynamic range of pixel values.  
\[LPIPS(x\,,\,y)=\sum_{l}\omega_{l}\cdot d_{l}(\phi_{l}(x),\,\phi_{l}(y)) \tag{21}\]  
\(\phi_{\text{I}}(x)\) and \(\phi_{\text{I}}(y)\) represent the features of images x and y at the lth layer, d\({}_{\text{I}}\) denotes the L2 distance between the features, and \(\omega_{\text{I}}\) is the weight assigned to each layer's features. By integrating these three mainstream indicators, we can objectively assess the quality of the LightImg module.