An implementation of neural style in TensorFlow.
This implementation is a lot simpler than a lot of the other ones out there, thanks to TensorFlow's really nice API and automatic differentiation.
The algorithm seems to be working all right, but the results aren't always as good as some of the other implementations. This may be due to the optimization algorithm used - TensorFlow doesn't support L-BFGS, so we use Adam. It may be due to the parameters used. Or it may be a bug in the code... I don't know yet. Any help improving the code would be much appreciated!
Also, TensorFlow seems to be slower than a lot of the other deep learning frameworks out there. I'm sure this implementation could be improved, but it would probably take improvements in TensorFlow itself as well to get it to operate at the same speed as other implementations.
python neural_style.py --content <content file> --style <style file> --output <output file>
(run python neural_style.py --help
to see a list of all options)
Running it for 500-2000 iterations seems to produce nice results.
The following example was run for 1000 iterations to produce the result:
These were the input images used (me sleeping at a hackathon and Starry Night):
- TensorFlow
- SciPy
- Pillow
- NumPy
- Pre-trained VGG network
Copyright (c) 2015 Anish Athalye. Released under GPLv3. See LICENSE.md for details.