Implementation of DASVDD (Deep Autoencoding Support Vector Data Descriptor) for anomaly detection and one-class classification.
The project combines dataset-specific autoencoders with an SVDD-inspired objective to learn compact representations of normal data and score anomalies through reconstruction quality and distance to a learned center.
- Supports
MNIST,FMNIST,CIFAR,Speech, andPIMA - Includes dataset-specific autoencoder architectures
- Tunes the SVDD weighting term before training
- Uses deterministic preprocessing for reproducible runs
- Provides a simple command-line interface for running experiments
.
├── main.py # CLI entry point
├── src/
│ ├── core/ # Training, evaluation, and gamma tuning
│ ├── data/ # Dataset loaders and preprocessing helpers
│ └── models/ # Dataset-specific autoencoders
├── data/ # Local tabular datasets
└── requirements.txt # Python dependencies
git clone https://github.com/Armanfard-Lab/DASVDD.git
cd DASVDD
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtRun DASVDD on any supported dataset:
python3 main.py --dataset MNIST --target_class 0 --epochs 30 --batch_size 128Example runs:
python3 main.py --dataset FMNIST --target_class 3 --epochs 20
python3 main.py --dataset CIFAR --target_class 1 --epochs 10
python3 main.py --dataset PIMA --epochs 30
python3 main.py --dataset Speech --epochs 30For Speech and PIMA, --target_class is ignored because the datasets already include anomaly labels.
| Argument | Description | Default |
|---|---|---|
--dataset |
Dataset to use for training and evaluation | Required |
--target_class |
Normal class for one-class image datasets | 0 |
--epochs |
Number of training epochs | 30 |
--batch_size |
Training mini-batch size | 128 |
MNISTandFMNISTare downloaded automatically throughtorchvision.CIFARis downloaded automatically and normalized with global contrast normalization.SpeechandPIMAare loaded from the localdata/directory.- Tabular datasets are shuffled with a fixed seed before splitting so evaluation is reproducible without depending on CSV row order.
- The refactored modules expose clearer APIs under
src.core,src.data, andsrc.models. - Backward-compatible aliases such as
DASVDD_trainer,DASVDD_test, andAE_MNISTare still available for older notebooks or scripts.
The CLI prints progress for:
- gamma tuning
- DASVDD training
- final
ROC-AUCevaluation
If you use this repository in academic work, please cite:
@ARTICLE{DASVDD,
author={Hojjati, Hadi and Armanfard, Narges},
journal={IEEE Transactions on Knowledge and Data Engineering},
title={DASVDD: Deep Autoencoding Support Vector Data Descriptor for Anomaly Detection},
year={2024},
volume={36},
number={8},
pages={3739-3750},
keywords={Anomaly detection;Training;Task analysis;Support vector machines;Image reconstruction;Data models;Benchmark testing;Anomaly detection;deep autoencoder;deep learning;support vector data descriptor},
doi={10.1109/TKDE.2023.3328882}
}Paper link: IEEE Xplore