keras-squeezenet icon indicating copy to clipboard operation
keras-squeezenet copied to clipboard

how to solve"ImportError: cannot import name 'warnings' from 'keras.layers'"

Open liangchao520 opened this issue 5 years ago • 3 comments

Tensorflow Version

Please replace this line with Tensorflow version you are using.

Keras Version

Please replace this line with Keras version you are using.

Keras-squeezenet Version

Please replace this line with Keras-squeezenet version you are using.

Bug reports:

why always meet this problem when i am runing sequeezenet.can you give me some advices Please replace this line with a brief summary of your issue AND if reporting a build issue include the link from:

Code Sample:

Please replace this line with a code sample to replicate the issue.

liangchao520 avatar Oct 11 '19 10:10 liangchao520

I solved this error simply by commenting out the warnings section of the code. It just gives you statement printed if the program goes to that condition.

areebsyed avatar Feb 06 '20 07:02 areebsyed

Commenting it out worked.

scchess avatar Mar 19 '21 22:03 scchess

Tensorflow Version 2.6.0

Keras Version 2.6.0

Keras-squeezenet Version 0.4

Bug reports: why always meet this problem when i am runing sequeezenet.can you give me some advices: from keras.layers import Input, Convolution2D, MaxPooling2D, Activation, concatenate, Dropout, warnings ImportError: cannot import name 'warnings' from 'keras.layers' (C:\Users\Astha\miniconda3\envs\tf_2.4\lib\site-packages\keras\layers_init_.py)

Code Sample: Please replace this line with a code sample to replicate the issue. def get_model(): model = Sequential([ SqueezeNet(input_shape=(227, 227, 3), include_top=False), Dropout(0.5), Convolution2D(NUM_CLASSES, (1, 1), padding='valid'), Activation('relu'), GlobalAveragePooling2D(), Activation('softmax') ]) return model

Astha-Bhushan avatar Aug 26 '21 10:08 Astha-Bhushan