Vision-based industrial inspection (VII) aims to locate defects quickly and accurately. Supervised learning under a close-set setting and industrial anomaly detection, as two common paradigms in VII, face different problems in practical applications. The former is that various and sufficient defects are difficult to obtain, while the latter is that specific defects cannot be located. To solve these problems, in this paper, we focus on the few-shot semantic segmentation (FSS) method, which can locate unseen defects conditioned on a few annotations without retraining. Compared to common objects in natural images, the defects in VII are small. This brings two problems to current FSS methods: 1 distortion of target semantics and 2 many false positives for backgrounds. To alleviate these problems, we propose a small object few-shot segmentation (SOFS) model. The key idea for alleviating 1 is to avoid the resizing of the original image and correctly indicate the intensity of target semantics. SOFS achieves this idea via the non-resizing procedure and the prototype intensity downsampling of support annotations. To alleviate 2, we design an abnormal prior map in SOFS to guide the model to reduce false positives and propose a mixed normal Dice loss to preferentially prevent the model from predicting false positives. SOFS can achieve FSS and few-shot anomaly detection determined by support masks. Diverse experiments substantiate the superior performance of SOFS. Code is available at https://github.com/zhangzilongc/SOFS.
翻译:基于视觉的工业检测旨在快速、准确地定位缺陷。作为该领域两种常见范式,闭集设定下的监督学习与工业异常检测在实际应用中面临不同问题:前者难以获取多样且充足的缺陷样本,后者则无法定位具体缺陷。为解决这些问题,本文聚焦于少样本语义分割方法,该方法仅需少量标注即可定位未见缺陷且无需重新训练。与自然图像中的常见物体相比,工业检测中的缺陷通常尺寸较小,这给现有FSS方法带来两大挑战:1)目标语义失真;2)背景误报率高。为缓解这些问题,我们提出小目标少样本分割模型。针对问题1的核心解决思路是避免原始图像尺寸调整并准确表征目标语义强度。SOFS通过非尺寸调整流程与支持标注的原型强度下采样实现该目标。针对问题2,我们在SOFS中设计了异常先验图以引导模型降低误报率,并提出混合正态Dice损失函数以优先抑制模型产生误报预测。SOFS能够根据支持掩码同时实现少样本语义分割与少样本异常检测。多样化实验验证了SOFS的优越性能。代码发布于https://github.com/zhangzilongc/SOFS。