Table of Contents
Fetching ...

VAE with Hyperspherical Coordinates: Improving Anomaly Detection from Hypervolume-Compressed Latent Space

Alejandro Ascarate, Leo Lebrat, Rodrigo Santa Cruz, Clinton Fookes, Olivier Salvado

TL;DR

The paper tackles anomaly detection in high-dimensional VAE latent spaces, where standard Gaussian priors cause concentration near equators on the hypersphere and hinder detection. It introduces a VAE variant that operates in hyperspherical coordinates, deriving a KLD-like loss in angular and radial coordinates and applying volume compression to push normal data away from equators, forming a dense latent island. The method, including both fully unsupervised and OOD setups, shows state-of-the-art or competitive performance on real-world datasets (Mars Rover, Galaxy Zoo) and benchmarks (CIFAR-10 vs CIFAR-100, Imagenette vs close ImageNet), with clear qualitative 3D visualizations of the latent structure. The approach is generalizable to other VAE variants and provides practical improvements for HD anomaly detection, at a modest computational overhead and with a compact set of hyperparameters.

Abstract

Variational autoencoders (VAE) encode data into lower-dimensional latent vectors before decoding those vectors back to data. Once trained, one can hope to detect out-of-distribution (abnormal) latent vectors, but several issues arise when the latent space is high dimensional. This includes an exponential growth of the hypervolume with the dimension, which severely affects the generative capacity of the VAE. In this paper, we draw insights from high dimensional statistics: in these regimes, the latent vectors of a standard VAE are distributed on the `equators' of a hypersphere, challenging the detection of anomalies. We propose to formulate the latent variables of a VAE using hyperspherical coordinates, which allows compressing the latent vectors towards a given direction on the hypersphere, thereby allowing for a more expressive approximate posterior. We show that this improves both the fully unsupervised and OOD anomaly detection ability of the VAE, achieving the best performance on the datasets we considered, outperforming existing methods. For the unsupervised and OOD modalities, respectively, these are: i) detecting unusual landscape from the Mars Rover camera and unusual Galaxies from ground based imagery (complex, real world datasets); ii) standard benchmarks like Cifar10 and subsets of ImageNet as the in-distribution (ID) class.

VAE with Hyperspherical Coordinates: Improving Anomaly Detection from Hypervolume-Compressed Latent Space

TL;DR

The paper tackles anomaly detection in high-dimensional VAE latent spaces, where standard Gaussian priors cause concentration near equators on the hypersphere and hinder detection. It introduces a VAE variant that operates in hyperspherical coordinates, deriving a KLD-like loss in angular and radial coordinates and applying volume compression to push normal data away from equators, forming a dense latent island. The method, including both fully unsupervised and OOD setups, shows state-of-the-art or competitive performance on real-world datasets (Mars Rover, Galaxy Zoo) and benchmarks (CIFAR-10 vs CIFAR-100, Imagenette vs close ImageNet), with clear qualitative 3D visualizations of the latent structure. The approach is generalizable to other VAE variants and provides practical improvements for HD anomaly detection, at a modest computational overhead and with a compact set of hyperparameters.

Abstract

Variational autoencoders (VAE) encode data into lower-dimensional latent vectors before decoding those vectors back to data. Once trained, one can hope to detect out-of-distribution (abnormal) latent vectors, but several issues arise when the latent space is high dimensional. This includes an exponential growth of the hypervolume with the dimension, which severely affects the generative capacity of the VAE. In this paper, we draw insights from high dimensional statistics: in these regimes, the latent vectors of a standard VAE are distributed on the `equators' of a hypersphere, challenging the detection of anomalies. We propose to formulate the latent variables of a VAE using hyperspherical coordinates, which allows compressing the latent vectors towards a given direction on the hypersphere, thereby allowing for a more expressive approximate posterior. We show that this improves both the fully unsupervised and OOD anomaly detection ability of the VAE, achieving the best performance on the datasets we considered, outperforming existing methods. For the unsupervised and OOD modalities, respectively, these are: i) detecting unusual landscape from the Mars Rover camera and unusual Galaxies from ground based imagery (complex, real world datasets); ii) standard benchmarks like Cifar10 and subsets of ImageNet as the in-distribution (ID) class.
Paper Structure (19 sections, 8 equations, 2 figures, 3 tables)

This paper contains 19 sections, 8 equations, 2 figures, 3 tables.

Figures (2)

  • Figure 1: Proposed method for the fully unsupervised case. The standard VAE (left) is modified (right) by converting the latent vectors into hyperspherical coordinates. In our new formulation, the latent vectors from the normal class in green can be moved during training towards a given direction on the hypersphere, forming a dense and compact "island", illustrated here by projecting the latent distributions on a 2D sphere (see subsection Results \ref{['subsec:results']} for more details about how this is done). Anomalies in red are detected by measuring their distance to the island. The figure corresponds to results from the experiment on the Galaxy Zoo dataset (cf. Table \ref{['tab:AUC_FPR_table']}, third column).
  • Figure 2: Proposed method for the OOD case. In this case, a compression of the same type as in the previous figure is done on each of the ID class clusters, simply by re-orienting the full hyperspherical coordinate system such that the first angular coordinate is the angle w.r.t. the Cartesian orthogonal axis whose number is equal to a corresponding ID class label. The von Mises-Fisher-based method (von MF) shows more noisy and dispersed samples because having only one single parameter (the first hyperspherical angle) to compress the volume and thus reduce the sparsity of the HD space is not enough, as we show in the Supplementary materials (Supp.), where we also see that t-SNE can be misleading for assessing compression. In contrast, our method compresses all of the hyperspherical angles. The figure corresponds to results from the experiment on Imagenette vs close Imagenet (cf. Table \ref{['tab:nearood-imagenette']}).