  Surface anomaly detection plays an important quality control role in many
manufacturing industries to reduce scrap production. Machine-based visual
inspections have been utilized in recent years to conduct this task instead of
human experts. In particular, deep learning Convolutional Neural Networks
(CNNs) have been at the forefront of these image processing-based solutions due
to their predictive accuracy and efficiency. Training a CNN on a classification
objective requires a sufficiently large amount of defective data, which is
often not available. In this paper, we address that challenge by training the
CNN on surface texture patches with a distance-based anomaly detection
objective instead. A deep residual-based triplet network model is utilized, and
defective training samples are synthesized exclusively from non-defective
samples via random erasing techniques to directly learn a similarity metric
between the same-class samples and out-of-class samples. Evaluation results
demonstrate the approach's strength in detecting different types of anomalies,
such as bent, broken, or cracked surfaces, for known surfaces that are part of
the training data and unseen novel surfaces.
