Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: Unknown layer: InstanceNormalization #8

Closed
Huii opened this issue Jul 26, 2019 · 3 comments
Closed

ValueError: Unknown layer: InstanceNormalization #8

Huii opened this issue Jul 26, 2019 · 3 comments

Comments

@Huii
Copy link

Huii commented Jul 26, 2019

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
Copy link
Author

Huii commented Jul 26, 2019

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.

@hfawaz
Copy link
Owner

hfawaz commented Jul 26, 2019

Hi,

Okay great, thanks for sharing!

@hfawaz hfawaz closed this as completed Jul 26, 2019
@sabooakhter
Copy link

This really helped me too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants