## 3 The Methods
### Gated Positional Attention  
Attention mechanisms commonly used in visual tasks--such as SE-Net [42], CBAM [43], PSANet [44], and Gated Convolutional Networks [45]--have demonstrated the effectiveness of gating and spatial/channel attention for feature enhancement. However, these methods are not tailored to handle the instability of glare positions and the intense regional interference commonly found in nighttime road scenes.  
To address these limitations, we propose a gated positional attention (GPA) module specifically designed for nighttime glare suppression. Unlike conventional attention modules that focus on channel reweighting or global spatial enhancement, GPA explicitly integrates positional encoding into the spatial attention process to improve the model's sensitivity to glare locations. It combines parallel depthwise separable and dilated convolutions to capture multi-scale local context, and employs a gating mechanism to filter out glare-dominated regions. This design improves visibility and detail restoration under complex nighttime lighting. An overview of the GPA module is shown in Figure 4.  
Firstly, based on the spatial dimensions \(H\) and \(W\) of the input feature map, a fixed normalized positional encoding is constructed, which can be expressed as follows:  
\[P=\text{Concat}(\text{linspace}(-1,1,H),\text{linspace}(-1,1,W)) \tag{12}\]  
Figure 4: The structure of gated positional attention.  
where \(\text{linspace}(-1,1,\text{H})\) denotes a linear sequence of length H along the vertical direction to generate normalized row position coordinates, while \(\text{linspace}(-1,1,\text{W})\) denotes a linear sequence of length W along the horizontal direction to generate normalized column position coordinates. \(P\in\mathbb{R}^{2\times\text{H}\times\text{W}}\) represents the positional embedding matrix, providing normalized spatial positional information for the network, where \(H\) and \(W\) represent the height and width of the input feature map, respectively.  
The positional encoding \(P\) is concatenated with the input features \(X\) to obtain \(X_{p}\) which can be formulated as follows:  
\[X_{p}=\text{Concat}(X,P) \tag{13}\]  
where \(\text{Concat}(\cdot)\) denotes concatenation along the channel dimension.  
Subsequently, a \(1\times 1\) convolution is employed for dimensionality reduction:  
\[X_{r}=\text{Conv}_{1\times 1}\big{(}X_{p}\big{)},X_{r}\in\mathbb{R}^{B\times \frac{r}{r}\times H\times W} \tag{14}\]  
where \(B\) denotes batch size, \(C\) is the number of channels, and \(r\) is the reduction ratio.  
Next, standard depthwise separable convolution is used to capture local contextual information. In nighttime glare removal scenarios, there often exist large regions of blur and overexposure; thus, dilated convolution is employed to capture local contextual features, background, and structural information over a wider receptive field. To this end, depthwise separable convolution DWConv and dilated depthwise separable convolution DDWConv are applied in parallel to extract local contextual features, and the outputs are concatenated and fused using an additional \(1\times 1\) convolution; these can be denoted as follows:  
\[X_{d}=\text{DWConv}_{3\times 3}(X_{r}) \tag{15}\]  
\[X_{k}=\text{DDWConv}_{3\times 3}(X_{r}) \tag{16}\]  
\[X_{f}=\text{Conv}_{1\times 1}(\text{Concat}(X_{d},X_{k})),X_{f}\in\mathbb{R}^{B \times\mathbb{C}\times H\times W} \tag{17}\]  
Finally, a Sigmoid gating branch is utilized to generate the gating weight G, which adaptively predicts the importance weights from the input features for dynamic control of the fusion ratio between the input features and the context-enhanced features. Using this gating fusion mechanism, the output can be formulated as follows:  
\[G=\sigma(\text{Conv}_{1\times 1}(X)) \tag{18}\]  
\[Y=X\odot\text{G}+X_{f}\odot(1-G) \tag{19}\]  
where \(G\) denotes the gating weight, \(\sigma\) represents the Sigmoid activation function, and \(\odot\) denotes element-wise multiplication.