Training fast neural-style transfer models
In this section, we'll show you how to train models using the fast neural-style transfer algorithm with TensorFlow. Perform the following steps to train such a model:
- On a Terminal of your Mac or preferably GPU-powered Ubuntu, run
git clone https://github.com/jeffxtang/fast-style-transfer
, which is a fork of a nice TensorFlow implementation of Johnson's fast-style transfer, modified to allow the trained model to be used in iOS or Android apps. cd
to the fast-style-transfer directory, then run thesetup.sh
script to download the pre-trained VGG-19 model file as well as the MS COCO training dataset, which we mentioned in the previous chapter – note that it can take several hours to download the large files.- Run the following commands to create checkpoint files with training using a style image named
starry_night.jpg
and a content image namedww1.jpg
:
mkdir checkpoints mkdir test_dir python style.py --style images/starry_night.jpg --test images/ww1.jpg...