TL;DR
The Sparse Local Patch Transformer (SLPT) is a novel face alignment framework that learns the structural relationships between facial landmarks using an attention mechanism on sparse local patches rather than the full image. By combining this transformer architecture with a multi-stage, coarse-to-fine pyramidal framework, SLPT achieves state-of-the-art accuracy on challenging datasets while requiring up to 80% fewer FLOPs than previous leading methods.
What Problem Does This Paper Address?
Face alignment—the task of identifying specific landmarks (like eyes, nose, mouth, and jawline) on a human face—is foundational for applications like face swapping, driver fatigue detection, and facial reenactment. However, doing this robustly remains difficult when faces are heavily occluded, blurred, or turned in profile views.
Current approaches generally fall into two camps, both of which have limitations:
- Heatmap Regression: These methods predict a probability map for each landmark. While accurate, they suffer from quantization errors when downsampling images and rely on standard CNN kernels that only look at local neighborhoods, failing to capture global spatial relationships (e.g., how the position of the chin relates to the eyes).
- Coordinate Regression: These methods directly output $(x,y)$ coordinates from global features via fully-connected layers. While they have the potential to learn global geometry, they throw away fine-grained local appearance details.
While Vision Transformers (ViTs) can model long-range dependencies, applying them to full feature maps is computationally prohibitive because the number of tokens explodes. This paper introduces a way to get the global modeling power of transformers without the massive computational overhead.
Methods
The authors propose the Sparse Local Patch Transformer (SLPT), which operates on a small, sparse set of local image patches centered around estimated landmark positions rather than processing the entire image.
The pipeline consists of three main components:
- Patch Embedding & Structure Encoding: For each landmark, a small local patch is cropped from the feature map and projected into a vector. To preserve the spatial configuration of a human face, the authors add a learnable Structure Encoding to these vectors, which captures the geometric distances between landmarks on a standard face.
- Inherent Relation Layers: Inspired by the standard Transformer decoder, these layers use Multi-head Self-Attention (MSA) to model query-to-query interactions and Multi-head Cross-Attention (MCA) to aggregate landmark representations. This allows the network to dynamically adjust how much weight one landmark gives to another based on the specific image context.
- Coarse-to-Fine Locating: To refine the predictions, the system operates in multiple stages. It starts with large patches to capture a wide receptive field (preventing the model from getting lost) and progressively halves the patch size in subsequent stages to zoom in on fine-grained local details.
Datasets
The model was evaluated on three widely accepted face alignment benchmarks:
- WFLW: A highly challenging dataset containing 10,000 images with 98 landmark annotations, featuring severe occlusions, blur, and makeup.
- 300W: A standard benchmark with 68 landmark annotations.
- COFW & COFW68: Datasets specifically focused on heavy occlusion, containing 29 and 68 landmarks respectively.
Key Insights and Ideas
- Drastic Token Reduction: By shifting the transformer's focus from a dense full-image grid to a sparse set of landmark-centric patches, the number of input tokens drops significantly. For a 29-landmark dataset, the computational complexity of the cross-attention block drops to just 1/5 of a full-image transformer baseline.
- Exploiting Visibility for Occlusion: The cross-attention mechanism allows the model to dynamically "borrow" information from visible parts of the face to predict hidden ones. If an eye is occluded by sunglasses, the model automatically relies more heavily on visible landmarks like the nose or jawline to infer the eye's position.
- Pyramidal Feature Evolution: The coarse-to-fine framework acts as a spatial zoom. Early stages ensure the patches cover the correct global region, while later stages act as high-resolution local adjusters.
Key Results
- State-of-the-Art Accuracy: On the demanding WFLW dataset, SLPT achieved a Normalized Mean Error (NME) of 4.14%, outperforming highly optimized coordinate and heatmap regression models.
- Robustness to Extreme Conditions: As shown in qualitative evaluations, SLPT accurately snaps to landmarks even under heavy profile views, severe blur, and significant facial occlusions.
- High Efficiency: SLPT requires only 3.99G to 6.12G FLOPs (depending on the landmark count), which is 1/5 to 1/8 of the FLOPs required by previous SOTA methods like AVS and AWing.
- Faster Convergence: Compared to a full-feature map transformer baseline (like DETR), SLPT converges 8× faster during training while achieving a significantly lower error rate.
Limitations and Future Work
The authors note that the performance gains of SLPT are most pronounced on large, diverse datasets like WFLW. On smaller datasets with fewer training samples (like 300W), learning the complex, adaptive relationships via attention is more difficult, and the model performs competitively but does not clear the field as dramatically.
For future work, the authors plan to explore how this method of learning inherent structural relationships from sparse local patches can be extended to other spatial coordinate tasks, such as human pose estimation or hand tracking.
Summary updated