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

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

Open
liangchao520 opened this issue Oct 11, 2019 · 3 comments

Comments

@liangchao520
Copy link

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.

@areebsyed
Copy link

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.

@scchess
Copy link

scchess commented Mar 19, 2021

Commenting it out worked.

@Astha-Bhushan
Copy link

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

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

4 participants