Skip to content

This repository contains code for the paper Revisiting Latent Space of GAN Inversion for Robust Real Image Editing (WACV 2024)

Notifications You must be signed in to change notification settings

raven38/hypershpere-gan-inversion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

hypershpere-gan-inversion

This repository contains code for the paper Revisiting Latent Space of GAN Inversion for Robust Real Image Editing (WACV 2024) Paper

This repo is implemented upon the BDInvert repo, HGFI3D repo, EG3D repo, PTI repo, andDeep3DFaceRecon repo.

The main dependencies for BDInvert are:

  • Python 3.9.7 or later
  • PyTorch 1.10 or later
  • TensorFlow 2.4.1 with GPU support

The main dependencies for HFGI3D are:

  • Python 3.9.12 or later
  • PyTorch 1.12.1 or later
  • TensorFlow 2.13.0 with GPU support

Setup enviroment for BDInvert and HGFI3D

conda env create BDInvert/environment.yaml
conda activate BDInvert
conda env create HFGI3D/environment.yaml
conda activate BDInvert

Inversion with BDInvert

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

Inversion

Make image list.

python make_list.py --image_folder ./test_img

Embed images into StyleGAN's latent codes.

python invert_zp.py --job_name stylegan2_ffhq1024_zp --image_list test_img/test.list --encoder_pt_path ../pretrained_weight/encoder_stylegan2_ffhq1024_basesize16.pth | tee logs/invert_zp.txt

Editing

python3 edit_ganspace_zp.py work_dirs/inversion/stylegan2_ffhq1024_zp --edit_direction ./editings/ganspace_directions/stylegan2-ffhq_style_ipca_c80_n1000000.npz --start_distance -3.0 --end_distance 3.0

Inversion with HGFI3D

PYTHONPATH='./' python3 scripts/run_pti.py ../example_configs/config.py

About

This repository contains code for the paper Revisiting Latent Space of GAN Inversion for Robust Real Image Editing (WACV 2024)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published