计算机科学 ›› 2025, Vol. 52 ›› Issue (1): 210-220.doi: 10.11896/jsjkx.240100202

• 计算机图形学&多媒体 • 上一篇    下一篇

面向工业品缺陷检测的对比表示学习

罗航宇, 王小平, 梅萌, 赵文豪, 刘思纯   

  1. 同济大学电子与信息工程学院 上海 200092
  • 收稿日期:2024-01-29 修回日期:2024-06-25 出版日期:2025-01-15 发布日期:2025-01-09
  • 通讯作者: 王小平(xpwang6510@tongji.edu.cn)
  • 作者简介:(lhy123@tongji.edu.cn)
  • 基金资助:
    国家重点研发计划(2022YFB4300504-4)

Contrastive Representation Learning for Industrial Defect Detection

LUO Hangyu, WANG Xiaoping, MEI Meng, ZHAO Wenhao, LIU Sichun   

  1. School of Electronics and Information Engineering,Tongji University,Shanghai 200092,China
  • Received:2024-01-29 Revised:2024-06-25 Online:2025-01-15 Published:2025-01-09
  • About author:LUO Hangyu,born in 2000,postgra-duate.His main research interests include computer vision and industrial defect detection.
    WANG Xiaoping,born in 1965,Ph.D,professor.His main research interests include AI algorithms,deep learning and computer vision.
  • Supported by:
    National Key Research and Development Program of China(2022YFB4300504-4).

摘要: 在大规模制造业中,缺陷检测旨在发现有缺陷的零部件,如损坏、错位的和存在印刷错误的部件等。由于缺陷类型未知以及缺陷样本短缺,工业品缺陷检测面临着极大的挑战。为克服上述困难,一些方法利用来自自然图像数据集的通用视觉表示,提取广义特征来进行缺陷检测。然而,提取到的预训练特征与目标数据之间存在分布差异,直接使用该特征会导致检测性能不佳。因此,提出了一种基于对比表示学习的方法ConPatch。该方法采用对比表示学习来收集相似特征或者分离不相似特征,从而学习面向目标的特征表示。为了解决缺乏缺陷标注的问题,将数据表示之间的两种相似性度量即成对相似度和全局相似度作为伪标签。此外,采用了轻量化的内存库,仅将全部正常样本即全部无缺陷样本的特征中心存储到内存库中,从而减小了空间复杂度和内存库的尺寸。最后,将正常特征拉近至一个超球面内,而缺陷特征则分布在超球面外,以此来聚集正常特征。实验结果显示,在工业品缺陷检测数据集MVTec AD中,基于Wide-ResNet50的ConPatch模型的I-AUROC和P-AUROC分别达到99.35%和98.26%。在VisA数据集中,ConPatch模型的I-AUROC和P-AUROC分别达到95.50%和98.21%。上述结果验证了模型的有效性。

关键词: 工业品缺陷检测, 对比表示学习, 相似性度量, 内存库, 超球面

Abstract: Defect detection in large-scale manufacturing aims to find defective components,such as damaged,misaligned components,and components with printing errors.Due to unknown defect types and shortage of defect samples,industrial defect detection faces great challenges.To overcome the above difficulties,some methods utilize common visual representations from natural image datasets to extract generalized features for defect detection.However,there are distribution differences between the extracted pre-trained features and the target data.Using this feature directly will lead to poor detection performance.Therefore,ConPatch,a method based on contrastive representation learning is proposed.This method employs contrastive representation lear-ning to collect similar features or separate dissimilar features,resulting in goal-oriented representations of features.In order to solve the problem of lack of defect annotation,two similarity measures in data representations,pairwise similarity and global similarity,are used as pseudo labels.In addition,the method uses a lightweight memory bank and only stores the feature centers of all normal sample which are all defect-free sample in the memory bank,reducing the space complexity and the size of the memory bank.Finally,the normal features are brought closer to a hypersphere and the defect features are distributed outside the hypersphere to gather the normal features.Experimental results show that the I-AUROC and P-AUROC of the ConPatch model based on Wide-ResNet50 reaches 99.35% and 98.26% respectively in the industrial defect detection dataset MVTec AD.In the VisA dataset,I-AUROC and P-AUROC reaches 95.50% and 98.21%,respectively.The above results verify the effectiveness of the proposed model.

Key words: Industrial product defect detection, Contrastive representation learning, Similarity measure, Memory bank, Hype-rsphere

中图分类号: 

  • TP391
[1]LUO D L,CAI Y X,YANG Z H,et al.A review of deep lear-ning methods for industrial defect detection [J].Chinese Science:Information Science,2022,52(6):1002-1039.
[2]DAVLETSHINA D,MELNYCHUK V,TRAN V,et al.Unsupervised anomaly detection for X-ray images[J].arXiv:2001.10883,2019.
[3]NGUYEN D T,LOU Z,KLAR M,et al.Anomaly detectionwith multiple-hypotheses predictions[C]//International Confe-rence on Machine Learning.2019:4800-4809.
[4]SAKURADA M,YAIRI T.Anomaly detection using autoenco-ders with nonlinear dimensionality reduction[C]//Proceedings of the MLSDA 2014 2nd Workshop on Machine Learning for Sensory Data Analysis.2014:4-11.
[5]PIDHORSKYI S,ALMOHSEN R,DORETTO G.Generativeprobabilistic novelty detection with adversarial autoencoders[C]//Advances in Neural Information Processing Systems.2018:6822-6833.
[6]SABOKROU M,KHALOOEI M,FATHY M,et al.Adversa-rially learned one-class classifier for novelty detection[C]//Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition.2018:3379-3388.
[7]ZHANG Y,CHEN X W,CHEN M D,et al.Unsupervised industrial surface anomaly detection using contrastive learning generative adversarial networks[J].Journal of Electronic Mea-surement and Instrumentation,2023,37(10):193-201.
[8]RUFF L,VANDERMEULEN R,GOERNITZ N,et al.Deepone-class classification[C]//Proceedings of the International Conference on Machine Learning.2018:4393-4402.
[9]PERERA P,PATEL V M.Learning deep features for one-class classification[J].IEEE Transactions on Image Processing,2019,28(11):5450-5463.
[10]YI J,YOON S.Patch svdd:Patch-level svdd for anomaly detection and segmentation[C]//Proceedings of the Asian Conference on Computer Vision.2020:375-390.
[11]ROTH K,PEMULA L,ZEPEDA J,et al.Towards total recall in industrial anomaly detection[C]//Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition.2022:14318-14328.
[12]COHEN N,HOSHEN Y.Sub-image anomaly detection withdeep pyramid correspondences[J].arXiv:2005.02357,2020.
[13]DEFARD T,SETKOV A,LOESCH A,et al.Padim:a patch distribution modeling framework for anomaly detection and localization[C]//Proceedings of the International Conference on Pattern Recognition.2020:475-489.
[14]HE S R,ZHANG S J,WANG Y X.Industrial Defect Detection Model Integrating Multi-scale Features[J].Journal of Chinese Computer Systems,2023,44(5):1029-1034.
[15]HUANG P Q Z,DUAN X J,HUANG W W,et al.Asymmetric defect detection method of small sample image based on meta learning[J].Journal of Jilin University(Engineering and Technology Edition),2023,53(1):234-240.
[16]LEE S,LEE S,SONG B C.Cfa:Coupled-hypersphere-based feature adaptation for target-oriented anomaly localization[J].IEEE Access,2022,10:78446-78454.
[17]WU Z,XIONG Y,YU S X,et al.Unsupervised feature learning via non-parametric instance discrimination[C]//Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition.2018:3733-3742.
[18]CHEN T,KORNBLITH S,NOROUZI M,et al.A simpleframework for contrastive learning of visual representations[C]//International Conference on Machine Learning.2020:597-1607.
[19]CHEN X,HE K.Exploring simple siamese representation lear-ning[C]//Proceedings of the IEEE/CVF Conference on Compu-ter Vision and Pattern Recognition.2021:15750-15758.
[20]YE M,ZHANG X,YUEN P C,et al.Unsupervised embedding learning via invariant and spreading instance feature[C]//Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition.2019:6210-6219.
[21]HE K,FAN H,WU Y,et al.Momentum contrast for unsupervised visual representation learning[C]//Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition.2020:9729-9738.
[22]CHEN T,KORNBLITH S,NOROUZI M,et al.A simpleframework for contrastive learning of visual representations[C]//Proceedings of the International Conference on Machine Learning.2020:1597-1601.
[23]KIM S,KIM D,CHO M,et al.Embedding transfer with label relaxation for improved metric learning[C]//Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition.2021:3967-3976.
[24]GUO J,LU S,JIA L,et al.ReContrast:Domain-specific anomaly detection via contrastive reconstruction [J].arXiv.2306.02602,2023.
[25]HYUN J,KIM S,JEON G,et al.Reconpatch:Contrastive patch representation learning for industrial anomaly detection[C]//Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision.2024:2052-2061.
[26]ZHANG Z Q,ZHANG H,WU T Y,et al.Continuous dense normalized flow model for industrial image anomaly detection[J].Computer Science,2023,50(12):212-220.
[27]BERGMANN P,FAUSER M,SATTLEGGER D,et al.MVTec AD-A comprehensive real-world dataset for unsupervised ano-maly detection[C]//Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition.2019:9592-9600.
[28]ZOU Y,JEONG J,PEMULA L,et al.Spot-the-difference self-supervised pre-training for anomaly detection and segmentation[C]//Proceedings of the European Conference on Computer Vision.2022:392-408.
[29]GUDOVSKIY D,ISHIZAKA S,KOZUKA K.Cflow-ad:Real-time unsupervised anomaly detection with localization via conditional normalizing flows[C]//Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision.2022:98-107.
[30]LIU T,LI B,DU X,et al.FAIR:Frequency-aware image restoration for industrial visual anomaly detection[J].arXiv:2309.07068,2023.
[31]GUO H W,REN L P,FU J J,et al.Template-guided hierarchical feature restoration for anomaly detection[C]//Proceedings of the IEEE/CVF International Conference on Computer Vision.2023:6447-6458.
[32]BAE J,LEE J H,KIM S.PNI:Industrial anomaly detectionusing position and neighborhood information[C]//Proceedings of the IEEE/CVF International Conference on Computer Vision.2023:6373-6383.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!