Skip to content

Issue with loading library keras-contrib #9

Closed
@iamyihwa

Description

@iamyihwa

Hello David! Thanks for the great book!

I have ran an error when running CycleGan notebook: 05_01_cyclegan_train.ipynb
It is due to an error 'keras_contrib' library not found.

So I have installed the library separately, from the github of keras-contrib .

import os
import matplotlib.pyplot as plt

from models.cycleGAN import CycleGAN
from utils.loaders import DataLoader
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-6-647ffcce73df> in <module>
      2 import matplotlib.pyplot as plt
      3 
----> 4 from models.cycleGAN import CycleGAN
      5 from utils.loaders import DataLoader

~/GAN/GDL_code/models/cycleGAN.py in <module>
      5 #have replaced above with below line on 2019 7 8
      6 #due to an error
----> 7 from keras_contrib.layers.normalization.instancenormalization import InstanceNormalization
      8 from keras.layers import Input, Dense, Reshape, Flatten, Dropout, Concatenate
      9 from keras.layers import BatchNormalization, Activation, ZeroPadding2D, Add

ModuleNotFoundError: No module named 'keras_contrib'

After installing the library, it seems to work okay, but need to change slightly the command
following this
From this :

from keras_contrib.layers.normalization import InstanceNormalization
To this:
from keras_contrib.layers.normalization.instancenormalization import InstanceNormalization

However from the notebook it still doesn't work.
I have tried it both from the same conda environment ..
Any ideas?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions