Giter Site home page Giter Site logo

sofgan's Introduction

SofGAN (TOG 2022)

Project page | Paper

This repository contains the official PyTorch implementation for the paper: SofGAN: A Portrait Image Generator with Dynamic Styling. We propose a SofGAN image generator to decouple the latent space of portraits into two subspaces: a geometry space and a texture space. Experiments on SofGAN show that our system can generate high quality portrait images with independently controllable geometry and texture attributes.

Teaser

Colab Demo

Here we provide a Colab demo, which basically demonstrated the capbility of style transfer and free-viewpoint protrait.

Installation

version version versionversion

Install environment:

git clone https://github.com/apchenstu/sofgan.git --recursive
conda install pytorch==1.7.1 torchvision==0.8.2 cudatoolkit=10.2 -c pytorch
pip install tqdm argparse scikit-image lmdb config-argparse dlib

Training

Please see each subsection for training on different datasets. Available training datasets:

We also provide our pre-process ffhq and celeba segmaps (in our classes labels). You may also want to re-train the SOF model base on your own multi-view segmaps.

Run

CUDA_VISIBLE_DEVICES=0,1,2,3 python -m torch.distributed.launch --nproc_per_node=4 --master_port=9999 train.py \
    --num_worker 4  --resolution 1024
   --name $exp_name
   --iter 10000000
   --batch 1 --mixing 0.9 \
   path/to/your/image/folders \
   --condition_path path/to/your/segmap/folders

In our experiments, 4x Nividia 2080Ti GPU would take around 20 days to reach 10000k iterations. Adjusting the image resolution and max iterations to suit your own dataset. Emperically, for datasets like FFHQ and CelebA(resolution 1024x1024) the network would converge after 1000k iterations and achieve fancy results.

Notice: training on none pair-wise data (image/segmap) is encouraged. Since it's one of the key features of our SofGAN.

Rendering

We provide a rendering script in renderer.ipynb, where you can restyle your own photos, videos and generate free-viewpoint portrait images while maintaining the geometry consistency. Just to download our checkpoints and unzip to the root folder.

UI Illustration

The Painter is included in Painter, you can pull down and drawing on-the-fly. Before that, you need to install the enviroment with pip install -r ./Painter/requirements.txt

UI

IOS App

You could download and try the Wand, an IOS App developed by Deemos.

two-dimensions

Online Demo

New Folder

Relevant Works

StyleFlow: Attribute-conditioned Exploration of StyleGAN-Generated Images using Conditional Continuous Normalizing Flows (TOG 2021)
Rameen Abdal, Peihao Zhu, Niloy Mitra, Peter Wonka

SEAN: Image Synthesis With Semantic Region-Adaptive Normalization (CVPR 2020)
Peihao Zhu, Rameen Abdal, Yipeng Qin, Peter Wonka

StyleRig: Rigging StyleGAN for 3D Control over Portrait Images (CVPR 2020)
A. Tewari, M. Elgharib, G. Bharaj, F. Bernard, H.P. Seidel, P. Pérez, M. Zollhöfer, Ch. Theobalt

StyleGAN2: Analyzing and Improving the Image Quality of {StyleGAN} (CVPR 2020)
Tero Karras, Samuli Laine, Miika Aittala, Janne Hellsten, Jaakko Lehtinen, Timo Aila

SPADE: Semantic Image Synthesis with Spatially-Adaptive Normalization (CVPR 2019)
Taesung Park, Ming-Yu Liu, Ting-Chun Wang, Jun-Yan Zhu

Citation

If you find our code or paper helps, please consider citing:


sofgan's People

Contributors

apchenstu avatar idsj avatar jack12xl avatar tts-nlp avatar

Watchers

 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.