/Neural-Style-Transfer-with-TensorFlow

Implementation of Neural Style Transfer algorithm with pre-trained VGG-16 Network & TensorFlow in Python 3.

Primary LanguagePython

Neural Style Transfer with TensorFlow

Implementation of Neural Style Transfer algorithm with pretrained VGG-16 Network & TensorFlow in Python 3.

Dependencies

pip install -r requirements.txt

or

pip3 install -r requirements.txt

Pre-trained VGG-16 Network ( Warning : 491 MB)

Download VGG-16 named as imagenet-vgg-verydeep-16 from here. Put it in Neural-Style-Transfer-with-TensorFlow folder.

alt text

Cloning and Training

git clone https://github.com/MuhammedBuyukkinaci/Neural-Style-Transfer-with-TensorFlow.git

cd ./Neural-Style-Transfer-with-TensorFlow

python neural_style_transfer.py

To train with your parameters, run a command alike below command: (Details in Arguments for Terminal section)

python neural_style_transfer.py -c_i changed_content.jpg -s_i changed_style.jpg -c_w 25 -s_w 25 -n_i 1000

Arguments for Terminal

  • c_i: Name of Content image. It must be string. Example: changed_content.jpg, default_content.jpg , content_image.png .

  • s_i: Name of Style image. It must be string. Example: changed_style.jpg , default_style.jpg , style_image.png .

  • c_w: Weight of Content image in loss function. It must be integer. Example: 5 , 20 , 50 .

  • s_w: Weight of Style image in loss function. It must be integer. Example: 10 , 20 , 40 .

  • s_w: How many iterations to train. It must be integer. Example: 500 , 1000 , 2000 .

Notebook

Download .ipynb file from here and run:

jupyter lab or jupyter notebook

Outputs

Content Image Style Image Generated Image After 2000 iterations GIF during 2000 iterations
Content Image Style Image Generated Image After 2000 iterations GIF during 2000 iterations
Content Image Style Image Generated Image After 2000 iterations GIF during 2000 iterations
Content Image Style Image Generated Image After 2000 iterations GIF during 2000 iterations

The last content image belongs to one of my friends, Umut Başdemir. He is a Business Development Specialist at Samsung.

References