Github: https://github.com/openai/glow
グロー
あらかじめ用意されたCelebA-HQモデルを使用するには、独自の操作ベクトルを作成し、インタラクティブなデモを実行し、 demo
フォルダを確認します。
要件
- Tensorflow(v1.8.0でテスト済み)
- Horovod(v0.13.8でテスト済み)と(open)MPI
走る
pip install -r requirements.txt
MPIをセットアップ(開く)するには、Horovod github ページの指示を確認してください 。
データセットをダウンロード
データセットはGoogle Cloudの場所https://storage.googleapis.com/glow-demo/data/{dataset_name}-tfr.tar
。 dataset_namesは以下の通りですが、尤度の正しい比較のための正確な前処理/ダウンサンプリング方法について言及します。
定量的結果
-
imagenet-oord
– 無条件ImageNet 32x32および64×64(PixelRNN / RealNVPの論文に記載されています)。 -
lsun_realnvp
– LSUN 96×96。 RealNVPで説明されているように、処理時に64×64のランダムな作物が撮影されます。
定性的結果
-
celeba
– CelebA-HQ 1024×1024データセット、GANのプログレッシブな成長に記載されています。 -
imagenet
– ImageNet 32x32および64×64(クラスラベル付き) センタークロップ、エリアダウンサンプリング。 -
lsun
– LSUN 256×256。 センタークロップ、エリアダウンサンプリング。
例えば、セレブをダウンロードして抽出するには、
wget https://storage.googleapis.com/glow-demo/data/celeba-tfr.tar
tar -xvf celeb-tfr.tar
train.pyファイルのhps.data_dir
を上記のフォルダを指すように変更します(または、 --data_dir
を実行するときに--data_dir
フラグを使用します)
シンプルトレイン、1 GPU
小さな深さでテストを実行する
CUDA_VISIBLE_DEVICES=0 python train.py --depth 1
MPIとHorovodを使用して複数のGPUでトレーニングする
8つのGPUでデフォルトのトレーニングスクリプトを実行する:
mpiexec -n 8 python train.py
アブレーション実験
mpiexec -n 8 python train.py --problem cifar10 --image_size 32 --n_level 3 --depth 32 --flow_permutation [0/1/2] --flow_coupling [0/1] --seed [0/1/2] --learntop --lr 0.001
CIFAR-10定量結果
mpiexec -n 8 python train.py --problem cifar10 --image_size 32 --n_level 3 --depth 32 --flow_permutation 2 --flow_coupling 1 --seed 0 --learntop --lr 0.001 --n_bits_x 8
ImageNet 32x32定量結果
mpiexec -n 8 python train.py --problem imagenet-oord --image_size 32 --n_level 3 --depth 48 --flow_permutation 2 --flow_coupling 1 --seed 0 --learntop --lr 0.001 --n_bits_x 8
ImageNet 64×64定量結果
mpiexec -n 8 python train.py --problem imagenet-oord --image_size 64 --n_level 4 --depth 48 --flow_permutation 2 --flow_coupling 1 --seed 0 --learntop --lr 0.001 --n_bits_x 8
LSUN 64×64定量結果
mpiexec -n 8 python train.py --problem lsun_realnvp --category [bedroom/church_outdoor/tower] --image_size 64 --n_level 3 --depth 48 --flow_permutation 2 --flow_coupling 1 --seed 0 --learntop --lr 0.001 --n_bits_x 8
CelebA-HQ 256×256定性的結果
mpiexec -n 40 python train.py --problem celeba --image_size 256 --n_level 6 --depth 32 --flow_permutation 2 --flow_coupling 0 --seed 0 --learntop --lr 0.001 --n_bits_x 5
LSUN 96×96および128×128定性的結果
mpiexec -n 40 python train.py --problem lsun --category [bedroom/church_outdoor/tower] --image_size [96/128] --n_level 5 --depth 64 --flow_permutation 2 --flow_coupling 0 --seed 0 --learntop --lr 0.001 --n_bits_x 5
条件付きCIFAR-10定性的結果
mpiexec -n 8 python train.py --problem cifar10 --image_size 32 --n_level 3 --depth 32 --flow_permutation 2 --flow_coupling 0 --seed 0 --learntop --lr 0.001 --n_bits_x 5 --ycond --weight_y=0.01
条件付きImageNet 32x32定性的結果
mpiexec -n 8 python train.py --problem imagenet --image_size 32 --n_level 3 --depth 48 --flow_permutation 2 --flow_coupling 0 --seed 0 --learntop --lr 0.001 --n_bits_x 5 --ycond --weight_y=0.01