Home

Awesome

LOHO: Latent Optimization of Hairstyles via Orthogonalization [CVPR'21]

Hairstyle transfer samples synthesized by LOHO.

This directory contains the code for running LOHO framework.

The sub-folders are:

In order to run LOHO, you have to download the necessary model checkpoints. We provide instructions to download checkpoints:

Next, running LOHO requires relevant python and CUDA packages. Please run requirements.sh to install necessary packages via conda. Alternatively, you can use pip to install the packages.

Finally, execute loho.py and mention the flags --image1, --image2, --image3. We provide examples below for you to try LOHO. We also provide loop.sh that goes over all combinations and stores the outputs under data/results.

You can use the following specifications:

StyleGANv2 Inversion

The script styleganv2_inversion.py contains CLI tools to perform simple StyleGANv2 inversion.

To invert an image and save the resulting W-space and noise latent tensors:

python stylegan2_inversion.py gan-invert --image-path ./data/images/00018.jpg --save-pickle

To synthesize an image from saved W-space and noise latent tensors:

python stylegan2_inversion.py reconstruct-from-latent

To cite this paper, use the following:

 @inproceedings{saha2021LOHO,
   title={LOHO: Latent Optimization of Hairstyles via Orthogonalization},
   author={Saha, Rohit and Duke, Brendan and Shkurti, Florian and Taylor, Graham, and Aarabi, Parham},
   booktitle={CVPR},
   year={2021}
 }