I'm having a very difficult time using style loss in the feed forward network. As a test,
if I replace this line from the notebook
loss = Lambda(lambda x: K.sqrt(K.mean(x-x)**2, (1,2)))([vgg1, vgg2])
loss = Lambda(lambda x: style_loss(x,x), (1,2))([vgg1, vgg2])
ValueError: Dimension must be 4 but is 3 for 'transpose_5' (op: 'Transpose') with input shapes: [?,144,144,128], .
Which comes from this line in the gram matrix function:
features = K.batch_flatten(K.permute_dimensions(x, (2, 0, 1)))
The tensorflow tensor has four dimension, the first I assumed was the # of images. So I altered that line to
features = K.batch_flatten(K.permute_dimensions(x, (0, 3, 1, 2)))
Which keeps puts channels in rows but doesn't touch that "item" index. I have no idea if this is correct. But when I do this, I get
ValueError: None values not supported.
from this line:
return K.dot(features, K.transpose(features)) / x.get_shape().num_elements()
Any guidance on this would be helpful!