# An Object Detection Method Based on Feature Uncertainty Domain Adaptation for Autonomous Driving
## 3 Domain Adaptation Object Detection Based on Feature Uncertainty
### Fua  
As shown in Figure 2, the feature maps of the source domain image \(X_{S}\) and the target domain image \(X_{T}\) obtained through the feature extraction network are input into a local discriminator \(D_{img}\). This local discriminator needs to classify each pixel of the feature map and give the probability that the pixel is from the target domain. Conversely, the goal of local image-level alignment is to keep the source domain feature \(F(x_{i}{}^{S})\) and the target domain feature \(F(x_{i}{}^{T})\) obtained through the feature extraction network consistent so that the local discriminator \(D_{img}\) cannot identify whether the feature comes from the source domain or the target domain. To achieve this mutual adversarial goal, a gradient reversal layer (GRL) is added between the feature extraction network and the local discriminator, which acts as identity mapping during forward propagation and is used to reverse the gradient during backward propagation. After being affected by rain and fog noise, not every region in the source domain image experiences significant feature distribution shift. Through training in the source domain, the feature extraction network can learn the unique feature representation of the source domain, resulting in more informative feature maps. The amount of information obtained in different regions with varying degrees of uncertainty also varies, which reflects the degree of domain shift between different regions in the image. To characterize these differences in the degree of shift, a feature channel entropy calculation method is proposed:  
\[\mathcal{E}^{C}=-\sum_{r}O_{r,u,v}^{C}\cdot\log(O_{r,u,v}^{C}) \tag{5}\]  
\[ \begin{split}[O_{1,u,v}^{C},O_{2,u,v}^{C}&\dots,O_{ R,u,v}^{C}]=\text{Softmax}(\mathbf{f}_{\mathbf{r},\mathbf{u},\mathbf{v}})\\ &\mathbf{f}_{\mathbf{r},\mathbf{u},\mathbf{v}}=[f_{1,u,v},f_{2,u, v}^{*},\dots f_{R,u,v}]\end{split}  \tag{6}\]  
where \(f_{r,u,v}\) refers to the feature value at \(r_{th}\)\((u,v)\) of feature map, \(r\in[1,R],u\in[1,U]\), \(v\in[1,V]\). In Figure 3, the feature channel entropy of the feature vector at each pixel position in the feature map represents the uncertainty of the corresponding features in the original image's receptive field. After training on the source domain, the feature extraction network will extract more effective information, resulting in more differentiation between the elements of the feature vector and a larger result for the feature channel entropy. Conversely, in the absence of training on target domain data, the feature channel entropy will be smaller due to the blurring of texture information in the entire image caused by rainy or foggy weather. Domain adaptation tasks aim to capture domain inconsistencies across different stages of the model. As shown in Figure 4, for regression tasks, the coordinate points of the target bounding boxes lie in continuous space. To represent the inconsistency in the results obtained from the source and target domains, additional \(K\) parallel sub-regressors are proposed. Each sub-regressor uses the same network structure, and the randomness of each regressor is achieved through Dropout, resulting in \(K\) different sets of regression results. For objects from the source domain, the results of all sub-regressors should be close to the ground truth bounding box, with small differences between the coordinate points of the predicted bounding boxes. Conversely, objects from the target domain introduce more uncertainty, resulting in relatively large differences between the coordinate points of the bounding boxes. This difference represents the inconsistency of the model between the two domains. Therefore, reducing this inconsistency guides the model to adapt to the target differences between the two domains. A standard-deviation-based inconsistency loss was proposed in [24], but the standard deviation varies with the scale of the data. Under the same error ratio, the loss for small targets is smaller than that for large targets.