# Advancing Nighttime Object Detection through Image Enhancement and Domain Adaptation
## 3 Methodology
### Consistency Learning  
Due to the cross-domain nature of the learning process, there exists a significant gap between source and target domain images, hindering the teacher's ability to perform its tasks effectively. This phenomenon is prevalent throughout the network, particularly in challenging areas such as low light, glare, and flare. However, the teacher network tends to produce high-confidence labels that correspond to daytime features, gradually biasing towards daytime characteristics. This cyclical process results in the teacher generating simple samples with daytime attributes, thereby preventing the student from learning from more challenging areas. Due to the limited understanding of positive samples, the teacher starts predicting highly confident but false-positive pseudo-labels. When the teacher provides these false-positive pseudo-labels to the student, a negative feedback loop begins, causing the teacher to subsequently update with incorrect knowledge. Consequently, errors propagate and accumulate throughout the training process. Our study shows that these errors are particularly pronounced in areas with nighttime features and small objects. To address this issue, we designed a consistent learning approach. This approach allows for the coexistence of high-confidence and low-confidence pseudo-labels [6; 20; 48]. The teacher first predicts pseudo-labels from the unlabeled nighttime images. These pseudo-labels are filtered through a predefined confidence threshold, retaining only those with confidence higher than this threshold as the high-confidence pseudo-label set. At the initial stage, the confidence threshold was determined experimentally, with the initial value selected based on our performance on the validation set. A higher confidence threshold helps ensure the accuracy of the retained pseudo-labels, thereby reducing the risk of error propagation. As the model's capability improves, the threshold can be gradually lowered, allowing the model to access a more diverse set of data samples, including those with lower confidence. Moreover, low-confidence pseudo-labels are not discarded; instead, at the initial stage, they are assigned a very low weight and continue to participate in the training process. As the model's performance improves, the weight of low-confidence labels can be gradually increased, allowing the model to better manage complex nighttime scenes. The bounding boxes of the pseudo-labels are then used as input for the student network. These bounding boxes are merged with the candidate boxes generated by the student's RPN module to form new candidate boxes:  
\[CB_{p}=RPN_{student}\ \cup\ B_{p} \tag{2}\]  
Here, \(CB_{p}\) represents the combined candidate boxes, which are then sent to the RoI module to predict the category (\(C_{student}\)) and the corresponding bounding box (\(B_{student}\)) of each candidate. Next, the same candidate boxes \(CB_{p}\) are used as input for the teacher's RoI module, which, through regression, generates the pseudo-label information:  
\[\{C_{s},\ B_{s}\}=Rol_{teacher}\big{(}CB_{p}\big{)} \tag{3}\]  
The fully connected layer (FC) then obtains feature maps from the ROI Pooling, flattening them into a one-dimensional vector x. A weight matrix \(W\) and a bias vector \(b\) are applied to compute the linear transformation \(Z\). The result \(z\) of the linear transformation is passed through an activation function, yielding the output \(Y\) after the nonlinear transformation. \[Z=W_{x}+b \tag{4}\]  
Our fully connected layer (FC) contains two fully connected layers, denoted as FC1 (Equation (5)) and FC2 (Equation (6)). The computation for each fully connected layer is as follows:  
\[Z_{1}=W_{1}x+b_{1} \tag{5}\]  
\[Y_{1}=MAX(0,Z_{1}) \tag{6}\]  
The feature vector output from the fully connected layer (FC) is sent to two different branches for different tasks.