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

ImportError: cannot import name 'BatchNormalization' from 'keras.layers.normalization' #32

Open
MritulaC opened this issue Jan 19, 2022 · 1 comment

Comments

@MritulaC
Copy link

MritulaC commented Jan 19, 2022

Hi,
I kept getting the below error when trying to execute dcgan.py file, when trying to execute in Colab

ImportError: cannot import name 'BatchNormalization' from 'keras.layers.normalization'

To over come this replace in the initial inclusions from line no 1 to 8 as below with Tensorflow

For line no 1 from tensorflow.keras.models import Sequential
For line no 2:8 replace it with from tensorflow.keras.layers import ( BatchNormalization, SeparableConv2D, MaxPooling2D, Activation, Flatten, Dropout, Dense, UpSampling2D,Reshape,Conv2D )
For line no 9 replace with from tensorflow.keras.optimizers import SGD
For line no 10 replace with from tensorflow.keras.datasets import mnist

Hope this helps!

Regards,
Mritula

@reginalluna
Copy link

reginalluna commented Mar 21, 2022

Hi, I kept getting the below error when trying to execute dcgan.py file, when trying to execute in Colab

ImportError: cannot import name 'BatchNormalization' from 'keras.layers.normalization'

To over come this replace in the initial inclusions from line no 1 to 8 as below with Tensorflow

For line no 1 from tensorflow.keras.models import Sequential For line no 2:8 replace it with from tensorflow.keras.layers import ( BatchNormalization, SeparableConv2D, MaxPooling2D, Activation, Flatten, Dropout, Dense, UpSampling2D,Reshape,Conv2D ) For line no 9 replace with from tensorflow.keras.optimizers import SGD For line no 10 replace with from tensorflow.keras.datasets import mnist

Hope this helps!

Regards, Mritula

Hi,
First of all, you must first ensure that you have Python 3.5 installed before installing tensorflow==1.0.0 (tensorflow-gpu==1.0.0) and keras==2.0.2. Then you have to make sure to get h5py and Pillow through pip install. You're ready to go once you've completed these steps.

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

2 participants