Skip to content

DDDivano/StyleGAN_PyTorch1.0.1

 
 

Repository files navigation

A PyTorch Implementation of StyleGAN (Unofficial)

Github Github Github Github

This repository contains a PyTorch implementation of the following paper:

A Style-Based Generator Architecture for Generative Adversarial Networks
Tero Karras (NVIDIA), Samuli Laine (NVIDIA), Timo Aila (NVIDIA)
http://stylegan.xyz/paper

Abstract: We propose an alternative generator architecture for generative adversarial networks, borrowing from style transfer literature. The new architecture leads to an automatically learned, unsupervised separation of high-level attributes (e.g., pose and identity when trained on human faces) and stochastic variation in the generated images (e.g., freckles, hair), and it enables intuitive, scale-specific control of the synthesis. The new generator improves the state-of-the-art in terms of traditional distribution quality metrics, leads to demonstrably better interpolation properties, and also better disentangles the latent factors of variation. To quantify interpolation quality and disentanglement, we propose two new, automated methods that are applicable to any generator architecture. Finally, we introduce a new, highly varied and high-quality dataset of human faces.

Motivation

To the best of my knowledge, there is still not a similar pytorch 1.0 implementation of styleGAN as NvLabs released(Tensorflow), therefore, i wanna implement it on pytorch1.0.1 to extend its usage in pytorch community.

Training

# ① pass your own dataset of training, batchsize and common settings in TrainOpts of `opts.py`.

class TrainOptions():
    def __init__(self):
        parser = argparse.ArgumentParser()
        parser.add_argument('--path', type=str, default='/home/samuel/gaodaiheng/生成模型/select_gyx/')
        parser.add_argument('--epoch', type=int, default=500)
        parser.add_argument('--batch_size', type=int, default=2)
        parser.add_argument('--type', type=str, default='style')
        parser.add_argument('--resume', type=str, default='model.pth')
        parser.add_argument('--det', type=str, default='train_result_v0.1')
        self.opts = parser.parse_args()

# ② run train.py

# ③ you can get intermediate pics generated by stylegenerator in `train_result/images/`

Unfinished

  • ① training strategy is not fullfilled.
  • blur2d mechanism still have bug.

Related

1. StyleGAN - Official TensorFlow Implementation

2. The re-implementation of style-based generator idea

System Requirements

  • Ubuntu18.04
  • PyTorch 1.0.1
  • Numpy 1.13.3
  • torchvision 0.2.1

Q&A

Acknowledgements

My Email is [email protected], if you have any question and wanna to PR, please let me know, thank you.

About

A implementation of StyleGAN on PyTorch 1.0.1

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%