ImportError: cannot import name 'BatchNormalization' from 'keras.layers.normalization'
MritulaC opened this issue · comments
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, 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 withfrom tensorflow.keras.layers import ( BatchNormalization, SeparableConv2D, MaxPooling2D, Activation, Flatten, Dropout, Dense, UpSampling2D,Reshape,Conv2D )
For line no 9 replace withfrom tensorflow.keras.optimizers import SGD
For line no 10 replace withfrom 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.