This is Neural Style Transfer application based on TensorFlow, adapted from TensorFlow Neural Style Transfer tutorial. Neural Style Transfer (NST) is an application that applies the style of one image into another by utilizing neural networks. This repository provides python-based scripts for interested users to try Neural Style Transfer on Intel platforms. For issues using this repo, please feel free to email [email protected] and [email protected].
Pre-requisites: Make sure you have python 3.7/3.8/3.9 and virtualenv setup.
virtualenv test-neural-style-transfer-venv
. ./test-neural-style-transfer-venv/bin/activate
Option 1: Install TensorFlow Released by Google, but use "export TF_ENABLE_ONEDNN_OPTS=1" to turn on Intel optimizations.
pip install tensorflow
export TF_ENABLE_ONEDNN_OPTS=1
Note, at the time of writing, TensorFlow v2.7.0 was used. The above command is equivalent to pip install tensorflow==2.7.0
pip install intel-tensorflow
Note, at the time of writing, TensorFlow v2.7.0 was used.
pip install matplotlib
pip install tensorflow-hub
pip install pyqt5
In this folder, you can find a video file that contains example commands to run neural style transfer once the above steps are done. The video used TensorFlow v2.3.0. We recommend using latest TensorFlow version (v2.7.0) using either stock TensorFlow (released by Google) or Intel TensorFlow (released by Intel).
./NST-painting.sh bw2.jpg rain-princess.jpg
The above shell script invoke fast neural style transfer script and take content image (bw2.jpg) and style image (rain-princess.jpg) as inputs, the output is saved as stylized-image.png.
[1] https://www.tensorflow.org/tutorials/generative/style_transfer
[2] https://github.com/jcjohnson/fast-neural-style
[3] https://arxiv.org/abs/1603.08155