Spatially-weighted Anomaly Detection

Minori Narita, Daiki Kimura, Ryuki TachibanaarXiv 2018

Abstract

Many types of anomaly detection methods have been proposed recently, and applied to a wide variety of fields including medical screening and production quality checking. Some methods have utilized images, and, in some cases, a part of the anomaly images is known beforehand. However, this kind of information is dismissed by previous methods, because the methods can only utilize a normal pattern. Moreover, the previous methods suffer a decrease in accuracy due to negative effects from surrounding noises. In this study, we propose a spatially-weighted anomaly detection method (SPADE) that utilizes all of the known patterns and lessens the vulnerability to ambient noises by applying Grad-CAM, which is the visualization method of a CNN. We evaluated our method quantitatively using two datasets, the MNIST dataset with noise and a dataset based on a brief screening test for dementia.

Introduction

In real-world anomaly detection—ranging from medical diagnostics to industrial quality control—practitioners often possess a large corpus of "normal" data alongside a smaller, valuable set of known anomaly patterns. Existing methodologies typically fall into two categories, each with significant drawbacks. Autoencoder-based models, trained only on normal data, are robust to unknown patterns but ignore known anomalies and are sensitive to background noise. Conversely, CNN-based classifiers utilize known anomalies but fail to generalize to novel, unseen patterns, often misclassifying them into known categories.

Overview of the anomaly detection pipeline using depth sensors for hand gesture analysis.

This research introduces SPADE (Spatially-weighted Anomaly Detection), a framework designed to leverage known anomaly data to guide the model's attention without sacrificing the ability to detect novel anomalies.

Methods: The SPADE Architecture

SPADE bridges the gap between reconstruction-based and classification-based detection by combining a Variational Auto-Encoder (VAE) with a CNN binary classifier.

The SPADE architecture, integrating a VAE for reconstruction and a CNN with modified Grad-CAM for spatial weighting.

The VAE is trained exclusively on normal data to compute pixel-wise reconstruction errors. Simultaneously, a CNN is trained on both normal and known anomaly images. Rather than using the CNN's final classification output, SPADE employs Grad-CAM to generate a spatial Region of Interest (ROI) map. This map acts as a weight for the VAE's reconstruction error, focusing the detection logic on the most relevant parts of the image and filtering out ambient noise.

Grad-CAM Enhancements

To optimize Grad-CAM for anomaly detection, the authors introduced three key modifications:

  • Absolute Activation: Unlike standard Grad-CAM which uses ReLU to find positive contributions, SPADE uses an Absolute (Abs) function to capture features that indicate dissimilarity to the normal class.
  • Dual ROI Extraction: ROIs are extracted from both the input and the VAE-reconstructed image. This ensures the model maintains focus on the target object even if the input is heavily distorted.
  • Normalization: ROI weights are normalized to ensure that larger regions do not disproportionately inflate the error score.

Experimental Evaluation

The method was tested on two distinct datasets:

  • MNIST with Noise: Digits were randomly placed in a noisy 84x84 canvas. One digit served as a "known" anomaly, while others were "unknown."
  • Pigeon Hand Gesture Dataset: A real-world dataset for dementia screening containing 189,000 depth images. It features participants performing the Yamaguchi Fox-Pigeon Imitation Test, with various correct and incorrect gestures.

Key Results

SPADE demonstrated superior performance across both benchmarks:

  • MNIST with Noise: SPADE achieved an AUROC of 0.88, significantly outperforming the standard VAE (0.63).
  • Pigeon Hand Gesture: SPADE reached an AUROC of 0.97, surpassing both the VAE baseline (0.95) and the CNN classifier (0.91).

Conclusion

By decoupling localization (via CNN/Grad-CAM) from detection (via VAE reconstruction error), SPADE effectively utilizes known anomaly data to improve noise resilience while maintaining robustness against unknown patterns. Future work will explore applications in production quality checking and fraud detection.

Summary updated

BibTeX
@misc{narita2018spatially,
  author = {Minori Narita and Daiki Kimura and Ryuki Tachibana},
  title = {{Spatially-weighted Anomaly Detection}},
  year = {2018},
  eprint = {1810.02607},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1810.02607},
}
Figure