The reproduction is still ongoing. Please refer the following logs for current and future updates:
- Individual implimentation using official and partial references as mentioned in the paper is updated.
- Single-Click result implimentation is ongoing.
- Other autoencoder models will be added in the future.
This repository introduces the paper "A Comprehensive Study of Auto-Encoders for Anomaly Detection: Efficiency and Trade-Offs" by Asif Ahmed Neloy and Dr. Max Turgeon.
The following autonencoders are reproduced in this repository:
- Denoising Auto-Encoder (DAE)
- Sparse Auto-Encoder (SAE)
- Contractive Auto-Encoder (CAE)
- Variational Auto-Encoder (VAE)
- Conditional Variational Auto-Encoder (CVAE)
- beta-VAE
- Adversarial Variational Auto-Encoder (adVAE)
- Importance Weighted Auto-Encoder (IWAE)
- Probabilistic Auto-Encoder (PAE)
- Robust Deep Auto-Encoders (RDA)
- Vector Quantised-Variational Auto-Encoder (VQ-VAE)
The reproducibility process is divided into two process-
- Reproduce individual results using the Official repos or Particial reference repos
- Reproduce all results using the modified models.
The requirements.txt
file contains python packages for reproducing all models. There is no individual requirements.txt file.
- Anaconda
- Python 3.7.11
- Windows 10/11 (also can be reproduced using any linux machine. However, the package requirements needs to be adjusted)
- GPUs (PyTorch and TensorFlow are created using gpu models)
- create new env:
conda create -name autoencoder python=3.7 -y
- activate env:
conda activate autoencoder
- open the directory and install the
requirements.txt
:pip install -r requirements.txt
- Navigate to the Directory:
\Partial References\DAE\
- Run:
python main.py
- Navigate to the Directory:
\Partial References\SAE\
- Run:
python main.py
- Optional Result:
python sparseae_generic.py
- Navigate to the Directory:
\Partial References\CAE\
- Run:
python main.py
- Optional: Change parameters in Fashion-MNIST implementation
python main_FashionMNIST.py
-
Navigate to the Directory:
Official Repos\VAE
-
Run:
python run_main.py --dim_z 20
-
Required Arguments
--dim_z
: Dimension of latent vector. Default:20
-
Optional:
--results_path
: File path of output images. Default:results
--add_noise
: Boolean for adding salt & pepper noise to input image. Default:False
--n_hidden
: Number of hidden units in MLP. Default:500
--learn_rate
: Learning rate for Adam optimizer. Default:1e-3
--num_epochs
: The number of epochs to run. Default:20
--batch_size
: Batch size. Default:128
--PRR
: Boolean for plot-reproduce-result. Default:True
--PRR_n_img_x
: Number of images along x-axis. Default:10
--PRR_n_img_y
: Number of images along y-axis. Default:10
--PRR_resize_factor
: Resize factor for each displayed image. Default:1.0
--PMLR
: Boolean for plot-manifold-learning-result. Default:False
--PMLR_n_img_x
: Number of images along x-axis. Default:20
--PMLR_n_img_y
: Number of images along y-axis. Default:20
--PMLR_resize_factor
: Resize factor for each displayed image. Default:1.0
--PMLR_n_samples
: Number of samples in order to get distribution of labeled data. Default:5000
- Navigate to the Directory:
\Partial References\CVAE\
- Train and generate CVAE result:
python main.py
- Train and generate VAE result:
python VAE.py
- Testing Results:
python test_generation.py
- Navigate to the Directory:
Official Repos\Beta_VAE
- Train:
python train.py --z_dim 10 --beta 0.1 --dataset mnist --model conv_mnist --experiment_name z10_beta0.1_mnist_conv
- Alternative:
train.py --z_dim 10 --beta 0.1 --dataset mnist --model mlp_mnist --experiment_name z10_beta0.1_mnist_mlp
-
Go to the directory:
cd Official Repos\adVAE
-
Train model:
python run.py
-
optional parameters:
--datnorm
, type=bool, default=True
,help='Data normalization'
--z_dim
, type=int, default=128
,help='Dimension of latent vector'
--mx
, type=int, default=1
,help='Positive margin of MSE target.'
--mz
, type=int, default=1
,help='Positive margin of KLD target.'
--lr
, type=int, default=1e-4
,help='Learning rate for training'
--epoch
, type=int, default=100
,help='Training epoch'
--batch
, type=int, default=32
,help='Mini batch size'
-
Navigate to the Directory:
\Partial References\IWAE
-
For implementing the result mentioned in the reference paper:
python experiments.py --model [model] --dataset [dataset] --k [k] --layers [l]
(where model is vae or iwae; dataset is one of BinFixMNIST, MNIST, OMNI; k is 1, 5, or 50; l is 1 or 2.) -
Optional implementation:
python experiments.py --exp iwae_to_vae
-
Optional:
python download_mnist.py
: Download MNIST Dataset. Default:mnist
- Navigate to the Directory:
cd \Official Repos\PAE
- Run the python file:
python main.py --helpfull
- Optional Training:
python main.py
- Open the Directory:
cd \Official Repos\RDA
- Train and regenerate:
python main.py
- Compare to VAE:
python VAE_SRDA.py
-
Navigate to the Directory:
Official Repos\VQ_VAE
-
Run:
python main.py --MNIST
-
Required Arguments
--dataset
: Dataset. Default:CIFAR-10
-
Optional:
--batch_size
, type=int, default=32
*)--n_updates
, type=int, default=5000
)- (
--n_hiddens
, type=int, default=128
) - (
--n_residual_hiddens
, type=int, default=32
) - (
--n_residual_layers
, type=int, default=2
) - (
--embedding_dim
, type=int, default=64
) - (
--n_embeddings
, type=int, default=512
) - (
--beta
, type=float, default=.25
) - (
--learning_rate
, type=float, default=3e-4
) - (
--log_interval
, type=int, default=50
)
ALL RESULTS is implemented to visualize the ROC-AUC, Latent Space Representation and Manifolds for MNIST, FASHION_MNIST datasets for all models regardless of the training parameters and hyper-parameters. (On-going)