SSAD


Date

Formats

Categories

Content

The Self-Supervised Anomaly Detection (SSAD) library is a Python framework dedicated to self-supervised training of autoencoder-based reconstruction models for anomaly detection. It formalizes and industrializes the concepts introduced in our previous works:

  • N. Najari, S. Berlemont, G. Lefebvre, S. Duffner, and C. Garcia, RADON: Robust Autoencoder for Unsupervised Anomaly Detection, SIN 2021, pp. 1–8. doi: 10.1109/SIN54109.2021.9699174
  • N. Najari, S. Berlemont, G. Lefebvre, S. Duffner, and C. Garcia, Robust Variational Autoencoders and Normalizing Flows for Unsupervised Network Anomaly Detection, AINA 2022, LNNS 450, pp. 281–292. doi: 10.1007/978-3-030-99587-4_24

Reconstruction-based anomaly detection methods rely on the following principle: the model is trained to compress and then decompress the data it is given. Compression loses information, while decompression adds it. This learning mechanism is particularly appealing because it can be performed in a fully unsupervised, id est, without manual labeling by experts, which is often costly or even impossible. The expectation is that the model will produce a faithful reconstruction for normal data, id est, data drawn from the same distribution as the training set, while anomalous data should not be reconstructed correctly. Without a dedicated training strategy, a reconstruction-based model will learn to reconstruct the entire training set indiscriminately. Any anomalies already present are therefore, by definition, included in what is treated as normal data. This process requires a contamination-free training set, which is generally impossible in real-world settings.

The core contribution of SSAD is to leverage self-supervision during training to make anomaly detection more robust to contamination in the training dataset. Robustness is a property of the training process that allows the model to avoid being biased by unidentified anomalies during training. Unlike approaches that assume a “clean” dataset (without anomalies), SSAD is built on a more realistic assumption: training data may contain a non-negligible proportion of anomalies. The framework periodically adapts the training process, notably by performing:

  • Analysis of reconstruction score distributions via heuristics (distribution_analyzer) to explicitly separate value intervals into normal / abnormal / uncertain zones (confidence_interval_configuration)
  • Confidence scoring for each sample’s membership in these zones using confidence estimators (confidence_estimator)
  • A new multi-objective loss structure that jointly targets reconstruction of normal samples and deconstruction of anomalies, while allowing weighting of sample importance through confidence scores
  • With this self-supervised learning backbone, SSAD provides a clear and modular API, enabling the exploration and combination of new heuristics and self-supervision processes, while reusing existing modules as-is, ex. model infrastructures or reconstruction objectives.

    The code is available on GitHub under the MIT licence.