• Stars
    star
    189
  • Rank 200,326 (Top 5 %)
  • Language
    Python
  • Created over 3 years ago
  • Updated over 2 years ago

Reviews

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

Repository Details

Demo code for "LOHO: Latent Optimization of Hairstyles via Orthogonalization".

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:

  • networks: Contains scripts for Graphonomy, VGG16 and StyleGANv2
  • losses: Contains scripts for computing different losses
  • datasets: Contains scripts for preparing the images and masks required to run LOHO
  • data:
    • images: Contains FFHQ images at 1024px
    • masks: Contains masks at 128px, extracted from Graphonomy, corresponding to the images
    • softmasks: Contains pickle files used to perform "soft-blending" as a post-processing step at 512px
    • backgrounds: Contains images at 256px with foreground inpainted
    • results: Folders that store output files
  • checkpoints: Folder to store checkpoints

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:

  • python loho.py --image1 67172.jpg --image2 02602.jpg --image3 67172.jpg
  • python loho.py --image1 00761.jpg --image2 00761.jpg --image3 00018.jpg
  • python loho.py --image1 52364.jpg --image2 52364.jpg --image3 19501.jpg
  • python loho.py --image1 17754.jpg --image2 17658.jpg --image3 00148.jpg
  • python loho.py --image1 46826.jpg --image2 08244.jpg --image3 10446.jpg

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}
 }

More Repositories

1

lintel

A Python module to decode video frames directly, using the FFmpeg C API.
C
260
star
2

SSTVOS

Training code for "SSTVOS: Sparse Spatiotemporal Transformers for Video Object Segmentation"
Cuda
85
star
3

mobile-pruning

Python
6
star
4

ml-reading-notes-improved-system

A set of reading summaries related to machine learning.
TeX
4
star
5

nerfies-to-3d-generative

Python
4
star
6

master-thesis-fusion

TeX
4
star
7

personal-website

HTML
3
star
8

ridesharing-taxicab-scheduler

C++
2
star
9

arm-disassembler

Disassembler for ARMv5 architecture
C
2
star
10

learn-reactjs

JavaScript
1
star
11

programming-challenges-skiena

C
1
star
12

mit.6824

1
star
13

diffusercam

TeX
1
star
14

python-c-extension-hacking

C
1
star
15

random-vimrc-etc

Vim Script
1
star
16

x86_Towers_of_Hanoi

Assembly
1
star
17

here-be-dragons

C++
1
star
18

advent-of-code

1
star
19

web-dev-zero-to-hero

HTML
1
star
20

mlir-hacking

MLIR
1
star
21

sparse-spatiotemporal-transformer

1
star
22

tensorflow-special-octo-spoon

Python
1
star
23

AST_PrettyPrinter

Files to pretty-print A1.java, A2.java and A3.java from CS2S03 Assignment 1, using an AST.
C++
1
star
24

pybind11-hacking

1
star
25

go.dev-tutorials

Go
1
star
26

verilog-hdl-palnitkar

Verilog
1
star
27

ml-programming-problems

Python
1
star
28

face-action-unit-detection

Python
1
star
29

concurrency-in-action

C++
1
star
30

quartus-ii-projects

Verilog
1
star
31

python-dabbling

I dabble
Python
1
star
32

apc-literate-chainsaw

Python
1
star
33

Connect_4

An electronic version of the popular two-player connection game
C++
1
star
34

top-work

https://dukebw.github.io/top-work/
HTML
1
star
35

cp-algo

C++
1
star
36

vscode-debug-mixed-python-cpp

Based on: https://nadiah.org/2020/03/01/example-debug-mixed-python-c-in-visual-studio-code/
C++
1
star
37

learning-sql

Originally from https://resources.oreilly.com/examples/9780596007270/
1
star
38

phd-thesis

HTML
1
star