← Back to Research

๐Ÿ“˜ Research summary · Journal article

Global self-attention for surface defect detection in FDM

Beyond local receptive fields: Vision transformers for real-time surface defect detection in FDM

Islam, M. S., Bappy, M. M., Tushar, S. R., et al.

The International Journal of Advanced Manufacturing Technology, 2026

Methodology: depth-map label mapping, patch tokenization, ViT fine-tuning, post-hoc explainability (attention maps, Grad-CAM, t-SNE/UMAP), and comparison with ResNet-50, YOLOv5, and a shallow MLP.
Methodology: depth-map label mapping, patch tokenization, ViT fine-tuning, post-hoc explainability (attention maps, Grad-CAM, t-SNE/UMAP), and comparison with ResNet-50, YOLOv5, and a shallow MLP.
โšก TL;DR

Surface anomalies in fused deposition modeling are often subtle and spatially distributed, which limits CNNs with local receptive fields. We present an optimized vision transformer that operates on depth maps from 2D laser scanning and uses global self-attention to model long-range dependencies across the surface. It achieves a macro-F1 of 0.877 and a support-weighted mAUC of 0.972 while sustaining real-time inference.

Concept animation: global self-attention over surface patches
Depth map of a printed surface, cut into patches Global self-attention every patch looks atevery other patch query patch defect region strong attention Illustration of the idea, not real data.

๐ŸŽฏ Problem

Conventional defect detectors in FDM struggle with anomalies that extend across the printed surface, because their localized receptive fields and strong inductive biases emphasize nearby pixels over global structure.

๐Ÿ’ก Approach

Replace local convolution with a vision transformer. Splitting the surface into patches and applying global self-attention lets every region inform every other region. Depth maps from laser scanning provide a direct, high-fidelity description of surface topology.

๐Ÿงฉ Method

Method overview

  1. 1

    Laser scanning

    A 2D laser profiler measures the printed surface.

  2. 2

    Depth-map construction

    Scan lines are assembled into a high-resolution surface topology representation.

  3. 3

    Patch embedding

    The depth map is partitioned into patches and embedded as tokens.

  4. 4

    Global self-attention

    Transformer layers model long-range dependencies between all patches.

  5. 5

    Defect classification

    The model predicts the defect class in real time, with explainability analysis of the attention.

๐Ÿ“Š Results

Key findings

0.877
Macro-F1
0.972
Support-weighted mAUC
  • The optimized ViT classified key FDM surface defect types accurately while sustaining real-time inference.
  • Global self-attention captured spatially distributed anomalies that are difficult for local receptive fields.

๐Ÿญ Significance

Reliable real-time surface inspection allows a printer, or the robot operating it, to intervene during a build rather than discover defects after hours of fabrication, which reduces scrap and inspection cost.

๐Ÿ“„ Citation and links

Islam, M. S., Bappy, M. M., Tushar, S. R., et al.. "Beyond local receptive fields: Vision transformers for real-time surface defect detection in FDM." The International Journal of Advanced Manufacturing Technology, 2026.