# Effects of Hybridizing the U-Net Neural Network in Traffic Lane Detection Process
## 2 Materials and Methods
### Hybrid U-Net Architecture  
The proposed architecture, called hybrid U-Net (with the architecture shown in Figure 5), represents a significant extension of the classic U-Net model, addressing its limitations in capturing global relationships, adaptability to scale variations, and sensitivity to geometric structures. The model is built on a U-Net-specific encoder-decoder scheme but adds a series of specialized attention and geometric processing modules to its path. In the encoding branch, the model uses GSC (geometrical skip connections) modules, which include geometric positional mapping of the image, generating perspective weight in favor of lower regions. These connections introduce a dynamic distance map, which allows the model to be more robust to perspective variations, essential in the process of lane line detection. Figure 4: Structure and functionality of the U-Net architecture: (**a**) general architecture and information transfer paths; (**b**) structure of the pooling blocks; (**c**) structure of the convolution blocks (adapted from [29]). The integration of the transformer encoder (TE) in skip connection addresses the fundamental challenge of capturing long-range spatial dependencies essential for lane detection. The TE is strategically placed at the deepest skip connection (c4 level) where spatial dimensions are reduced, making the computational complexity manageable (Figure 6). The implementation uses four attention heads with 32 key dimensions, enabling simultaneous capture of different spatial relationships. The spatial dimensions are flattened (H \(\times\) W \(\rightarrow\) sequence length) to apply self-attention across all spatial positions, allowing the model to connect distant lane segments interrupted by occlusions. The TE block incorporates pre-normalization and residual connections, following the standard transformer architecture. A two-layer MLP with ReLU activation processes attention output, expanding to 256 dimensions before projecting back to the original channel size, enabling complex feature transformations. In the decoding branch, attention modules are used in intermediate skip connections to dynamically adjust the importance of channels and spatial regions. Attention modules allow the model to focus on relevant areas in the image, thus improving segmentation. At the highest resolution level, the hybrid U-Net model uses a dedicated multi-scale lane line detection (MSLDM) module. This module employs two categories of kernels:  
* Vertical kernels (7 \(\times\) 1, 6 \(\times\) 2, 5 \(\times\) 3) capture lane boundaries and vertical structures;
* Horizontal kernels (1 \(\times\) 7, 2 \(\times\) 6, 3 \(\times\) 5) focus on curved lines. All feature maps are concatenated and processed through a 3 \(\times\) 3 convolution, followed by sigmoid activation to generate attention weights that modulate the input features. An important aspect of this new proposed architecture is the balance between performance and computational efficiency, maintaining reasonable values of the performance parameters with a competitive inference time. By integrating specialized modules, the  
Figure 5: Hybrid U-Net network architecture (GSC—geometrical skip connection, SAM—spatial attention module, MSLDM—multi-scale detection module, TE—transformer encoder). Figure 6: Transformer encoder structure and codification process. proposed architecture combines local and global learning, ensuring generalization on diverse data. By integrating a spatial geometric attention module (Figure 7) and a multi-scale feature extraction module, the proposed hybrid U-Net model addresses certain limitations of classical CNNs in the specific context of lane detection, particularly by enhancing geometric sensitivity and capturing context at multiple spatial scales. This makes the model well-suited for advanced driver assistance systems (ADASs) that rely on precise lane interpretation.