- Tensorflow (tested with v1.12.0)
- Python3.6
Run
We just use an invertible network to replace the Mapping Network in StyleGAN, the remaining networks are all the same.
Run the training script with python train_decoder.py
(For training details,
please refer to StyleGAN. Here train_decoder.py
is exactly the same script with StyleGan's train.py
script.
We use a different name just to distinguish it from training script in the second stage of LIA).
Prepare for training Encoder
- Add dataset's path to
data_train
anddata_test
in (Data_dir
). - Add decoder's path to
decoder_pkl
(derived from the first-stage training) in (Decoder_pkl
).
Run
python train_encoder.py
All pre-trained networks are available on Google Drive, or one could produce them by the training script. The weights are stored as Python PKL files, as StyleGAN does. The network weights contain 5 instances of dnnlib.tflib.Network, i.e. E, G, D, Gs, NE.
Path | Description |
---|---|
LIA.pdf | paper PDF. |
ffhq_128x128 | LIA trained with FFHQ dataset. |
cat_128x128 | LIA trained with LSUN Cat dataset. |
bedroom_128x128 | LIA trained with LSUN Bedroom dataset. |
car_128x96 | LIA trained with LSUN Car dataset. |
boundaries | Boundaries obtained by InterFaceGAN on FFHQ Dataset. |
- Download the pre-trained network weights and the boundaries file.
- Prepare the test data, such as
.png
images.
python test.py --restore_path MODEL_PATH --mode 0 --batch_size 16
sampling results on FFHQ |
sampling results on LSUN bedroom |
sampling results on LSUN cat |
sampling results on LSUN car |
python test.py --data_dir_test DATA_PATH --restore_path MODEL_PATH --mode 1 --batch_size 8
FFHQ |
bedroom |
cat |
car |
For each group images, the first row shows the original images and the second row shows the reconstructed images.
python test.py --data_dir_test DATA_PATH --restore_path MODEL_PATH --mode 3
python test.py --data_dir_test DATA_PATH --boundaries BOUNDARY_PATH --restore_path MODEL_PATH --mode 4
Each row shows the original image, the reconstruction, glass, pose, gender, smile, and age.
##Reference