Papers › DRAEM -- A discriminatively trained reconstruction embedding for surface anomaly detection

DRAEM -- A discriminatively trained reconstruction embedding for surface anomaly detection

17 Aug 2021arXiv:2108.07610archive 2025-07-28

Vitjan Zavrtanik, Matej Kristan, Danijel Skočaj

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.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2108.07610")

Code

Syntology Ran 2 of 7 code samples harvested from 1 repository linked to this paper; 5 have no recorded run. Of those that ran: 2 ran · honoured contract.

By repository: official repository: 7 samples from 1 repository, 2 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

vitjanz/draem officialpytorchMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

7 samples harvested; 2 ran; 2 honoured the contract we drafted; 5 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

2ran · honoured contract
5unverified

Licence: 0 of the 7 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from vitjanz/draem. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: 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. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

gaussian vitjanz/draem/loss.py official repository ran · honoured contract fingerprinted MIT (permissive) · c56b7ef16f309a45 · report
get_lr vitjanz/draem/train_DRAEM.py official repository ran · honoured contract MIT (permissive) · 7337f1f5ff01dcd0 · report
create_window vitjanz/draem/loss.py official repository unverified MIT (permissive) · 443341084ce76798 · report
generate_fractal_noise_2d vitjanz/draem/perlin.py official repository unverified MIT (permissive) · 293a2b1189b747fd · report
generate_perlin_noise_2d vitjanz/draem/perlin.py official repository unverified MIT (permissive) · ed9e127befc02046 · report
lerp_np vitjanz/draem/perlin.py official repository unverified MIT (permissive) · 4de91a4627a51ea2 · report
ssim vitjanz/draem/loss.py official repository unverified MIT (permissive) · bff794bd9bd73f94 · report

Tasks

Anomaly ClassificationAnomaly DetectionAnomaly LocalizationAnomaly SegmentationDefect DetectionUnsupervised Anomaly Detection

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Anomaly Classification GoodsAD DRAEM AUPR 71 #6 of 11 Archive leaderboard report
Anomaly Classification GoodsAD DRAEM AUROC 65.9 #6 of 11 Archive leaderboard report
Anomaly Detection MVTec AD DRAEM Detection AUROC 98.0 #68 of 148 Archive leaderboard report
Anomaly Detection MVTec AD DRAEM Segmentation AP 68.4 #68 of 148 Archive leaderboard report
Anomaly Detection MVTec AD DRAEM Segmentation AUROC 97.3 #68 of 148 Archive leaderboard report
Anomaly Detection MVTec LOCO AD DRAEM Avg. Detection AUROC 73.6 #33 of 40 Archive leaderboard report
Anomaly Detection MVTec LOCO AD DRAEM Detection AUROC (only logical) 72.8 #33 of 40 Archive leaderboard report
Anomaly Detection MVTec LOCO AD DRAEM Detection AUROC (only structural) 74.4 #33 of 40 Archive leaderboard report
Anomaly Detection MVTec LOCO AD DRAEM Segmentation AU-sPRO (until FPR 5%) 42.6 #33 of 40 Archive leaderboard report
Anomaly Detection VisA DRAEM Segmentation AUPRO (until 30% FPR) 73.1 #44 of 50 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections