• Stars
    star
    159
  • Rank 235,916 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 5 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[IJCV 2020] Semantic Hierarchy Emerges in Deep Generative Representations for Scene Synthesis

HiGAN - Semantic Hierarchy Emerges in Deep Generative Representations for Scene Synthesis

Python 3.7.6 pytorch 1.4.0 TensorFlow 1.14.0 cuda 10.1 sklearn 0.22.1

image Figure: Scene manipulation from different abstract levels: including layout, categorical object, and scene attributes.

Semantic Hierarchy Emerges in Deep Generative Representations for Scene Synthesis
Ceyuan Yang*, Yujun Shen*, Bolei Zhou
International Journal of Computer Vision (IJCV) 2020

In this repository, we propose an effective framework, termed as HiGAN, to interpret the semantics learned by GANs for scene synthesis. It turns out that GAN models, which employ layer-wise latent codes, spontaneously encode the semantics from different abstract levels in the latent space in a hierarchical manner. Identifying the most relevant variation factors significantly facilitates scene manipulation.

[Paper] [Project Page] [Demo] [Colab-Church] [Colab-Bedroom]

Usage of Semantic Manipulation

A simple example of mainpulting "indoor lighting" of bedroom:

python simple_manipulate.py stylegan_bedroom indoor_lighting

You will get the manipulation results at manipulation_results/stylegan_bedroom_indoor_lighting.html which looks like following. Images can be directly downloaded from the html page.

image

User can also customize their own manipulation tool with script manipulate.py. First, a boundary list is required. See the sample below:

(indoor_lighting, w): boundaries/stylegan_bedroom/indoor_lighting_boundary.npy
(wood, w): boundaries/stylegan_bedroom/wood_boundary.npy

Execute the following command for manipulation:

LAYERS=6-11
python manipulate.py $MODEL_NAME $BOUNDARY_LIST \
    --num=10 \
    --layerwise_manipulation \
    --manipulate_layers=$LAYERS \
    --generate_html

Pre-trained Models

Pre-trained GAN models: GAN Models.

Pre-trained predictors: Predictors.

Train on Your Own Data

Step-1: Synthesize images and get semantic prediction

MODEL_NAME=stylegan_bedroom
OUTPUT_DIR=stylegan_bedroom
python synthesize.py $MODEL_NAME \
    --output_dir=$OUTPUT_DIR \
    --num=500000 \
    --generate_prediction \
    --logfile_name=synthesis.log

Step-2: Boundary search for potential candidates (repeat)

BOUNDARY_NAME=indoor_lighting
python train_boundary.py $OUTPUT_DIR/w.npy $OUTPUT_DIR/attribute.npy \
    --score_name=$BOUNDARY_NAME \
    --output_dir=$OUTPUT_DIR \
    --logfile_name=${BOUNDARY_NAME}_training.log

Step-3: Rescore to identity the most relevant semantics

Use following command to conduct the layer-wise analaysis and identify relevant semantics:

BOUNDARY_LIST=stylegan_bedroom/boundary_list.txt
python rescore.py $MODEL_NAME $BOUNDARY_LIST \
    --output_dir $OUTPUT_DIR \
    --layerwise_rescoring \
    --logfile_name=rescore.log

BibTeX

@article{yang2019semantic,
  title   = {Semantic hierarchy emerges in deep generative representations for scene synthesis},
  author  = {Yang, Ceyuan and Shen, Yujun and Zhou, Bolei},
  journal = {IJCV},
  year    = {2020}
}

More Repositories

1

interfacegan

[CVPR 2020] Interpreting the Latent Space of GANs for Semantic Face Editing
Python
1,483
star
2

sefa

[CVPR 2021] Closed-Form Factorization of Latent Semantics in GANs
Python
960
star
3

genforce

An efficient PyTorch library for deep generative modeling.
Python
906
star
4

idinvert

[ECCV 2020] In-Domain GAN Inversion for Real Image Editing
Python
460
star
5

idinvert_pytorch

[ECCV 2020] In-Domain GAN Inversion for Real Image Editing (PyTorch code)
Python
410
star
6

freecontrol

Official implementation of CVPR 2024 paper: "FreeControl: Training-Free Spatial Control of Any Text-to-Image Diffusion Model with Any Condition"
Python
383
star
7

mganprior

[CVPR 2020] Image Processing Using Multi-Code GAN Prior
Python
288
star
8

ghfeat

[CVPR 2021] Generative Hierarchical Features from Synthesizing Images
Python
157
star
9

eqgan-sa

[CVPR 2022] Improving GAN Equilibrium by Raising Spatial Awareness
Python
156
star
10

volumegan

CVPR 2022 VolumeGAN - 3D-aware Image Synthesis via Learning Structural and Textural Representations
Python
126
star
11

insgen

[NeurIPS 2021] Data-Efficient Instance Generation from Instance Discrimination
Python
101
star
12

lia

[IJCV 2022] Disentangled Inference for GANs with Latently Invertible Autoencoder
Python
90
star
13

StyleSV

[ICLR 2023] Towards Smooth Video Composition
Python
83
star
14

dynamicd

[NeurIPS 2022] Improving GANs with A Dynamic Discriminator
Python
63
star
15

genda

[ICCV 2023] One-Shot Generative Domain Adaptation
56
star
16

trgan

Unsupervised Image Transformation Learning via Generative Adversarial Networks
32
star
17

fairgen

Code for paper `Improving the Fairness of Deep Generative Models without Retraining`
Python
29
star
18

SpatialGAN

Spatial Steerability of GANs via Self-Supervision from Discriminator
8
star
19

genforce.github.io

Homepage.
HTML
6
star