StyleGAN - Pytorch Implementation
Sample from CelebA. At 550,000 iterations.
Sample from CelebA (Crop 128x128). At 350,000 iterations.
Implementation of A Style-Based Generator Architecture for Generative Adversarial Networks (https://arxiv.org/abs/1812.04948) in PyTorch
Based on https://github.com/rosinality/style-based-gan-pytorch
a. Create a conda virtual environment and activate it.
conda create -n fakeface python=3.7 -y
conda activate fakeface
b. Install PyTorch and torchvision following the official instructions, e.g.,
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
c. Download the source code and pip install the requirements.
git clone https://github.com/yan-roo/FakeFace.git
pip install -r requirements.txt
Download the CelebA dataset. (Default resolution is 178x218)
python helper.py
Crop the face only. (Remember to uncomment the last line 269)
python helper.py --width 128 --height 128
The default progressive training requires image resolution from 8x8 to 128x128.
You can increase or decrease the image size in line23 & line41.
python prepare_data.py --out data .
python train.py --mixing data
python train.py --mixing --loss r1 --sched --max_size 1024 data
python train.py --mixing data --ckpt checkpoint/*.model --phase 1000000
The generate size setting should be the same as the checkpoint.
python generate.py --size 128 --sample 1 --style_mixing 1 checkpoint/*.model
Resolution | Model & Optimizer |
---|---|
128px | Link |
There still some strange faces and background in the results.