/pytorch-STROTSS-improved

Pytorch implementation of STROSS including sinkhorn EMD calculation.

Primary LanguagePython

PyTorch implementation of Style Transfer by Relaxed Optimal Transport and Self-Similarity (STROTSS) with improvements

Implements STROTSS with sinkhorn EMD as introduced in the paper Interactive Neural Style Transfer with artists.

This code is inspired by the original implementation released by the authors of STROTSS.

Dependencies:

  • python3 >= 3.6
  • pytorch >= 1.0
  • torchvision >= 0.4
  • imageio >= 2.2
  • numpy >= 1.1

Usage:

  • standard
    python test.py -c images/content_im.jpg -s images/style_im.jpg
    
  • sinkhorn earth movers distance
    python test.py -c images/content_im.jpg -s images/style_im.jpg --use_sinkhorn
    
  • guidance masks
    python test.py -c images/content_im.jpg -s images/style_im.jpg --content_guidance images/content_guidance.jpg --style_guidance images/style_guidance
    

General usage

python test.py
    --content CONTENT
    --style STYLE
    [--output OUTPUT]
    [--content_weight CONTENT_WEIGHT]
    [--max_scale MAX_SCALE]
    [--seed SEED]
    [--content_guidance CONTENT_GUIDANCE]
    [--style_guidance STYLE_GUIDANCE]
    [--print_freq PRINT_FREQ]
    [--use_sinkhorn]
    [--sinkhorn_reg SINKHORN_REG]
    [--sinkhorn_maxiter SINKHORN_MAXITER]

Citation

If you use this code, please cite the original STROTSS paper and

@article{kerdreux2020interactive,
  title={Interactive Neural Style Transfer with Artists},
  author={Kerdreux, Thomas and Thiry, Louis and Kerdreux, Erwan},
  journal={arXiv preprint arXiv:2003.06659},
  year={2020}
}