Standard attention mechanisms in Transformers are typically isotropic, meaning they treat horizontal and vertical spatial relationships with equal weight. While this works well for broad objects like cars or buildings, it is computationally wasteful and geometrically imprecise for "slender" structures. In domains like autonomous driving (lane lines), remote sensing (roads and rivers), and industrial inspection (weld seams), the features of interest are thin, continuous, and highly directional.
To address this, researchers have developed a suite of techniques that bake geometric priors directly into the attention mechanism, forcing the model to "look" along the axes or paths where these linear structures reside.
Decomposing Attention into Axial Components
The most straightforward way to adapt attention for linear structures is to decompose a global 2D search into two 1D searches. Instead of every pixel attending to every other pixel ($N^2$ complexity), the model performs horizontal attention followed by vertical attention.
Han Zhang and colleagues in Lane Detection Transformer Based on Multi-frame Horizontal and Vertical Attention and Visual Transformer Module demonstrate that this "divide-and-conquer" approach is more effective for detecting slender lanes than standard global attention. By focusing the model on the primary axes of the features, they achieve real-time performance (46 FPS) because the model no longer wastes cycles comparing pixels that are diagonally distant and likely irrelevant to a vertical lane line.
Similarly, in the context of remote sensing, Xiaowen Ma and Zhenkai Wu introduced scene-guided axial attention in CDMask. By decoupling the directions, their model captures the long-range continuity of roads and rivers—objects that might span an entire image but occupy only a few pixels in width—without the prohibitive cost of a full self-attention matrix.
Strip Priors and Linear Constraints
If an object is known to be a thin strip, the attention mechanism can be further constrained using "strip" kernels. Congcong Wang and Meng Zhao 0001 implemented this in DSNet by incorporating $1 \times 3$ and $3 \times 1$ strip convolutions into the attention module. This serves as a hard geometric prior: the network is physically structured to aggregate information along elongated paths, which is ideal for tasks like weld seam segmentation where the target is inherently a line.
In 3D space, this concept evolves into line-constrained deformable attention. In $M^2$-3DLaneNet, Yueru Luo and Chaoda Zheng restrict the sampling points of the attention module to linear patterns. Rather than allowing the model to pick arbitrary points in a 2D or 3D space, the attention is forced to sample along a line. This ensures that the features being aggregated are relevant to the geometry of the lane, significantly improving accuracy on non-flat roads where 2D projections might be misleading.
Path-Based and Region-Specific Sampling
For complex structures like road networks, a simple straight line is often insufficient. Tianyu Li and Li Chen proposed a more flexible "lane attention" in LaneSegNet. Instead of a single reference point, their mechanism distributes multiple reference points along the entire extent of a lane segment.
This approach solves a fundamental trade-off in computer vision:
- Global Context: Needed to understand where the lane is going (topology).
- Local Detail: Needed to see exactly where the lane boundaries are (geometry).
By assigning specific attention heads to distinct local regions along these elongated paths, LaneSegNet allows the model to "walk" along the lane, aggregating fine-grained details at every step while maintaining a sense of the overall structure.
Efficiency through Spatial Constraints
Finally, these geometric priors allow for extreme sparsification. Ji Liu and Zifeng Zhang demonstrate in Sparse Laneformer that if you know you are looking for vertical structures, you can restrict query rows to interact only with corresponding horizontal regions in the feature map.
By replacing thousands of generic, square anchors with a few dozen dynamic, position-aware queries that follow these spatial constraints, the model achieves state-of-the-art results with a fraction of the computational complexity. This shift from "look everywhere" to "look along the lines" represents a transition from general-purpose vision to geometrically-aware perception.