GithubHelp home page GithubHelp logo

peterzhousz / bdinvert_release Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kkang831/bdinvert_release

0.0 0.0 0.0 15.07 MB

License: GNU Affero General Public License v3.0

Python 99.43% Shell 0.57%

bdinvert_release's Introduction

BDInvert: GAN Inversion for Out-of-Range Images with Geometric Transformations

This repository contains the accompanying code for GAN Inversion for Out-of-Range Images with Geometric Transformations, ICCV 2021

Prerequisites

  • Ubuntu 18.04 or higher
  • CUDA 10.0 or higher
  • pytorch 1.6 or higher
  • python 3.7 or higher

Installation

pip install -r requirements.txt

Usage

Train

  1. Change directory into BDInvert.
cd BDInvert
  1. Train base code encoder.
python train_basecode_encoder.py
  • --model_name : You can change backbone StyleGAN model, which located at model zoo.
  • --basecode_spatial_size : You can change spatial resolution of basecode.
  1. Find pnorm parameters.
python pca_p_space.py

Download pretrained base code encoder.

Download and unzip under BDInvert/pretrained_models/.

Encoder Pretrained Models Basc Code Spatial Size
StyleGAN2 pretrained on FFHQ 1024, 16x16 16x16

Test

  • Default test setting use StyleGAN2 pretrained on FFHQ1024 and use basecode spatial size as 16x16.
  1. Change directory into BDInvert.
cd BDInvert
  1. Make image list.
python make_list.py --image_folder ./test_img
  1. Embed images into StyleGAN's latent codes.
python invert.py --encoder_pt_path {encoder_pt_path}
  • --image_list : Inversion target image list generated from above step 2. Default is ./test_img/test.list
  • --weight_pnorm_term : As recently well known, there is a trade-off between editing quality and reconstruction quality. This argument controls this trade-off.
  1. Edit embedded results.
python edit.py {inversion directory}
  • --edit_direction : You can change edit direction, which located at BDInvert/editings/interfacegan_directions

Small changes

  • We changed the detail code regularization method from hard clipping in P-norm+ space to L2 norm regularization, following the update of the original paper.
  • Due to this change, new hyperparameter, weight_pnorm_term, has been added.

License

This software is being made available under the terms in the LICENSE file.

Any exemptions to these terms requires a license from the Pohang University of Science and Technology.

Useful Links

Acknowledgments

NOTE

bdinvert_release's People

Contributors

kkang831 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.