Source-linked AI summary
Deep Anomaly Detection Using Geometric Transformations
Izhak Golan, Ran El-Yaniv
TL;DR
The paper asks how to detect out-of-distribution images using only normal-class training data. It trains a classifier to recognize geometric transformations and uses transformed-image softmax statistics for scoring; experiments report substantial improvements over state-of-the-art methods.
Problem
Image anomaly detection requires identifying out-of-distribution images from normal-class samples, while conclusive understanding for deep neural models remains lacking.
Method
The method trains a multi-class neural classifier to discriminate geometric transformations of normal images, then scores test images using softmax responses on transformed versions.
Results
32% average AUROC improvement over the top baseline was obtained across 10 CIFAR-10 experiments, and CatsVsDogs improved by 67%.
Takeaways & Limitations
The approach provides a discriminative, computationally efficient alternative to anomaly detectors requiring autoencoders or GANs.
Takeaways & Limitations
The normality score uses a naïve independence assumption for conditional distributions, which is typically incorrect.
Abstract
from arXiv · showhide
We consider the problem of anomaly detection in images, and present a new detection technique. Given a sample of images, all known to belong to a "normal" class (e.g., dogs), we show how to train a deep neural model that can detect out-of-distribution images (i.e., non-dog objects). The main idea behind our scheme is to train a multi-class model to discriminate between dozens of geometric transformations applied on all the given images. The auxiliary expertise learned by the model generates feature detectors that effectively identify, at test time, anomalous images based on the softmax activation statistics of the model when applied on transformed images. We present extensive experiments using the proposed detector, which indicate that our algorithm improves state-of-the-art methods by a wide margin.
1 Introduction
The paper targets image anomaly detection from normal-only samples, addressing limited understanding of deep neural approaches. It proposes discriminating among geometric transformations and reports large gains over existing methods.
- Image anomaly detection seeks classifiers that identify out-of-distribution instances from samples belonging to a normal class.
- Existing image methods primarily reconstruct normal-class images or learn low-dimensional representations with autoencoders or GANs.
- The proposed method trains a multi-class classifier to distinguish numerous geometric transformations applied to normal images, avoiding reconstruction.
- At test time, softmax response distributions on transformed images provide the basis for detecting novelties.
- 32% average AUROC improvement over the top baseline was achieved across 10 CIFAR-10 experiments, while CatsVsDogs improved by 67%.
2 Related Work
Related image anomaly-detection methods largely rely on reconstruction or representation learning, while a smaller set avoids reconstruction through alternatives such as deep one-class SVMs.
- Most published image anomaly-detection methods use unsupervised reconstruction learning.
- Reconstruction-based anomaly scores treat poor reconstruction quality, often measured by ℓ2 distance, as evidence of abnormality.
- Representation-learning methods reduce dimensionality before density estimation or jointly learn representations supporting density-based anomaly scores.
- Examples include energy-based regularized autoencoders and Gaussian mixture models built on autoencoder representations.
- Deep one-class SVMs provide a non-reconstruction alternative by optimizing a neural objective resembling SVDD.
3 Problem Statement
The problem is to learn an anomaly-scoring function from normal images that ranks samples by normality, with AUROC evaluating the resulting trade-off between error types.
- Given normal images from a set X, the goal is to classify images outside X as anomalies or novelties.
- The classifier should maximize performance under a type-II error constraint on normal samples incorrectly labeled anomalous.
- A scoring function nS(x) ranks samples by normality, with higher scores indicating greater likelihood of membership in X.
- AUROC measures the quality of the scoring function’s trade-off, while AUPR may be preferred when anomaly proportions are known.
4 Discriminative Learning of an Anomaly Scoring Function Using Geometric Transformations
The method creates a self-labeled dataset by applying geometric transformations to normal images, trains a classifier to recognize them, and scores test images using softmax statistics modeled with Dirichlet distributions.
- 4.1 Creating and Learning the Self-Labeled Dataset: Applying each transformation in T to every normal image creates a self-labeled dataset with |T| classes and |T||S| examples.
- 4.1 Creating and Learning the Self-Labeled Dataset: The transformation set includes the identity T0(x)=x and is treated as a method hyperparameter.
- 4.1 Creating and Learning the Self-Labeled Dataset: A deep k-class classifier is trained on transformed images using standard cross-entropy loss.
- 4.2 Dirichlet Normality Score: For an image x, y(x) is the classifier’s softmax-response vector, which is evaluated on each transformed version.
- 4.2 Dirichlet Normality Score: The normality score combines transformed-image log-likelihoods while approximating each conditional softmax distribution with a Dirichlet distribution.
- 4.2 Dirichlet Normality Score: The simplified score preserves the normality ordering while omitting terms constant with respect to x.
- 4.2 Dirichlet Normality Score: The simpler preliminary score avoids Dirichlet parameter estimation and performs only slightly worse than the Dirichlet score.
5 Experimental Results
The experiments evaluate the transformation-based detector against classic and deep-learning baselines across several image datasets and one-vs-all anomaly tasks. The method generally outperforms competing approaches, including on labeled multi-class out-of-distribution detection.
- Experimental setup: The evaluation compares the method with state-of-the-art deep-learning and classic anomaly detectors across CIFAR-10, CIFAR-100, CatsVsDogs, and fashion-MNIST.The experiments use one-vs-all evaluation, with only normal-class samples supplied during training.
- Implementation: The model uses a self-labeled classification task with 72 geometric transformations and a Wide Residual Network architecture.For 32x32 datasets, the reported WRN depth and width are 10 and 4.
- Results: 0.888 average AUROC was achieved for CatsVsDogs when dogs were the normal class, versus 0.561 for the best baseline, DSEBM.The trivial average AUROC is 0.5, regardless of the normal-to-anomalous class proportion.
- Results: The method’s relative advantage was strongest on larger images, while CIFAR-100 cases with diverse normal super-classes challenged the detector.Several CIFAR-100 normal classes, including non-insect invertebrates, insects, and household electrical devices, performed poorly.
- Labeled multi-class out-of-distribution detection: On CIFAR-10 versus resized Tiny ImageNet anomalies, the method improved ODIN’s AUROC/AUPR-In/AUPR-Out from 92.1/89.0/93.6 to 95.7/96.1/95.4.Unlike the proposed method, ODIN is described as inapplicable to the pure single-class setting.
6 On the Intuition for Using Geometric Transformations
The transformation set is intended to preserve spatial information while making transformations classifiable, because the detector relies on transformation-discrimination behavior. MNIST experiments show that performance depends on both transformation distinguishability and normal-class invariance.
- Transformation choice: The method uses 72 compositions of horizontal flipping, translations, and rotations, while non-geometric transformations were abandoned after degrading performance.The paper hypothesizes that non-geometric transformations can eliminate important features of the learned image set.
- Transformation choice: The detector is expected to work better when transformed normal images remain distinguishable and the classifier can predict the applied transformation.The paper also relates performance to preserving spatial information about normal images.
- MNIST experiments: 0.646 AUROC resulted when digit 8 was normal, digit 3 was anomalous, and identity versus horizontal flip was used.Because digit 8 is invariant to horizontal flipping, the classifier has difficulty learning distinguishing features.
- MNIST experiments: 0.957 AUROC resulted when digit 3 was normal, digit 8 was anomalous, and identity versus horizontal flip was used.The transformed variants of digit 3 were easily classified correctly.
- MNIST experiments: 0.919 AUROC resulted when digit 8 was normal, digit 3 was anomalous, and identity versus seven-pixel translation was used.The transformed images were distinguishable in this experiment.
- Normality-score visualization: Gradient ascent changed arbitrary digit-0 images toward digit 3 after 200 steps maximizing the normality score.This supports that the classifier learned features relevant to the normal digit class.
7 Conclusion and Future Work
The paper presents a discriminative image-anomaly detector that avoids generative components and reports substantial improvements over existing methods. It also identifies theoretical grounding and transformation selection as directions for future work.
- Conclusion: The method learns meaningful representations for image anomaly detection fully discriminatively and without autoencoders or GANs.The authors describe it as computationally efficient and simple to implement as a multi-class classification task.
- Conclusion: The experiments report dramatic improvements over the best available anomaly detection methods.
- Future Work: The authors propose developing theory to ground geometric transformations and selecting or optimizing transformations for particular training sets.
- Future Work: They suggest adapting the method to open-world scenarios and potentially improving multi-class classification performance.
A List of Geometric Transformations Used By Our Method
The method uses compositions of horizontal flips, translations, and rotations, yielding 72 geometric transformations. Each transformation is represented by choices for flipping, translation, and rotation.
- Transformation Components: The transformation set consists of horizontal flipping, translation, and rotation by multiples of 90 degrees.
- Transformation Components: Translations shift images by 0.25 of their height and width, with reflection completing missing pixels.
- Transformation Components: Rotations are counter-clockwise by k × 90 degrees, where k takes four values from 0 through 3.
- Complete Transformation Set: All possible compositions produce 2 × 3 × 3 × 4 = 72 transformations identified by (b, sw, sh, k).The identity transformation is (F, 0, 0, 0).
B Algorithm
The algorithm trains a softmax classifier on transformed normal images labeled by transformation identity, then derives a normality score from classifier outputs across transformations.
- Scoring Procedure: The scoring procedure uses a Digamma function whose inverse is calculated numerically with five Newton-Raphson iterations.
- Inputs and Output: Algorithm 1 takes normal images, geometric transformations, and a parametrized softmax classifier as input, returning a normality scoring function.
- Training Procedure: The self-labeled training set contains every transformed normal image paired with the index of its applied transformation.
- Training Procedure: The classifier is trained on the transformed labeled set until convergence.
- Scoring Procedure: For each transformation, the algorithm collects classifier outputs on transformed normal images before estimating the normality score.
- Datasets: The appendix lists dataset classes including 20 CIFAR-100 categories and the Cat and Dog classes in CatsVsDogs.
E Area Under the Precision-Recall Curve
The paper evaluates anomaly detection with precision-recall curves in two orientations: treating anomalies as either the negative or positive class. Results are reported as average PR area with standard errors over five runs.
- Evaluation Metric: Precision-recall curves may be more informative than ROC curves for highly skewed datasets.
- AUPR-In: AUPR-In measures area under the precision-recall curve when anomalies are treated as the negative class.
- Reporting: The tables report average precision-recall area in % with SEM computed over five runs for models trained on one class and tested against all others.
- AUPR-Out: AUPR-Out measures area under the precision-recall curve when anomalies are treated as the positive class.