# ETAFHrNet: A Transformer-Based Multi-Scale Network for Asymmetric Pavement Crack Segmentation
## 3 Methods
### Efficient Hybrid Attention Transformer (EHAT) Module  
This module takes an input feature map of shape \(B\times C\times H\times W\), where \(B\) denotes the batch size, \(C\), the number of channels, and \(H\) and \(W\), the height and width, respectively. To preserve the linear structural features of cracks while reducing computational complexity, the Efficient Hybrid Attention Transformer (EHAT) employs a series of optimization strategies, including adaptive channel reduction [46], axial enhancement, and local window attention [47]. An overview of the EHAT module's architecture is presented in Figure 3.  
A \(1\times 1\) convolution reduces the input channels from \(C\) to \(C^{\prime}=(C_{r}-c)/r\), where \(r\) is the reduction ratio, \(C_{r}\) the base number of reduced channels, and \(c\) a learnable channel  
Figure 3: The Efficient Hybrid Attention Transformer (EHAT) Module. Figure 2: The ETAFhrNet architecture. bias. Spatial downsampling via bilinear interpolation, with a ratio of \(s\), yields dimensions \(H^{\prime}=H/s\) and \(W^{\prime}=W/s\), thereby compressing both spatial and channel dimensions to alleviate the computational burden. Axial positional encoding is subsequently applied to independently enhance features along the horizontal and vertical axes, introducing directional priors well suited for representing elongated crack structures. \[F_{\text{axial}}=\text{Concat}(F_{h}+P_{h},F_{p}+P_{p}) \tag{1}\]  
The downsampled feature map is partitioned into two components, \(F_{h}\) and \(F_{v}\), corresponding to horizontal and vertical orientations. Learnable positional parameters \(P_{h}\) and \(P_{v}\) are added to each, after which, the results are concatenated via Concat(). This axial positional encoding introduces explicit directional cues, enhancing the model's capacity to identify and preserve linear crack features. To balance computational efficiency with structural sensitivity, EHAT employs local attention within each axis, enabling efficient modeling of elongated patterns without incurring the overhead of full self-attention. \[\text{Attention}(Q,K,V)=\text{Softmax}\bigg{(}\frac{QK^{T}}{\sqrt{d_{k}}} \bigg{)}V \tag{2}\]  
Here, \(Q\), \(K\), and \(V\) denote the query, key, and value matrices, respectively, and \(d_{k}\) represents the dimensionality of the query vectors. The local window attention mechanism divides the feature map into non-overlapping regions, where self-attention is calculated independently within each window. This formulation preserves local structural integrity while significantly reducing the computational cost associated with full self-attention. To further enhance directional sensitivity, EHAT integrates an axial feature enhancement module, refining the representation of elongated crack patterns across horizontal and vertical orientations. \[F_{\text{enhanced}}=F_{\text{axial}}+\text{Conv}_{\text{axial}}(F_{\text{ axial}}) \tag{3}\]  
Here, \(\text{Conv}_{\text{axial}}(\cdot)\) denotes a convolution operation applied along the axial direction, designed to further refine crack-related feature representations. Departing from the standard Transformer paradigm, EHAT adopts a hybrid MLP structure [48], integrating convolutional layers with multilayer perceptrons [49]. This design leverages the local inductive bias of convolutions alongside the global modeling capacity of MLPs, enhancing the network's ability to capture both fine-grained details and long-range dependencies. \[F_{\text{hybrid}}=\text{MLP}(F_{\text{enhanced}})+\text{Conv}(F_{\text{ enhanced}}) \tag{4}\]  
\(\text{MLP}(\cdot)\) denotes a multilayer perceptron (feedforward network), and \(\text{Conv}(\cdot)\) denotes a conventional convolution operation. By summing the outputs of both operations, the model effectively fuses global context with fine-grained spatial features. The axial feature enhancement module reinforces the linear characteristics of cracks along both horizontal and vertical directions.