Anomaly detection (AD) in surface inspection is an essential yet challenging task in manufacturing due to the quantity imbalance problem of scarce abnormal data. To overcome the above, a reconstruction encoder-decoder (ED) such as autoencoder or U-Net which is trained with only anomaly-free samples is widely adopted, in the hope that unseen abnormals should yield a larger reconstruction error than normal. Over the past years, researches on self-supervised reconstruction-by-inpainting have been reported. They mask out suspected defective regions for inpainting in order to make them invisible to the reconstruction ED to deliberately cause inaccurate reconstruction for abnormals. However, their limitation is multiple random masking to cover the whole input image due to defective regions not being known in advance. We propose a novel reconstruction-by-inpainting method dubbed Excision and Recovery (EAR) that features single deterministic masking. For this, we exploit a pre-trained spatial attention model to predict potential suspected defective regions that should be masked out. We also employ a variant of U-Net as our ED to further limit the reconstruction ability of the U-Net model for abnormals, in which skip connections of different layers can be selectively disabled. In the training phase, all the skip connections are switched on to fully take the benefits from the U-Net architecture. In contrast, for inferencing, we only keep deeper skip connections with shallower connections off. We validate the effectiveness of EAR using an MNIST pre-trained attention for a commonly used surface AD dataset, KolektorSDD2. The experimental results show that EAR achieves both better AD performance and higher throughput than state-of-the-art methods. We expect that the proposed EAR model can be widely adopted as training and inference strategies for AD purposes.
翻译:表面检测中的异常检测(AD)是制造业中一项关键但具有挑战性的任务,其难点在于异常数据稀缺引发的数量不均衡问题。为克服此问题,广泛采用仅用无异常样本训练的编码器-解码器(ED)重构模型(如自编码器或U-Net),期望未知异常区域能产生比正常区域更大的重构误差。近年来,基于自监督图像修复重构的研究已有报道:通过掩蔽疑似缺陷区域进行修复,使其对重构ED不可见,从而刻意导致异常区域重构不准确。然而,此类方法的局限在于需采用多重随机掩码覆盖整个输入图像——因为缺陷区域无法预先获知。我们提出名为"切除与恢复"(EAR)的新型图像修复重构方法,其核心是单确定性掩码。具体而言,我们利用预训练的空间注意力模型预测需掩蔽的潜在疑似缺陷区域,同时采用改进型U-Net作为ED,通过选择性禁用不同层级的跳跃连接,进一步限制U-Net对异常区域的重构能力。训练阶段所有跳跃连接均保持激活以充分利用U-Net架构优势,推理阶段则仅保留深层跳跃连接并关闭浅层连接。我们使用MNIST预训练注意力在常用表面异常检测数据集KolektorSDD2上验证EAR的有效性。实验结果表明,EAR在异常检测性能和计算吞吐量上均优于现有最优方法。我们预期所提出的EAR模型可作为通用的训练与推理策略,广泛服务于异常检测任务。