While trying to import VGG19 model, the code below generates an error of non tensor inputs. Although I am following another this code snippet here.
Code:
from keras.applications.vgg19 import VGG19
import keras.backend as K
from keras.models import Model
import imageio as iio
image_shape = (384,384,3)
vgg19 = VGG19(include_top=False, weights='imagenet', input_shape=image_shape)
vgg19.trainable = False
# Make trainable as False
for l in vgg19.layers:
l.trainable = False
model = Model(inputs=vgg19.input, outputs=vgg19.get_layer('block5_conv4').output)
model.trainable = False
img1 = iio.imread('img1.jpg')
img2 = iio.imread('img2.jpg')
mean = K.mean(K.square(model(img1) - model(img2)))
Error:
...,
[164, 90, 0, 255],
[164, 90, 0, 255],
[164, 90, 0, 255]]]], dtype=uint8)]. All inputs to the layer should be tensors.
unable to figure out why.