Image display issue, Neural Style Transfer

2021-06-01T22:24:41

I am attempting to read in my own images in python following the tensorflow Neural Style Transfer tutorial and when displaying them they look nothing like the original image. Can someone please explain why this is? Is it because of the tensorflow preprocessing? Ultimately my issue with Neural Style Transfer is the style never changes (whole code here). I'm always getting a rainbow style applied, no matter what the style image is, and I'm wondering if this is the issue?

Simple code of how I'm reading in images and displaying for debugging:

import tensorflow as tf
from PIL import Image
import matplotlib.pyplot as plt
import cv2

style_image = tf.keras.preprocessing.image.img_to_array(Image.open('blackGold.jpg'))

plt.imshow(style_image)
plt.show()
cv2.imshow("img", style_image)

Original Image: enter image description here

Displaying with matplotlib: enter image description here

Displaying with opencv: enter image description here

Neural Style Transfer results: enter image description here

I appreciate any input, thanks!

Copyright License:
Author:「user2758501」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/67790661/image-display-issue-neural-style-transfer

About “Image display issue, Neural Style Transfer” questions

I am attempting to read in my own images in python following the tensorflow Neural Style Transfer tutorial and when displaying them they look nothing like the original image. Can someone please exp...
I am quite new to machine learning and I want to understand Neural Style Transfer better, but I feel I'm missing something. As far as I know Backpropagation updates weights, not inputs. The genera...
I would like to use style transfer (example) in CoreML. Since CoreML support converting Keras my first thought was to convert one of their samples like this one or this one but it seems there's few...
I am working on Neural Style Transfer using VGG19 model. I am trying to follow the paper: A Neural Algorithm of Artistic Style (https://arxiv.org/pdf/1508.06576.pdf) and trying to reconstruct the i...
I am trying to implement the Neural style transfer example in pycharm. Link https://www.tensorflow.org/beta/tutorials/generative/style_transfer#setup. I installed all of the needed cuda software an...
Here, I read some tensorflow implementation of style transfer. Specifically, it defines the loss which is then to be optimized. In one loss function, it says: ` def sum_style_losses(sess, net,
I am following along the keras example for neural style transfer and in the style loss function they divide by the number 4, I have read the original paper by Gatys et al. and other articles in sea...
Is it possible to do transfer learning for vanilla neural network? I meant vanilla neural network as classic classification prediction such as whether the transaction is a fraud, the employee may q...
I'm messing around with jcjohnson/neural-style. I have it up and running just fine. However, I cannot for the life of me make the -output_image or -init flags work. My gut says it's some very simple
I am writing an implementation of style transfer by loading a vgg model from keras and supplying it to a tensorflow model. I am using an adam optimizer. The loss function is reducing but it is ver...

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.