Temperature for positive pairs

A production image labeled normal may still contain a defect. We made two augmented views of each training image. We compared their cosine similarity with the similarities between those views and the rest of the mini-batch. The p-value from a two-sided one-sample t-test picked one of two InfoNCE temperatures. At the lower temperature, difficult negative pairs have a stronger effect on training.

Scoring new images

After training, we used k-nearest neighbors on the encoder features before the projection layer. Each image got one anomaly score. Locating the faulty region within an image would need a separate evaluation.

What the temperature comparison showed

The adaptive rule gave a higher mean ROC AUC than the fixed and random settings tested on Surface Crack and Magnetic Tile. We also evaluated image-level detection on KolektorSDD2. Similarities within a mini-batch share samples, so in the paper we used the p-value as a training rule.