  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.
