Unofficial Knet.jl implementation of paper "Image-to-image Translation via Hierarchical Style Disentanglement".
This version was implemented by Caner Korkmaz for the Koç University Comp 541 Course and ML Reproducibility Challenge 2021 Fall Edition. You can find the original implementation in https://github.com/imlixinyang/HiSD.
git clone https://github.com/Kausta/HiSD.jl.git
cd HiSD.jl/
We recommend you to download CelebA-HQ from CelebAMask-HQ. Anyway you should get a dataset folder like:
celeba_or_celebahq
- img_dir
- img0
- img1
- ...
- train_label.txt
In the paper, the first 3000 images are used as test set and remaining 27000 are used for training. Carefully check the first few (always two) lines in the label file which are different from others. Moreover, I first resize the images and save the resized versions as PNG files unlike the original implementation for faster data loading. When using the default config file, the images are resized into 128x128 images.
julia --project=. scripts/preprocess.jl --img_path $your_image_path --label_path $your_label_path --target_path datasets --start 3002 --end 30002
julia --project=. scripts/resize.jl --img_path $your_image_path --config ./configs/celeba-hq.yaml
Then you will get several ".txt" files in the "datasets/", each of them consists of lines of the absolute path of image and its tag-irrelevant conditions (Age and Gender by default).
Following the licensing of the original implementation, this code is licensed under the CC BY-NC-SA 4.0 (Attribution-NonCommercial-ShareAlike 4.0 International).
The code in this repo was created from scratch, using the previously cited original implementation and the paper as references.
The code is released for academic research use only following the original implementation. For other use, please check the original implementation or contact the author of the official pytorch implementation at imlixinyang@gmail.com.
If the original paper helps your research, please cite it in your publications:
@InProceedings{Li_2021_CVPR,
author = {Li, Xinyang and Zhang, Shengchuan and Hu, Jie and Cao, Liujuan and Hong, Xiaopeng and Mao, Xudong and Huang, Feiyue and Wu, Yongjian and Ji, Rongrong},
title = {Image-to-Image Translation via Hierarchical Style Disentanglement},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2021},
pages = {8639-8648}
}