AdvStyle - Official PyTorch Implementation

Overview

AdvStyle - Official PyTorch Implementation

Paper | Supp

Discovering Interpretable Latent Space Directions of GANs Beyond Binary Attributes.

Huiting Yang, Liangyu Chai, Qiang Wen, Shuang Zhao, Zixun Sun, Shengfeng He

In CVPR 2021

Prerequisites

  • Linux
  • Python 3
  • NVIDIA GPU + CUDA CuDNN

Setup

  • Clone this repo:
git clone https://github.com/BERYLSHEEP/AdvStyle.git
  • Download resources:

Testing Demo

The following commands are examples of testing the learned direction:

# stylegan ffhq
python new_demo.py manipulate_test supermodel \
				--gan_model stylegan_ffhq --resolution 1024 --latent_type z
	
# stylegan anime
python new_demo.py manipulate_test maruko \
				--gan_model stylegan_anime --resolution 512 --latent_type z

if you want to manipulate multi attributes simultaneously, you can list all the attributes on the command as follow:

# multi attribute manipulation
python new_demo.py manipulate_test blonde,open_mouth \
				--gan_model stylegan_anime --resolution 512 --latent_type z

If you want to specific the manipulated latent code, you can set the --noise_path option:

# specific latent code
python new_demo.py manipulate_test maruko \
				--gan_model stylegan_anime --resolution 512 --latent_type z \
				--noise_path ./noise/maruko/2.npy

Results are saved to result/{attribute}

The attribute names are the file names in the boundaries directory.

Interactive Demo

  • Prerequisites: Flask

    pip install flask
    pip install --upgrade flask_nav
    pip install --upgrade flask_bootstrap
  • Running

    # only for stylegan_anime
    # the input latent code is belong to latent space z [1, 512]
    python app.py --latent_code noise/maruko/16.npy --composing_type z
    # the input latent code is belong to latent space w+ [1, 16, 512]
    python app.py --latent_code noise/38_w+.npy --composint_type w+
  • Instructions

    • Only one attribute can be edited at once time.
    • Multi attributes edit examples:
      • Click the corresponding Edit Button for "Pink Hair", then move the corresponding toolbar to the desired step.
      • Click the corresponding Edit Button for "Open Mouth", then move the corresponding toolbar to the desired step.
      • ....

Related Project

  • The pretrained StyleGAN weights are from official StyleGAN and Gwern
  • Using the pytorch implementation of StyleGAN from [InterFaceGAN](Pytorch implementation of official model)

Citation

If you use this code for your research, please cite our paper:

@InProceedings{Yang_2021_CVPR,
    author    = {Yang, Huiting and Chai, Liangyu and Wen, Qiang and Zhao, Shuang and Sun, Zixun and He, Shengfeng},
    title     = {Discovering Interpretable Latent Space Directions of GANs Beyond Binary Attributes},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    month     = {June},
    year      = {2021},
    pages     = {12177-12185}
}
You might also like...
This is the official PyTorch implementation of the paper
This is the official PyTorch implementation of the paper "TransFG: A Transformer Architecture for Fine-grained Recognition" (Ju He, Jie-Neng Chen, Shuai Liu, Adam Kortylewski, Cheng Yang, Yutong Bai, Changhu Wang, Alan Yuille).

TransFG: A Transformer Architecture for Fine-grained Recognition Official PyTorch code for the paper: TransFG: A Transformer Architecture for Fine-gra

StyleGAN2-ADA - Official PyTorch implementation
StyleGAN2-ADA - Official PyTorch implementation

Need Help? If you’re new to StyleGAN2-ADA and looking to get started, please check out this video series from a course Lia Coleman and I taught in Oct

Official PyTorch implementation of
Official PyTorch implementation of "ArtFlow: Unbiased Image Style Transfer via Reversible Neural Flows"

ArtFlow Official PyTorch implementation of the paper: ArtFlow: Unbiased Image Style Transfer via Reversible Neural Flows Jie An*, Siyu Huang*, Yibing

Official PyTorch implementation of RobustNet (CVPR 2021 Oral)
Official PyTorch implementation of RobustNet (CVPR 2021 Oral)

RobustNet (CVPR 2021 Oral): Official Project Webpage Codes and pretrained models will be released soon. This repository provides the official PyTorch

Official PyTorch implementation for Generic Attention-model Explainability for Interpreting Bi-Modal and Encoder-Decoder Transformers, a novel method to visualize any Transformer-based network. Including examples for DETR, VQA.
Official PyTorch implementation for Generic Attention-model Explainability for Interpreting Bi-Modal and Encoder-Decoder Transformers, a novel method to visualize any Transformer-based network. Including examples for DETR, VQA.

PyTorch Implementation of Generic Attention-model Explainability for Interpreting Bi-Modal and Encoder-Decoder Transformers 1 Using Colab Please notic

[PyTorch] Official implementation of CVPR2021 paper
[PyTorch] Official implementation of CVPR2021 paper "PointDSC: Robust Point Cloud Registration using Deep Spatial Consistency". https://arxiv.org/abs/2103.05465

PointDSC repository PyTorch implementation of PointDSC for CVPR'2021 paper "PointDSC: Robust Point Cloud Registration using Deep Spatial Consistency",

Official PyTorch implementation of MX-Font (Multiple Heads are Better than One: Few-shot Font Generation with Multiple Localized Experts)

Introduction Pytorch implementation of Multiple Heads are Better than One: Few-shot Font Generation with Multiple Localized Expert. | paper Song Park1

Official Pytorch implementation of 'GOCor: Bringing Globally Optimized Correspondence Volumes into Your Neural Network' (NeurIPS 2020)
Official Pytorch implementation of 'GOCor: Bringing Globally Optimized Correspondence Volumes into Your Neural Network' (NeurIPS 2020)

Official implementation of GOCor This is the official implementation of our paper : GOCor: Bringing Globally Optimized Correspondence Volumes into You

Official PyTorch Implementation of Hypercorrelation Squeeze for Few-Shot Segmentation, arXiv 2021
Official PyTorch Implementation of Hypercorrelation Squeeze for Few-Shot Segmentation, arXiv 2021

Hypercorrelation Squeeze for Few-Shot Segmentation This is the implementation of the paper "Hypercorrelation Squeeze for Few-Shot Segmentation" by Juh

Comments
  • How to train your network?

    How to train your network?

    Your paper is pretty good !!

    1. In your paper, I note that some components are fixed and some components are trainable. However, I haven't found any code in your project which represents training some components. Could you please tell me how to train it?
    2. I know that thelta is an important trainable parameter, but I am fused about if alpha is trainable?
    opened by zhanjiahui 2
  • How to find directions for new attributes?

    How to find directions for new attributes?

    Hello, congratulations for the work

    One question: how to find directions for new attributes?

    In InterfaceGAN for instance there is the train_boundary function in utils/manipulator.py, however I didn't find a similar function in this rep

    opened by Daquisu 1
Owner
Beryl
Beryl
StyleGAN2-ADA - Official PyTorch implementation

Abstract: Training generative adversarial networks (GAN) using too little data typically leads to discriminator overfitting, causing training to diverge. We propose an adaptive discriminator augmentation mechanism that significantly stabilizes training in limited data regimes.

NVIDIA Research Projects 3.2k Dec 30, 2022
Official PyTorch implementation of Joint Object Detection and Multi-Object Tracking with Graph Neural Networks

This is the official PyTorch implementation of our paper: "Joint Object Detection and Multi-Object Tracking with Graph Neural Networks". Our project website and video demos are here.

Richard Wang 443 Dec 6, 2022
Official pytorch implementation of paper "Image-to-image Translation via Hierarchical Style Disentanglement".

HiSD: Image-to-image Translation via Hierarchical Style Disentanglement Official pytorch implementation of paper "Image-to-image Translation

null 364 Dec 14, 2022
Official pytorch implementation of paper "Inception Convolution with Efficient Dilation Search" (CVPR 2021 Oral).

IC-Conv This repository is an official implementation of the paper Inception Convolution with Efficient Dilation Search. Getting Started Download Imag

Jie Liu 111 Dec 31, 2022
Official PyTorch Implementation of Unsupervised Learning of Scene Flow Estimation Fusing with Local Rigidity

UnRigidFlow This is the official PyTorch implementation of UnRigidFlow (IJCAI2019). Here are two sample results (~10MB gif for each) of our unsupervis

Liang Liu 28 Nov 16, 2022
Official implementation of our paper "LLA: Loss-aware Label Assignment for Dense Pedestrian Detection" in Pytorch.

LLA: Loss-aware Label Assignment for Dense Pedestrian Detection This project provides an implementation for "LLA: Loss-aware Label Assignment for Dens

null 35 Dec 6, 2022
An official implementation of "SFNet: Learning Object-aware Semantic Correspondence" (CVPR 2019, TPAMI 2020) in PyTorch.

PyTorch implementation of SFNet This is the implementation of the paper "SFNet: Learning Object-aware Semantic Correspondence". For more information,

CV Lab @ Yonsei University 87 Dec 30, 2022
Old Photo Restoration (Official PyTorch Implementation)

Bringing Old Photo Back to Life (CVPR 2020 oral)

Microsoft 11.3k Dec 30, 2022
Official PyTorch implementation of Spatial Dependency Networks.

Spatial Dependency Networks: Neural Layers for Improved Generative Image Modeling Đorđe Miladinović   Aleksandar Stanić   Stefan Bauer   Jürgen Schmid

Djordje Miladinovic 34 Jan 19, 2022
Official implementation of our CVPR2021 paper "OTA: Optimal Transport Assignment for Object Detection" in Pytorch.

OTA: Optimal Transport Assignment for Object Detection This project provides an implementation for our CVPR2021 paper "OTA: Optimal Transport Assignme

null 217 Jan 3, 2023