[论文解读] Defect Transformer: An Efficient Hybrid Transformer Architecture for Surface Defect Detection
本文提出Defect Transformer(DefT),一种混合CNN-Transformer架构,结合卷积神经网络进行局部特征提取与一种新颖的多尺度自注意力机制,以建模表面缺陷检测中的长程依赖关系。该方法在三个基准数据集上实现了最先进性能,显著提升了准确率、训练效率和数据效率,优于纯CNN和Transformer模型。
Surface defect detection is an extremely crucial step to ensure the quality of industrial products. Nowadays, convolutional neural networks (CNNs) based on encoder-decoder architecture have achieved tremendous success in various defect detection tasks. However, due to the intrinsic locality of convolution, they commonly exhibit a limitation in explicitly modeling long-range interactions, critical for pixel-wise defect detection in complex cases, e.g., cluttered background and illegible pseudo-defects. Recent transformers are especially skilled at learning global image dependencies but with limited local structural information necessary for detailed defect location. To overcome the above limitations, we propose an efficient hybrid transformer architecture, termed Defect Transformer (DefT), for surface defect detection, which incorporates CNN and transformer into a unified model to capture local and non-local relationships collaboratively. Specifically, in the encoder module, a convolutional stem block is firstly adopted to retain more detailed spatial information. Then, the patch aggregation blocks are used to generate multi-scale representation with four hierarchies, each of them is followed by a series of DefT blocks, which respectively include a locally position-aware block for local position encoding, a lightweight multi-pooling self-attention to model multi-scale global contextual relationships with good computational efficiency, and a convolutional feed-forward network for feature transformation and further location information learning. Finally, a simple but effective decoder module is proposed to gradually recover spatial details from the skip connections in the encoder. Extensive experiments on three datasets demonstrate the superiority and efficiency of our method compared with other CNN- and transformer-based networks.
研究动机与目标
- 解决CNN在建模长程依赖关系方面的局限性,以及Transformer在捕捉细粒度局部细节方面的不足,以应对表面缺陷检测任务。
- 开发一种统一架构,有效融合CNN提供的局部空间归纳偏置与Transformer的全局上下文建模能力。
- 提升在具有杂乱背景和伪缺陷的复杂工业图像上的检测性能。
- 通过卷积组件显式嵌入归纳偏置,提升训练和数据效率。
提出的方法
- 在编码器输入处使用卷积茎块(stem block),以保留高分辨率的空间细节。
- 补丁聚合块在四个分层级别上生成多尺度特征。
- 每个层级后均跟随一个DefT块,其中包含用于局部位置编码的局部位置感知块(LPB)。
- 轻量级多池化自注意力(LMPS)机制以较低计算成本捕获多尺度全局上下文。
- 使用卷积前馈网络(CFFN)替代标准前馈网络(FFN),以增强特征变换与位置学习能力。
- 采用简单的解码器结构,结合跳跃连接,从分层特征重建密集分割图。
实验结果
研究问题
- RQ1混合CNN-Transformer架构是否能在表面缺陷检测中超越纯CNN和Transformer模型?
- RQ2通过卷积操作显式实现的局部位置编码,相比绝对或相对位置编码,性能提升程度如何?
- RQ3在缺陷检测中,引入CNN归纳偏置在多大程度上提升了训练和数据效率?
- RQ4各个组件(LPB、LMPS、CFFN)对整体检测性能的贡献分别是什么?
主要发现
- 当用所提出的CFFN替换标准FFN时,DefT在平均绝对误差(MAE)上相比基线模型实现了5.5%的相对提升。
- 引入局部位置感知块(LPB)使MAE降低5.2%,且计算成本可忽略不计。
- 轻量级多池化自注意力(LMPS)机制在降低计算开销的同时提升了性能,实现MAE为0.0136。
- DefT在训练效率和数据效率方面均优于Swin-Unet:仅训练60个周期即达到82.53%的F1值,超过Swin-Unet在700个周期下训练的结果。
- DefT在仅使用30%数据的情况下,性能可与Swin-Unet*(在ImageNet上预训练)相当,展现出强大的数据效率。
- 即使未使用专门的位置编码(N/A),模型仍保持具有竞争力的表现(准确率为97.12%),证实卷积组件隐式提供了空间归纳偏置。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。