{"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/draem-a-discriminatively-trained","title":"DRAEM -- A discriminatively trained reconstruction embedding for surface anomaly detection","arxiv_id":"2108.07610","date":"2021-08-17","proceeding":null,"authors":["Vitjan Zavrtanik","Matej Kristan","Danijel Skočaj"],"abstract":"Visual surface anomaly detection aims to detect local image regions that significantly deviate from normal appearance. Recent surface anomaly detection methods rely on generative models to accurately reconstruct the normal areas and to fail on anomalies. These methods are trained only on anomaly-free images, and often require hand-crafted post-processing steps to localize the anomalies, which prohibits optimizing the feature extraction for maximal detection capability. In addition to reconstructive approach, we cast surface anomaly detection primarily as a discriminative problem and propose a discriminatively trained reconstruction anomaly embedding model (DRAEM). The proposed method learns a joint representation of an anomalous image and its anomaly-free reconstruction, while simultaneously learning a decision boundary between normal and anomalous examples. The method enables direct anomaly localization without the need for additional complicated post-processing of the network output and can be trained using simple and general anomaly simulations. On the challenging MVTec anomaly detection dataset, DRAEM outperforms the current state-of-the-art unsupervised methods by a large margin and even delivers detection performance close to the fully-supervised methods on the widely used DAGM surface-defect detection dataset, while substantially outperforming them in localization accuracy.","url_abs":"https://arxiv.org/abs/2108.07610v2","url_pdf":"https://arxiv.org/pdf/2108.07610v2.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":"draem-a-discriminatively-trained","repo_url":"https://github.com/vitjanz/draem","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"draem-a-discriminatively-trained","repo_url":"https://github.com/farazBhatti/DRAEM-Tensoflow","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"tf","reach":{"status":"ok"}},{"paper_slug":"draem-a-discriminatively-trained","repo_url":"https://github.com/openvinotoolkit/anomalib/tree/development/anomalib/models/draem","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"anomaly-classification","task_name":"Anomaly Classification"},{"task_slug":"anomaly-detection","task_name":"Anomaly Detection"},{"task_slug":"anomaly-localization","task_name":"Anomaly Localization"},{"task_slug":"anomaly-segmentation","task_name":"Anomaly Segmentation"},{"task_slug":"defect-detection","task_name":"Defect Detection"},{"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":"DRAEM","rank_in_archive_order":6,"of":11,"metrics":{"AUPR":"71","AUROC":"65.9"},"uses_additional_data":false},{"leaderboard":"/sota/anomaly-detection-on-mvtec-ad","task":"Anomaly Detection","dataset":"MVTec AD","model":"DRAEM","rank_in_archive_order":68,"of":148,"metrics":{"Detection AUROC":"98.0","Segmentation AP":"68.4","Segmentation AUROC":"97.3"},"uses_additional_data":true},{"leaderboard":"/sota/anomaly-detection-on-mvtec-loco-ad","task":"Anomaly Detection","dataset":"MVTec LOCO AD","model":"DRAEM","rank_in_archive_order":33,"of":40,"metrics":{"Avg. Detection AUROC":"73.6","Detection AUROC (only logical)":"72.8","Detection AUROC (only structural)":"74.4","Segmentation AU-sPRO (until FPR 5%)":"42.6"},"uses_additional_data":false},{"leaderboard":"/sota/anomaly-detection-on-visa","task":"Anomaly Detection","dataset":"VisA","model":"DRAEM","rank_in_archive_order":44,"of":50,"metrics":{"Segmentation AUPRO (until 30% FPR)":"73.1"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2108.07610","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2108.07610"}},"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/farazBhatti/DRAEM-Tensoflow","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/openvinotoolkit/anomalib/tree/development/anomalib/models/draem","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/vitjanz/draem","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_honours":2,"unverified":5},"by_repo_kind":{"official":{"samples":7,"ran":2,"repositories":1}},"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":0,"samples":[{"code_sha256_prefix":"c56b7ef16f309a45","entry":"gaussian","repo":"vitjanz/draem","repo_kind":"official","path":"loss.py","file_url":"https://github.com/vitjanz/draem/blob/HEAD/loss.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c56b7ef16f309a45"}},{"code_sha256_prefix":"7337f1f5ff01dcd0","entry":"get_lr","repo":"vitjanz/draem","repo_kind":"official","path":"train_DRAEM.py","file_url":"https://github.com/vitjanz/draem/blob/HEAD/train_DRAEM.py","link_basis":"plan_row","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7337f1f5ff01dcd0"}},{"code_sha256_prefix":"443341084ce76798","entry":"create_window","repo":"vitjanz/draem","repo_kind":"official","path":"loss.py","file_url":"https://github.com/vitjanz/draem/blob/HEAD/loss.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"443341084ce76798"}},{"code_sha256_prefix":"293a2b1189b747fd","entry":"generate_fractal_noise_2d","repo":"vitjanz/draem","repo_kind":"official","path":"perlin.py","file_url":"https://github.com/vitjanz/draem/blob/HEAD/perlin.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"293a2b1189b747fd"}},{"code_sha256_prefix":"ed9e127befc02046","entry":"generate_perlin_noise_2d","repo":"vitjanz/draem","repo_kind":"official","path":"perlin.py","file_url":"https://github.com/vitjanz/draem/blob/HEAD/perlin.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ed9e127befc02046"}},{"code_sha256_prefix":"4de91a4627a51ea2","entry":"lerp_np","repo":"vitjanz/draem","repo_kind":"official","path":"perlin.py","file_url":"https://github.com/vitjanz/draem/blob/HEAD/perlin.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4de91a4627a51ea2"}},{"code_sha256_prefix":"bff794bd9bd73f94","entry":"ssim","repo":"vitjanz/draem","repo_kind":"official","path":"loss.py","file_url":"https://github.com/vitjanz/draem/blob/HEAD/loss.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bff794bd9bd73f94"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}