Skip to content

Odd-One-Out: Anomaly Detection by Comparing with Neighbors

Conference: CVPR 2025
arXiv: 2406.20099
Code: https://github.com/VICO-UoE/OddOneOutAD
Area: 3D Vision
Keywords: Scene-level anomaly detection, cross-instance matching, DINOv2 distillation, differentiable rendering, slot voxel attention

TL;DR

OddOneOutAD formalizes the task of "finding anomalies among a group of similar products" in industrial quality inspection as scene-level anomaly detection. It constructs object representations in 3D voxel space using sparse 5-view images, obtains part-aware features through DINOv2 knowledge distillation and differentiable rendering, and compares similarities among instances using cross-instance sparse voxel attention to identify whether each instance is anomalous. Additionally, it contributes two new benchmarks: ToysAD-8K and PartsAD-15K.

Background & Motivation

  1. Background: Traditional AD (MVTec-AD/VisA) uses single-object, single-view setups and assumes that "normality" is fixed.
  2. Limitations of Prior Work: Anomalies in real-world production lines are defined as "deviations relative to other objects in the same batch"—for example, a yellow-handle coffee cup appearing on a blue-handle coffee cup production line is considered anomalous. Traditional methods with fixed standards cannot adapt to this setup.
  3. Key Challenge: Anomalies depend on in-scene neighbors, and the relative poses between objects are unknown, requiring pose-agnostic comparisons.
  4. Goal:
    • Define a new task: scene-specific multi-object AD;
    • Develop a method generalizable to unseen categories and shapes;
    • Resolve self-occlusion and mutual occlusion under multi-view settings.
  5. Key Insight: Explicitly construct each instance as a 3D voxel representation and compare them via sparse cross-instance matching, bypassing pose estimation.
  6. Core Idea: Use 3D feature volume, DINOv2 distillation, and sparse voxel attention to achieve pose-agnostic cross-instance comparison.

Method

Overall Architecture

Input: 5-view RGB images and camera parameters. Output: Anomaly label \(y_n \in \{0,1\}\) and 3D bounding box \(\mathbf{b}_n\) for each object. Pipeline: 1. 3D Feature Volume Construction: Extract 2D features using a CNN, back-project them to voxels, and refine using a 3D CNN to obtain \(\mathbf{F}_v\). 2. Feature Enhancement (during training): Utilize differentiable volume rendering and DINOv2 distillation to imbue the voxel representations with multi-view geometric consistency and part semantics. 3. Object-centric Feature Extraction: Threshold the density volume \(\mathbf{V}_\sigma\) to obtain point clouds, apply DBScan clustering to extract the bounding boxes for each instance, and perform RoI pooling to obtain \(\mathbf{z}_n \in \mathbb{R}^{d \times 8 \times 8 \times 8}\). 4. Cross-instance Matching: Perform top-k sparse voxel attention on each pair of instances to compare them with each other, outputting the anomaly classification.

Key Designs

  1. DINOv2 Volume Feature Distillation + Differentiable Rendering

    • Function: Endows the 3D voxel representation with open-world part semantics and cross-view geometric consistency.
    • Mechanism: Apply \(1 \times 1 \times 1\) convolutions on \(\mathbf{F}_v\) to predict color volume \(\mathbf{V}_c\), density \(\mathbf{V}_\sigma\), and feature volume \(\mathbf{V}_f\). Perform volume rendering back to 2D images to align with DINOv2 teacher features:
    \[\text{loss} = \sum_t \|\mathbf{I}_t - \hat{\mathbf{I}}_t\|^2 + \|\hat{\mathbf{I}}_{t\sigma} - \mathbf{I}_{t\sigma}\|^2 + \text{cos}(\hat\Phi_t, \Phi(\mathbf{I}_t))\]

    During feature rendering, a stop-gradient operator is applied to block gradients from propagating back to the density volume to prevent geometric distortion. - Design Motivation: The dense correspondences provided by DINOv2 allow the model to perform fine-grained matching even on unseen categories, while differentiable rendering ensures multi-view consistency.

  2. DBScan Automatic Instance Extraction (No GT Boxes Required)

    • Function: Infers the 3D bounding box for each instance directly from the density volume.
    • Mechanism: Threshold \(\mathbf{V}_\sigma\) to obtain occupancy points, apply DBScan clustering, and compute bounding boxes for each cluster followed by RoI pooling.
    • Design Motivation: In practice, manual bounding box annotations are not required during training; the model relies entirely on the self-supervised density field.
  3. Cross-instance Sparse Voxel Attention

    • Function: Efficiently compares 3D voxels of two instances to establish pose-agnostic local correspondences.
    • Mechanism: For each voxel \(i\), compute the similarity of its projected feature \(\beta(\mathbf{z}_n[i])\) with all voxels of another instance. Select the top-\(k\) most similar positions \(\mathcal{C}_k^{nm}[i]\), and perform attention restricted to these positions:
    \[\bar{\mathbf{z}}_n[i] = \sum_{m \neq n} \sum_{j \in \mathcal{C}_k^{nm}[i]} \text{softmax}\big(\mathbf{Q}_n[i]\mathbf{K}_m[j]/\sqrt d\big) \mathbf{V}_m[j]\]
    • Design Motivation: Full voxel-to-voxel attention leads to computational explosion and introduces noise. Restricted attention on geometrically corresponding positions is both fast and robust, equivalent to explicitly "finding the best corresponding local part" without pose alignment.

Loss & Training

$\(\text{Loss} = \mathcal{L}^{\text{bce}} + \mathcal{L}^r\)$ where \(\mathcal{L}^{\text{bce}}\) is the binary cross-entropy for anomaly classification, and \(\mathcal{L}^r\) includes three rendering reconstruction terms: image, mask, and feature. Note that ground-truth 3D bounding boxes are not required during training.

Key Experimental Results

Main Results

Both datasets are new benchmarks: - ToysAD-8K: 8K scenes / 51 toy categories / 2,345 anomalous shapes (cracks, deformation, material swapping); training on 5K scenes (39 categories), testing on 1K (unseen instances from seen categories) + 2K (unseen categories). - PartsAD-15K: 4,200 mechanical parts from the ABC dataset / 10K anomalies / 15K scenes (3-12 objects); testing on completely unseen shapes.

OddOneOutAD significantly outperforms the following baselines on both datasets: - Single-instance AD baseline (adapted from MVTec-style methods); - 3D object detection baseline (trained with anomaly/normal as two classes); - Ablation variants without cross-instance attention.

Ablation Study

Configuration AUROC Drop
No DINOv2 distillation Significant drop (especially on unseen categories)
No cross-instance attention Substantial drop (degrades to single-instance AD)
Using dense (instead of sparse) attention Computational explosion and performance drop
Replacing DBScan with GT boxes Comparable performance, proving automatic boxes are sufficient
Number of views 5 → 3 Moderate drop, worsening self-occlusion issues

Key Findings

  • DINOv2 knowledge distillation is critical for generalization to unseen classes; without it, anomaly detection accuracy on unseen categories drops significantly.
  • Sparse voxel attention is both faster and more accurate than dense attention, as the correspondences are inherently sparse.
  • Five views are generally sufficient; adding more views yields diminishing returns while substantially increasing GPU memory consumption.

Highlights & Insights

  • Task Definition is the Core Contribution: Formalizing the real-world industrial inspection need for "cross-matching within the same batch" into a learnable problem, which is much closer to industrial application than traditional AD.
  • 3D Voxels as Natural Pose-Agnostic Representations: Avoids estimated poses for each object, as voxels are inherently aligned to the world system.
  • DINOv2 to 3D Distillation: Distills the dense semantics of 2D foundation models into 3D space, which can be extended to NeRF, 3DGS, or any work requiring 3D semantics.
  • Sparse Top-k Voxel Attention: An elegant design for efficient cross-instance comparison in 3D tasks, which can be transferred to point cloud registration and 6D pose estimation.

Limitations & Future Work

  • Assumes there are at least two normal instances in the scene to act as a "reference group"; with only one object, the task degrades to traditional AD.
  • Automatic DBScan segmentation is sensitive to density thresholds; very densely placed or thin-walled objects might stick together.
  • Generation of anomalous training samples relies on handcrafted rules (cracks, deformation); the actual distribution of anomalies in real industrial settings may differ.
  • The number of views is fixed at 5; online industrial pipelines may have sparser views or temporal changes.
  • Future Directions: Extend cross-instance matching to the temporal dimension to perform "current batch vs. historical batches".
  • vs. MVTec-AD / VisA Styles: This work focuses on multi-object, multi-view scenarios where anomalies are scene-specific.
  • vs. PAD (Zhou et al.): PAD is pose-agnostic but remains single-instance; this work supports mutual multi-instance comparison.
  • vs. 3D Detection Baselines: Training normal/anomaly as separate classes fails to generalize to unseen shapes, whereas the comparative paradigm of this work succeeds.
  • Inspirations: Any visual task involving "compares with other members of the same group" (e.g., individual identification, defect screening, multi-lesion medical comparisons) can benefit from the sparse voxel cross-attention mechanism.

Rating

  • Novelty: ⭐⭐⭐⭐⭐ Strong novelty in task definition, datasets, and methodology.
  • Experimental Thoroughness: ⭐⭐⭐⭐ Two new benchmarks, exhaustive ablation, and thorough comparison between seen and unseen classes.
  • Writing Quality: ⭐⭐⭐⭐ Clear motivation, formulation, and illustrations.
  • Value: ⭐⭐⭐⭐⭐ A practical new paradigm for industrial quality inspection, with dataset and code fully open-source.