项目作者: yan-roo

项目描述 :
StyleGAN - Pytorch Implementation
高级语言: Python
项目地址: git://github.com/yan-roo/FakeFace.git
创建时间: 2020-08-03T08:41:23Z
项目社区:https://github.com/yan-roo/FakeFace

开源协议:MIT License

下载


Style-Based GAN in PyTorch

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

Installation

a. Create a conda virtual environment and activate it.

  1. conda create -n fakeface python=3.7 -y
  2. conda activate fakeface

b. Install PyTorch and torchvision following the official instructions, e.g.,

  1. conda install pytorch torchvision cudatoolkit=10.1 -c pytorch

c. Download the source code and pip install the requirements.

  1. git clone https://github.com/yan-roo/FakeFace.git
  2. pip install -r requirements.txt

Prepare datasets

Download the CelebA dataset. (Default resolution is 178x218)

  1. python helper.py

Crop the face only. (Remember to uncomment the last line 269)

  1. python helper.py --width 128 --height 128

Transform to lmdb format

The default progressive training requires image resolution from 8x8 to 128x128.

You can increase or decrease the image size in line23 & line41.

  1. python prepare_data.py --out data .

Train the model

Train on CelebA

  1. python train.py --mixing data

Train on FFHQ

  1. python train.py --mixing --loss r1 --sched --max_size 1024 data

The checkpoint file to resume from

  1. python train.py --mixing data --ckpt checkpoint/*.model --phase 1000000

Generate fake face

The generate size setting should be the same as the checkpoint.

  1. 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.

Acknowledgements