Simple StyleGan2 for Pytorch
Simple working Pytorch implementation of Stylegan2 based on https://arxiv.org/abs/1912.04958
Below are some flowers that do not exist.
Neither do these hands
Nor these cities
Install
You will need a machine with a GPU and CUDA installed. Then pip install the package like this
$ pip install stylegan2_pytorch
If you are using a windows machine, the following commands reportedly works.
$ conda install pytorch torchvision -c python
$ pip install stylegan2_pytorch
Use
$ stylegan2_pytorch --data /path/to/images
That's it. Sample images will be saved to results/default and models will be saved periodically to models/default.
Advanced Use
You can specify the name of your project with
$ stylegan2_pytorch --data /path/to/images --name my-project-name
You can also specify the location where intermediate results and model checkpoints should be stored with
$ stylegan2_pytorch --data /path/to/images --name my-project-name --results_dir /path/to/results/dir --models_dir /path/to/models/dir
By default, if the training gets cut off, it will automatically resume from the last checkpointed file. If you want to restart with new settings, just add a new flag
$ stylegan2_pytorch --new --data /path/to/images --name my-project-name --image-size 512 --batch-size 1 --gradient-accumulate-every 16 --network-capacity 10
Once you have finished training, you can generate images from your latest checkpoint like so.
$ stylegan2_pytorch --generate
To generate a video of a interpolat