CrackFormer: Transformer Network for Fine-Grained Crack Detection

Huajun Liu, Xiangyu Miao, Christoph Mertz, Chengzhong Xu, Hui KongICCV 2021 · DOI

Introduction

The structural integrity of infrastructure, such as roads and bridges, is paramount for public safety. Automated crack detection using computer vision has emerged as a vital tool for maintenance. However, identifying fine-grained cracks remains a significant challenge. These thin cracks often exhibit low contrast against complex, textured backgrounds like asphalt and stone. Traditional Convolutional Neural Networks (CNNs), such as U-Net or SegNet, frequently struggle with these tasks due to limited receptive fields and the "blurring" effect of repeated pooling and convolution, which often results in thickened or fragmented predictions.

Methodology: The CrackFormer Architecture

To address these limitations, we present CrackFormer, a Transformer-based encoder-decoder network specifically engineered for pixel-level crack segmentation. Unlike standard CNNs, CrackFormer leverages self-attention mechanisms to capture long-range dependencies and maintain high-resolution details.

The CrackFormer architecture featuring an encoder-decoder structure with Self-Attention and Scaling-Attention blocks.

The architecture introduces two primary innovations:

  1. Self-Attention Block (Self-AB): To maintain efficiency, this block utilizes $1 \times 1$ convolutions for feature extraction across channels. It incorporates relative position embeddings, allowing the model to understand the spatial continuity of cracks across the entire image rather than focusing solely on local patches.
  2. Scaling-Attention Block (Scal-AB): In traditional architectures, skip connections pass raw encoder features directly to the decoder. CrackFormer's Scal-AB generates an attention mask to filter these features, effectively suppressing background noise (e.g., shadows, pebbles) and sharpening the semantic signal of the crack before fusion.

The model employs a multi-stage fusion strategy, combining predictions from five different scales to ensure both global topological consistency and fine-grained detail.

Experimental Evaluation

CrackFormer was rigorously tested on three benchmark datasets:

  • CrackTree260: Road pavement images with extremely thin, often single-pixel cracks.
  • CrackLS315: Asphalt images under laser illumination, characterized by very low contrast.
  • Stone331: Stone surface images where cracks are nearly indistinguishable from the natural texture.

Results and Discussion

CrackFormer achieves state-of-the-art (SOTA) performance across all metrics. Quantitatively, it reached Optimal Dataset Scale (ODS) F-measure scores of 0.881 on CrackTree260, 0.871 on CrackLS315, and 0.877 on Stone331.

Qualitative results demonstrating CrackFormer's ability to produce continuous and precise crack segmentations.

Beyond accuracy, CrackFormer is remarkably efficient. Compared to the previous leading model, DeepCrack, it requires 8.1x fewer FLOPs and 4.2x fewer parameters (7.35M vs. 30.9M). Qualitatively, the model produces "crisper" and more continuous boundaries, successfully detecting one-pixel-wide cracks that simpler CNNs often miss or fragment.

Conclusion

CrackFormer demonstrates that Transformer-based architectures can significantly outperform traditional CNNs in specialized tasks like fine-grained crack detection. By combining efficient self-attention with noise-filtering skip connections, the model provides a high-precision, low-parameter solution for infrastructure monitoring. Future research will focus on real-time inference optimization for mobile deployment and testing generalization across a wider variety of materials and environmental conditions.

Summary updated

BibTeX
@inproceedings{liu2021crackformer,
  author = {Huajun Liu and Xiangyu Miao and Christoph Mertz and Chengzhong Xu and Hui Kong},
  title = {{CrackFormer: Transformer Network for Fine-Grained Crack Detection}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2021},
  doi = {10.1109/iccv48922.2021.00376},
}
Figure