Code Monkey home page Code Monkey logo

fakeface's Introduction

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.

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

Prepare datasets

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

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.

python prepare_data.py --out data .

Train the model

Train on CelebA

python train.py --mixing data

Train on FFHQ

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

The checkpoint file to resume from

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

Generate fake face

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.

Acknowledgements

fakeface's People

Contributors

michaelmonashev avatar penguinbing avatar rosinality avatar yan-roo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.