Skip to content

Pytorch implementation of FactorVAE proposed in Disentangling by Factorising(http://arxiv.org/abs/1802.05983)

License

Notifications You must be signed in to change notification settings

1Konny/FactorVAE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FactorVAE

Pytorch implementation of FactorVAE proposed in Disentangling by Factorising, Kim et al.(http://arxiv.org/abs/1802.05983)

Dependencies

python 3.6.4
pytorch 0.4.0 (or check pytorch-0.3.1 branch for pytorch 0.3.1)
visdom
tqdm

Datasets

  1. 2D Shapes(dsprites) Dataset
sh scripts/prepare_data.sh dsprites
  1. 3D Chairs Dataset
sh scripts/prepare_data.sh 3DChairs
  1. CelebA Dataset(download)
# first download img_align_celeba.zip and put in data directory like below
└── data
    └── img_align_celeba.zip

# then run scrip file
sh scripts/prepare_data.sh CelebA

then data directory structure will be like below

.
└── data
    └── dsprites-dataset
        └── dsprites_ndarray_co1sh3sc6or40x32y32_64x64.npz
    ├── 3DChairs
        └── images
            ├── 1_xxx.png
            ├── 2_xxx.png
            ├── ...
    ├── CelebA
        └── img_align_celeba
            ├── 000001.jpg
            ├── 000002.jpg
            ├── ...
            └── 202599.jpg
    └── ...

NOTE: I recommend to preprocess image files(e.g. resizing) BEFORE training and avoid preprocessing on-the-fly.

Usage

initialize visdom

python -m visdom.server

you can reproduce results below as follows

e.g.
sh scripts/run_celeba.sh $RUN_NAME
sh scripts/run_dsprites_gamma6p4.sh $RUN_NAME
sh scripts/run_dsprites_gamma10.sh $RUN_NAME
sh scripts/run_3dchairs.sh $RUN_NAME

or you can run your own experiments by setting parameters manually

e.g.
python main.py --name run_celeba --dataset celeba --gamma 6.4 --lr_VAE 1e-4 --lr_D 5e-5 --z_dim 10 ...

check training process on the visdom server

localhost:8097

Results - 2D Shapes(dsprites) Dataset

Reconstruction($\gamma$=6.4)

Latent Space Traverse($\gamma$=6.4)


Latent Space Traverse($\gamma$=10)

Results - CelebA Dataset

Reconstruction

Latent Space Traverse


Results - 3D Chairs Dataset

Reconstruction

Latent Space Traverse


Reference

  1. Disentangling by Factorising, Kim et al.(http://arxiv.org/abs/1802.05983)