bethgelab / stylize-datasets

A script that applies the AdaIN style transfer method to arbitrary datasets
Other
155 stars 37 forks source link

stylize-datasets

This repository contains code for stylizing arbitrary image datasets using AdaIN. The code is a generalization of Robert Geirhos' Stylized-ImageNet code, which is tailored to stylizing ImageNet. Everything in this repository is based on naoto0804's pytorch-AdaIN implementation.

Given an image dataset, the script creates the specified number of stylized versions of every image while keeping the directory structure and naming scheme intact (usefull for existing data loaders or if directory names include class annotations).

Feel free to open an issue in case there is any question.

Usage

Here is an example call:

 python3 stylize.py --content-dir '/home/username/stylize-datasets/images/' --style-dir '/home/username/stylize-datasets/train/' --num-styles 10 --content_size 0 --style_size 256

Citation

If you use this code, please consider citing:

@article{michaelis2019dragon,
  title={Benchmarking Robustness in Object Detection: 
    Autonomous Driving when Winter is Coming},
  author={Michaelis, Claudio and Mitzkus, Benjamin and 
    Geirhos, Robert and Rusak, Evgenia and 
    Bringmann, Oliver and Ecker, Alexander S. and 
    Bethge, Matthias and Brendel, Wieland},
  journal={arXiv preprint arXiv:1907.07484},
  year={2019}
}