# GCBAM-UNet: Sun Glare Segmentation Using Convolutional Block Attention Module
## 3 Proposed Method
### U-Net Architecture  
The U-Net architecture is a type of Convolutional Neural Network (CNN) primarily used for image segmentation tasks [18]. It is a U-shaped encoder-decoder network that includes four encoder blocks and four decoder blocks, linked by a bottleneck. In the encoder part, also referred to as the contracting path (i.e., the left side), U-Net captures the context of the image in the input. This path includes a sequence of convolutional layers, each paired with a rectified linear unit (ReLU) and followed by a max-pooling operation for downsampling, resembling a standard CNN architecture. Let \(X\in\mathbb{R}^{H\times W\times C}\) represent the input image with height \(H\), width \(W\), and \(C\) channels.  
In the encoder path, each convolutional layer applies a filter \(f\), with learnable weights \(W_{f}\) and biases \(b_{f}\). The output \(Z^{(l)}\) for each convolution layer is calculated in Equation (1):  
\[Z^{(l)}=\sigma(W_{f}^{(l)}*X^{(l-1)}+b_{f}^{(l)})\;, \tag{1}\]  
Figure 2: Our proposed GCBAM-UNet model.  
where  
* \(Z^{(l)}\): is the feature map at layer \(l\),
* \(X^{(l-1)}\): in the input to layer \(l\),
* \(*\) represents the convolution operation,
* \(\sigma\) is the activation function (ReLU).  
After convolution, max-pooling is applied to downsample feature maps:  
\[X^{(l)}=Max-pooling(Z^{(l)}). \tag{2}\]  
The bottleneck acts as the link between the contracting path and the expansive path. It consists of a series of convolutional layers with a large number of filters, capturing the most abstract features of the image. Likewise, in the decoder network (i.e., the right side), U-Net reconstructs the image from the abstract features captured in the bottleneck. This path consists of a series of upsampling operations followed by convolutional layers. To upsample the feature maps, the U-Net architecture used Equation (3):  
\[X^{(l)}_{up}=\sigma(W^{(l)}_{t}\star X^{(l)}+b^{(l)}_{t}), \tag{3}\]
* \(W^{(l)}_{t}\) and \(b^{(l)}_{t}\) are the transposed convolution weights and biases,
* \(\star\) is the transposed convolution operation.  
Also, skip connections are a crucial component of the U-Net architecture. They create direct connections between corresponding layers in the contracting and expansive paths. These connections help in retaining the spatial information that might be lost during the downsampling process.  
Skip connections allow the architecture to retain high-resolution information that is essential for detecting the fine structures and edges critical in sun glare segmentation. They help the architecture more accurately delineate boundaries between glare and non-glare regions, reducing the risk of blurred or inaccurate boundaries that might otherwise be caused by downsampling in the encoder path. Also, the combination of high-level contextual information from the deeper layers with spatial details from shallower layers allows U-Net to generate highly precise segmentation outputs. This is especially helpful in distinguishing glare from other light sources or bright reflections, as the model can make use of both global and local contexts.