Fast Style Transfer Upsample Dimension error


(Ankir) #1

Hi there, trying to implement Fast Style transfer but there is this an issue iam stuck for two days. Dimension error while calculating total loss which i think arises from not properly implementing Upsampling. I have even look at Jeremy code and tried to implement that as well but getting same error. Keras Version 2.0.2. Any help would be appreciated. Here is my code link on Github https://github.com/RhaeY/DeepL/blob/master/Faster%20Neural%20Transfer%20WIth%20Perceptual%20Loss.ipynb


(Javier Rodriguez Zaurin) #2

Hey

I don’t know if you solved it, but just in case, the only thing you need to do is to simply change the method name:

get_output_shape_for

with

compute_output_shape

at the custom layer ReflectionPadding2D

This is more or less explicit in the error message you get when you run ReflectionPadding2D:

_.ReflectionPadding2D defines get_output_shape_for but does not override compute_output_shape. If this is a Keras 1 layer, please implement compute_output_shape to support Keras 2. output_shape = self.compute_output_shape(input_shape)

Hope it helps!