This is the reimplementation code of CVPR'2018 paper Learning to Sketch with Shortcut Cycle Consistency.
Photo | Generated examples |
---|---|
InkScape or CairoSVG (For vector sketch rendering. Choose one of them is ok.)
sudo apt-get install inkscape
# or
pip3 install cairosvg
From the paper, we need to pre-train the model on the QuickDraw dataset. So we need to preprocess both the QuickDraw-shoes and QMUL-shoes data following these steps:
QuickDraw-shoes
sketchrnn_shoes.npz
data from QuickDrawdatasets/QuickDraw/shoes/npz/
directorypython quickdraw_data_processing.py
QMUL-shoes
.png
under datasets/QMUL/shoes/photos/
directory.h5
packages under datasets/QMUL/shoes/
directoryQuickDraw-shoes pre-training
QuickDraw
in model.py
-get_default_hparams
-data_type
python sketch_p2s_train.py
QMUL-shoes training
QMUL
in model.py
-get_default_hparams
-data_type
outputs/snapshot/
directoryTrue
in sketch_p2s_train.py
-resume_training
python sketch_p2s_train.py
The following figure shows the total loss, KL loss and reconstruction loss during training with QuickDraw-shoes pre-trained within 30k iterations and the following QMUL-shoes trained within 40k iterations.
QuickDraw-shoes
data_type
to be QuickDraw
in model.py
outputs/snapshot/QuickDraw/
directorypython sketch_p2s_sampling.py
QMUL-shoes
data_type
to be QMUL
in model.py
outputs/snapshot/QMUL/
directorypython sketch_p2s_sampling.py
All results can be found under outputs/sampling/
dir.