Implementation of VAE Model inspired by NormVAE Paper using PyTorch Framework on Custom Dataset of Healthy Controls(ADNI Dataset).
Model's Objective: To reconstruct samples using the decoder part of the VAE which resemble that of Healthy Control Brain Region Volumes from the Dataset Paper link: Link to the NormVAE paper
Model Architecture from the Paper:
Source : NormVAE: Normative Modelling on Neuroimaging Data using Variational Autoencoders paper, Fig. 1pip install -r requirements.txt
The following packages will be installed :
- PyTorch
- Numpy
- Pandas
- Scikit-Learn
python data_preprocessing.py --path "/path/to/dataset" --bsize #batchsize
- An example:
python data_preprocessing.py --path "dataset.xlsx" --bsize 64
- Download the code from the repository and get the dataset file or modify the dimensions in the code for your dataset.
- After downloading the repository from the terminal go to the directory and Install depedencies using :
pip install -r requirements.txt
- Preprocess data using the data preprocessing script
python data_preprocessing.py --path "/path/to/dataset" --bsize #batchsize
- To generate the reconstructed samples along with training the model:
- number of samples can be given using --gensamples
python reconstruct.py --bsize #batchsize --epochs #epochs --gensamples #no.ofsamples --output_format {outputformat as string}
python data_preprocessing.py --path "dataset.xlsx" --bsize 64
python train_model.py --epochs 1000 --bsize 1024
- To save the reconstructed samples in excel file:
python data_preprocessing.py --path "dataset.xlsx" --bsize 64
python reconstruct.py --bsize 64 --epochs 1000 --gensamples 20 --output_format "xlsx"
- To save the reconstructed samples as csv file:
python data_preprocessing.py --path "dataset.xlsx" --bsize 64
python reconstruct.py --bsize 64 --epochs 1000 --gensamples 20 --output_format "csv"
Note: The above command performs training of the model and generates reconstructed samples from the decoder part of the VAE in an excel file with name reconstruct.xlsx
or reconstruct.csv
if you choose the output_format as csv
. Default output format is xlsx
.
- For more help on how to use the model with different hyperparameters:
python train_model.py -h
sayantan.k (2022) NormVAE: Normative modelling on neuroimaging data using Variational Autoencoders, arXiv:2110.04903v2 [eess.IV] 30 Jan 2022