
图1:使用使用我们的方法发现的控件执行的图像编辑序列,应用于三种不同的gan。白色插图使用第3.4节中解释的符号('Layer-Wise-Wise编辑')指定了特定的编辑。
甘斯空间:发现可解释的甘恩控件
ErikHärkönen1,2 ,Aaron Hertzmann 2 ,Jaakko Lehtinen 1,3 ,Sylvain Paris 2
1 Aalto University, 2 Adobe Research, 3 Nvidia
https://arxiv.org/abs/2004.02546摘要:本文介绍了一种简单的技术,可以分析生成对抗网络(GAN)并为图像合成创建可解释的控件,例如观点的改变,老化,照明和一天中的时间。我们基于在激活空间中应用的主成分分析(PCA)确定重要的潜在方向。然后,我们表明可以根据这些编辑说明的层应用来定义可解释的编辑。此外,我们表明Biggan可以以类似于样式的方式通过层次输入来控制。用户可以通过这些机制确定大量可解释的控件。我们证明了来自各个数据集的gan的结果。
视频: https://youtu.be/jdticda_eai
请参阅设置说明。
该存储库包括Biggan,stylegan和stylegan2的版本,以支持每层潜在向量。
交互式模型探索
# Explore BigGAN-deep husky
python interactive.py --model=BigGAN-512 --class=husky --layer=generator.gen_z -n=1_000_000
# Explore StyleGAN2 ffhq in W space
python interactive.py --model=StyleGAN2 --class=ffhq --layer=style --use_w -n=1_000_000 -b=10_000
# Explore StyleGAN2 cars in Z space
python interactive.py --model=StyleGAN2 --class=car --layer=style -n=1_000_000 -b=10_000
# Apply previously saved edits interactively
python interactive.py --model=StyleGAN2 --class=ffhq --layer=style --use_w --inputs=out/directions
可视化主组件
# Visualize StyleGAN2 ffhq W principal components
python visualize.py --model=StyleGAN2 --class=ffhq --use_w --layer=style -b=10_000
# Create videos of StyleGAN wikiart components (saved to ./out)
python visualize.py --model=StyleGAN --class=wikiart --use_w --layer=g_mapping -b=10_000 --batch --video
选项
Command line paramaters:
--model one of [ProGAN, BigGAN-512, BigGAN-256, BigGAN-128, StyleGAN, StyleGAN2]
--class class name; leave empty to list options
--layer layer at which to perform PCA; leave empty to list options
--use_w treat W as the main latent space (StyleGAN / StyleGAN2)
--inputs load previously exported edits from directory
--sigma number of stdevs to use in visualize.py
-n number of PCA samples
-b override automatic minibatch size detection
-c number of components to keep
主论文中介绍的所有数字均可使用随附的Jupyter笔记本重新创建:
figure_teaser.ipynbfigure_pca_illustration.ipynbfigure_pca_cleanup.ipynbfigure_style_content_sep.ipynbfigure_supervised_comp.ipynbfigure_biggan_style_resampling.ipynbfigure_edit_zoo.ipynb BaseModel接口在models/wrappers.py中为模型创建包装器。models/wrappers.py中的get_model() 。 可以将经过训练的stylegan和stylegan2权重从TensorFlow导入到甘斯空间中。
conda install tensorflow-gpu=1.* 。__init__() , models/wrappers.py中的load_model() class stylegan。checkpoints/stylegan2/<dataset>_<resolution>.pt 。__init__() ,class stylegan2下的models/wrappers.py中的download_checkpoint() 。 我们要感谢:
@inproceedings{härkönen2020ganspace,
title = {GANSpace: Discovering Interpretable GAN Controls},
author = {Erik Härkönen and Aaron Hertzmann and Jaakko Lehtinen and Sylvain Paris},
booktitle = {Proc. NeurIPS},
year = {2020}
}
该存储库的代码在Apache 2.0许可证下发布。
目录netdissect是GAN解剖项目的衍生产品,并根据MIT许可提供。
Directories models/biggan和models/stylegan2根据MIT许可提供。