{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/cutpaste-self-supervised-learning-for-anomaly","title":"CutPaste: Self-Supervised Learning for Anomaly Detection and Localization","arxiv_id":"2104.04015","date":"2021-04-08","proceeding":"CVPR 2021 1","authors":["Chun-Liang Li","Kihyuk Sohn","Jinsung Yoon","Tomas Pfister"],"abstract":"We aim at constructing a high performance model for defect detection that detects unknown anomalous patterns of an image without anomalous data. To this end, we propose a two-stage framework for building anomaly detectors using normal training data only. We first learn self-supervised deep representations and then build a generative one-class classifier on learned representations. We learn representations by classifying normal data from the CutPaste, a simple data augmentation strategy that cuts an image patch and pastes at a random location of a large image. Our empirical study on MVTec anomaly detection dataset demonstrates the proposed algorithm is general to be able to detect various types of real-world defects. We bring the improvement upon previous arts by 3.1 AUCs when learning representations from scratch. By transfer learning on pretrained representations on ImageNet, we achieve a new state-of-theart 96.6 AUC. Lastly, we extend the framework to learn and extract representations from patches to allow localizing defective areas without annotations during training.","url_abs":"https://arxiv.org/abs/2104.04015v1","url_pdf":"https://arxiv.org/pdf/2104.04015v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"cutpaste-self-supervised-learning-for-anomaly","repo_url":"https://github.com/LilitYolyan/CutPaste","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"cutpaste-self-supervised-learning-for-anomaly","repo_url":"https://github.com/Runinho/pytorch-cutpaste","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"anomaly-classification","task_name":"Anomaly Classification"},{"task_slug":"anomaly-detection","task_name":"Anomaly Detection"},{"task_slug":"data-augmentation","task_name":"Data Augmentation"},{"task_slug":"defect-detection","task_name":"Defect Detection"},{"task_slug":"one-class-classifier","task_name":"One-class classifier"},{"task_slug":"self-supervised-learning","task_name":"Self-Supervised Learning"},{"task_slug":"transfer-learning","task_name":"Transfer Learning"},{"task_slug":"unsupervised-anomaly-detection","task_name":"Unsupervised Anomaly Detection"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/anomaly-classification-on-goodsad","task":"Anomaly Classification","dataset":"GoodsAD","model":"CutPaste","rank_in_archive_order":10,"of":11,"metrics":{"AUPR":"62.8","AUROC":"60.2"},"uses_additional_data":false},{"leaderboard":"/sota/anomaly-detection-on-mvtec-ad","task":"Anomaly Detection","dataset":"MVTec AD","model":"CutPaste (ensemble)","rank_in_archive_order":84,"of":148,"metrics":{"Detection AUROC":"96.1"},"uses_additional_data":false},{"leaderboard":"/sota/anomaly-detection-on-mvtec-ad","task":"Anomaly Detection","dataset":"MVTec AD","model":"CutPaste (Image level detector)","rank_in_archive_order":92,"of":148,"metrics":{"Detection AUROC":"95.2","Segmentation AUROC":"88.3"},"uses_additional_data":false},{"leaderboard":"/sota/anomaly-detection-on-mvtec-ad","task":"Anomaly Detection","dataset":"MVTec AD","model":"CutPaste (Patch level detector)","rank_in_archive_order":137,"of":148,"metrics":{"Segmentation AUROC":"96.0"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2104.04015","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2104.04015"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/LilitYolyan/CutPaste","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Runinho/pytorch-cutpaste","reach":null}],"summary":{"ran":3},"by_repo_kind":{"listed":{"samples":3,"ran":3,"repositories":2}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":2,"samples":[{"code_sha256_prefix":"59401358a018441f","entry":"CutPaste","repo":"LilitYolyan/CutPaste","repo_kind":"listed","path":"cutpaste.py","file_url":"https://github.com/LilitYolyan/CutPaste/blob/HEAD/cutpaste.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"59401358a018441f"}},{"code_sha256_prefix":"cb970ddafdfccb8c","entry":"CutPaste","repo":"Runinho/pytorch-cutpaste","repo_kind":"listed","path":"cutpaste.py","file_url":"https://github.com/Runinho/pytorch-cutpaste/blob/HEAD/cutpaste.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"cb970ddafdfccb8c"}},{"code_sha256_prefix":"32ee54e0db9f9970","entry":"CutPasteNormal","repo":"Runinho/pytorch-cutpaste","repo_kind":"listed","path":"cutpaste.py","file_url":"https://github.com/Runinho/pytorch-cutpaste/blob/HEAD/cutpaste.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"32ee54e0db9f9970"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}