hfawaz/dl-4-tsc

ValueError: Unknown layer: InstanceNormalization

Huii opened this issue · 3 comments

Huii commented

First of all: Thank you very much for providing this code. It really helps a lot not to reinvent the wheel every time.

Unfortunately, I'm greeted with the following error whenever I attempt to run the "Encoder" model:

ValueError: Unknown layer: InstanceNormalization

I did not change anything in the way the layers are imported. Could you please have a look into this issue?

Huii commented

Actually, I just found the solution myself:

The line

model = keras.models.load_model(self.output_directory + 'best_model.hdf5')

in the fitting method needs to be changed to

model = keras.models.load_model(self.output_directory + 'best_model.hdf5',custom_objects={'InstanceNormalization':keras_contrib.layers.InstanceNormalization})

Now, everything seems to work just fine.

Hi,

Okay great, thanks for sharing!

This really helped me too