Source-linked AI summary

Asymmetric Student-Teacher Networks for Industrial Anomaly Detection

Marco Rudolph, Tom Wehrbein, Bodo Rosenhahn, Bastian Wandt

arXiv:2210.07829v2cs.LGcs.AIcs.CV

TL;DR

Industrial anomaly detection lacks sufficient defective examples, while similar student-teacher architectures can generalize undesirably and produce low anomaly scores. AST pairs a bijective normalizing-flow teacher with a conventional feed-forward student, using their distances to compensate for skewed likelihoods and improve anomaly detection.

  • Problem

    Defective examples are unavailable or scarce, and similar conventional teacher-student architectures can generalize similarly outside the training distribution, reducing anomaly scores.

  • Method

    AST uses a bijective normalizing flow as teacher and a conventional feed-forward network as student, exploiting their asymmetric outputs and student-teacher distances for detection.

  • Results

    The student-teacher distance provides a better anomaly measure than the teacher's likelihoods and shifts anomalous samples toward larger distances.

  • Takeaways & Limitations

    AST compensates for skewed normalizing-flow likelihoods by adding a student and prevents undesired teacher-to-student generalization through asymmetric architectures.

  • Takeaways & Limitations

    Normalizing-flow density estimation can be unstable, and even ground-truth density does not guarantee perfect anomaly detection because density depends strongly on parameterization.

Abstract

from arXiv · show

Industrial defect detection is commonly addressed with anomaly detection (AD) methods where no or only incomplete data of potentially occurring defects is available. This work discovers previously unknown problems of student-teacher approaches for AD and proposes a solution, where two neural networks are trained to produce the same output for the defect-free training examples. The core assumption of student-teacher networks is that the distance between the outputs of both networks is larger for anomalies since they are absent in training. However, previous methods suffer from the similarity of student and teacher architecture, such that the distance is undesirably small for anomalies. For this reason, we propose asymmetric student-teacher networks (AST). We train a normalizing flow for density estimation as a teacher and a conventional feed-forward network as a student to trigger large distances for anomalies: The bijectivity of the normalizing flow enforces a divergence of teacher outputs for anomalies compared to normal data. Outside the training distribution the student cannot imitate this divergence due to its fundamentally different architecture. Our AST network compensates for wrongly estimated likelihoods by a normalizing flow, which was alternatively used for anomaly detection in previous work. We show that our method produces state-of-the-art results on the two currently most relevant defect detection datasets MVTec AD and MVTec 3D-AD regarding image-level anomaly detection on RGB and 3D data.

1. Introduction

Industrial anomaly detection must operate with defect-free training data because defective examples are scarce and new errors recur. AST addresses undesirably small anomaly scores in conventional student-teacher networks by pairing a bijective normalizing-flow teacher with an asymmetric feed-forward student.

  • Industrial inspection is expensive and unreliable when performed by humans, while defective examples are often unavailable or scarce for supervised training.
  • Semi-supervised anomaly detection trains using only normal, defect-free examples, including for industrial RGB, 3D, and combined data.
  • Conventional student-teacher methods use output distance as an anomaly indicator, but similar non-injective architectures can generalize similarly on anomalous inputs and produce low scores.
  • AST uses a bijective normalizing flow as teacher and a conventional sequential model as student to encourage divergent outputs for out-of-distribution samples.
  • The student-teacher distance can compensate for incorrectly estimated normalizing-flow likelihoods, retaining low scores for misestimated normal data and high scores for misestimated anomalous data.
  • The method avoids undesired teacher-to-student generalization through highly asymmetric networks and improves student-teacher anomaly detection.

2. Related Work

Related work includes student-teacher regression, density estimation, generative reconstruction, synthetic anomalies, and classical anomaly detectors. The paper distinguishes AST through its asymmetric architectures and use of regression error alone, while noting limitations of likelihood-based detection.

  • Student-Teacher Networks: Student-teacher anomaly detection trains students to regress teacher outputs and uses their regression distance as an anomaly score.
  • Student-Teacher Networks: Existing student-teacher methods use identical conventional networks, which can cause undesired generalization on inputs outside the training distribution.
  • Student-Teacher Networks: AST requires one student and regression error as its sole anomaly criterion, unlike prior ensembles combining regression errors with other signals.
  • Density Estimation: Normalizing flows provide bijective mappings and exact density estimation, enabling anomaly scores based on the likelihood of normal samples.
  • Density Estimation: Even ground-truth density estimation does not guarantee perfect anomaly detection because likelihood depends strongly on parameterization, while flow training can be unstable.
  • Generative Models: Autoencoders and GANs commonly use reconstruction error, but synthetic or reconstructed anomalies may not represent real industrial defects and error magnitude depends on anomaly structure.

3. Method

AST trains an invertible normalizing-flow teacher and a conventional student to produce matching outputs on defect-free data, using their output distance for anomaly scoring. The pipeline supports RGB and depth inputs, positional conditioning, foreground masking, and pixel-to-image score aggregation.

  • 3. Method: The teacher first bijectively transforms defect-free feature distributions toward N(0, I), while the student then learns to regress the teacher outputs.The normalizing flow is trained as a pretext task rather than using its likelihoods directly as anomaly scores.
  • 3. Method: Image features and optional depth maps are concatenated with sinusoidal positional encodings before entering the models.Depth maps are pixel-unshuffled to match feature-map dimensions, and positional conditioning relates features to spatial position.
  • 3. Method: The teacher minimizes masked negative log likelihood, while the student minimizes masked squared ℓ2 distance between corresponding teacher and student outputs.Foreground masks can exclude background pixels from both losses.
  • 3.1. Teacher / 3.2. Student: The teacher is a Real-NVP-based conditional normalizing flow, whereas the student is a conventional convolutional network with residual blocks.The asymmetric architectures are designed to prevent the student from imitating the teacher’s behavior outside the training distribution.
  • 3. Method: At image level, pixel-wise student-teacher distances are aggregated over foreground pixels using either the maximum or the mean.This distance is used as the anomaly score during testing.

4.1. Datasets

The evaluation uses MVTec AD and MVTec 3D-AD, covering defect-free training data and defective and defect-free test data across 2D, RGB, depth, and multimodal scenarios.

  • 4.1. Datasets: The benchmark comprises 25 industrial inspection scenarios spanning natural objects, industrial components, and textures in 2D and 3D.Both datasets provide image-level labels and pixel-level annotations for defective regions.
  • 4.1. Datasets: For both datasets, training contains only defect-free data, while testing contains both defect-free and defective examples.Pixel-level annotations support anomaly-segmentation evaluation.
  • 4.1. Datasets: MVTec AD contains 10 object and 5 texture categories with 73 defect types, including displacements, cracks, and scratches.Its images have side lengths from 700 to 1024 pixels.
  • 4.1. Datasets: MVTec 3D-AD contains paired RGB images and 3D scans for 10 categories, including objects with natural variation.Some defects are visible only in depth, whereas others such as discoloration are visible only in RGB.

4.2. Implementation Details

Implementation uses frozen ImageNet-pretrained EfficientNet-B5 features, dataset-specific normalizing-flow settings, residual student blocks, and foreground-aware score aggregation.

  • 4.2. Implementation Details: The method extracts frozen layer-36 EfficientNet-B5 features from ImageNet-pretrained networks, producing 24 × 24 feature maps with 304 channels.Input images are resized to 768 × 768 pixels.
  • 4.2. Implementation Details: Depth preprocessing fills missing values from 8-connected neighborhoods and identifies foreground pixels more than 7 mm from an interpolated corner-defined background plane.This processing supplies masks used to ignore background regions.
  • 4.2. Implementation Details: Table 2 reports image-level MVT2D AUROC grouped by textures and objects, with the proposed method summarized over five runs.The table includes mean and standard deviation for the proposed method and notes reimplemented STFPM* values.
  • 4.2. Implementation Details: The teacher uses four positional-conditioned coupling blocks, with hidden channel sizes of 1024 for MVT2D and 64 for MVT3D.Alpha-clamping uses α = 3 for MVT2D and α = 1.9 for MVT3D.
  • 4.2. Implementation Details: The student uses four residual convolutional blocks, Leaky-ReLU slope 0.2, and hidden channel size 1024.It adopts the teacher’s epoch and optimizer settings.

4.3. Evaluation Metrics

Evaluation measures image-level and pixel-level anomaly detection using AUROC, which is threshold-independent and invariant to test-set class balance.

  • 4.3. Evaluation Metrics: Image-level anomaly detection performance is measured by the area under the receiver operating characteristic curve, or AUROC.The ROC relates true-positive rate to false-positive rate across anomaly-score thresholds.
  • 4.3. Evaluation Metrics: Pixel-level anomaly segmentation is evaluated by computing AUROC using the datasets’ ground-truth anomaly masks.The same threshold-independent metric is applied at pixel level.

4.4. Results

AST achieves strong image-level anomaly detection across MVT2D and the more challenging MVT3D benchmark, while ablations support asymmetric architectures, positional encoding, and foreground masking.

  • MVT2D detection: 99.2% mean detection AUROC on MVT2D establishes a new state of the art, with especially strong performance on objects and textures.The method improves over two student-teacher approaches by 6% and 3.6%, respectively.
  • MVT3D detection: MVT3D average AUROC improves over prior methods by 5.1% for 3D, 5% for RGB, and 7.2% for RGB+3D.AST sets a new state of the art in 21 of 30 modality-class cases and reaches at least 93% AUROC in 7 of 10 RGB+3D cases.
  • Anomaly localization: AST also localizes defects for practical purposes, achieving mean pixel-AUROC values of 95% or 97.6%.Image-level detection remains the primary focus of the work.
  • Distance behavior: For peach in MVT3D, anomalous regions produce a clear shift toward larger student-teacher distances than normal regions.Random orthographic projections visualize the corresponding student and teacher outputs and their anomaly-score distances.
  • Ablation studies: A symmetric student-teacher pair worsens results by 1–2%, whereas increasing student depth nearly saturates performance after four residual blocks.The authors recommend four blocks as a trade-off because additional computational effort yields limited remaining detection gains.
  • Ablation studies: Positional encoding improves MVT3D 3D-only detection by 1.4%, while foreground masking focuses training and testing on essential structures and removes noisy background scores.The positional encoding adds 32 channels without significantly increasing computational effort.

5. Conclusion

The paper identifies generalization in previous student-teacher anomaly detectors and introduces AST with highly different teacher and student architectures. It also compensates for skewed normalizing-flow likelihoods, while noting future extensions to more data domains and improved localization resolution.

  • Conclusion: AST addresses the generalization problem of previous student-teacher pairs by using highly different architectures for teacher and student.The method additionally compensates for skewed likelihoods from a normalizing-flow teacher used directly for detection in previous work.
  • Conclusion: Future work could extend AST to more data domains and improve localization resolution.
Loading 2210.07829v2…