梁世谦,裴虎镇,吴益强
This repository contains a PyTorch implementation of Gatys' neural style transfer, LapStyle, AdaIN, and AdaIN with Laplacian Loss.
Great thanks to the original authors, this tutorial and this PyTorch implementation, both from which this implementation borrows code.
conda env create --name envname --file=environment.ymlpython gatys.py --method gatys --style path/to/style_img.jpg --content path/to/content_img.jpgpython gatys.py --method lapstyle --style path/to/style_img.jpg --content path/to/content_img.jpgAdaptive instance normalization for arbitrary style transfer trains a feed-forward network instead of optimizing a noise image.
bash get_vgg.shFor a pre-trained decoder, we refer you to this link.
python test_adain.py --style path/to/style_img.jpg --content path/to/content_img.jpgThis code trains with Laplacian loss by default, you can specify loss weights by parameters.
python train_adain.py --content_dir path/to/content/imgs --style_dir path/to/style/imgs --lap_weight some_weight --content_weight some_weight --style_weight some_weight- [1]: X. Huang and S. Belongie. "Arbitrary Style Transfer in Real-time with Adaptive Instance Normalization.", in ICCV, 2017.
- [2]: Original implementation in Torch