Figure 1: Semantic factorization through constrained traversal. The examples are discovered by constraining the latent traversal to a subset of the layers. The subset is chosen among the coarse, middle, and fine layers defined by StyleGAN. It can be seen that semantics are well factorized.
- Change environment.yml CUDA version to yours [CUDA version must be 10.x]
- Create environment:
conda create -n local_basis python=3.7
- Activate environment:
conda activate local_basis
- Install dependencies:
conda env update -f environment.yml --prune
Optional
4. `cd models/stylegan2/stylegan2-pytorch/op`
5. `python setup.py install`
6. Test: `python -c "import torch; import upfirdn2d_op; import fused; print('OK')"`
All code is implemented in jupyter notebook.
- Install TensorFlow:
conda install tensorflow-gpu=1.*
. - Modify methods
__init__()
,load_model()
inmodels/wrappers.py
under class StyleGAN.
- Follow the instructions in models/stylegan2/stylegan2-pytorch/README.md. Make sure to use the fork in this specific folder when converting the weights for compatibility reasons.
- Save the converted checkpoint as
checkpoints/stylegan2/<dataset>_<resolution>.pt
. - Modify methods
__init__()
,download_checkpoint()
inmodels/wrappers.py
under class StyleGAN2.
@article{choi2021not,
title={Do not escape from the manifold: Discovering the local coordinates on the latent space of GANs},
author={Choi, Jaewoong and Lee, Junho and Yoon, Changyeon and Park, Jung Ho and Hwang, Geonho and Kang, Myungjoo},
journal={arXiv preprint arXiv:2106.06959},
year={2021}
}
The files models/wrappers.py
, notebooks/ganspace_utils.py
and notebooks/notebook_utils.py
are a derivative of the GANSpace, and are provided under the Apache 2.0 license.
The directory netdissect
is a derivative of the GAN Dissection project, and is provided under the MIT license.
The directories models/biggan
and models/stylegan2
are provided under the MIT license.