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

Name Error-" name 'Flatten' is not defined ", when i try to fine tune the pretrained model on InceptionV3 #11415

Closed
tejasri19 opened this issue Oct 17, 2018 · 3 comments

Comments

@tejasri19
Copy link

NameError Traceback (most recent call last)
in ()
1 # set up transfer learning on pre-trained ImageNet Inception_V3 model - remove fully connected layer and replace
2 # with softmax for classifying 10 classes
----> 3 incepV3_model = InceptionV3(weights = 'imagenet', include_top = False, input_shape=(299,299,3))
4 x = incepV3_model.output
5 x = Flatten(name='flatten')(x)

~/anaconda3/envs/tensorflow-venv/lib/python3.6/site-packages/keras_applications/inception_v3.py in InceptionV3(include_top, weights, input_tensor, input_shape, pooling, classes)
362 elif pooling == 'max':
363 x = layers.GlobalMaxPooling2D()(x)
--> 364 x = Flatten(name='flatten')(x)
365 # Ensure that the model takes into account
366 # any potential predecessors of input_tensor.

NameError: name 'Flatten' is not defined

@gabrieldemarmiesse
Copy link
Contributor

name xxx is not defined in python means that this variable does not exist. It's very likely unrelated to keras. Maybe you forgot to import Flatten?

@tejasri19
Copy link
Author

I have imported Flatten from keras.layers , even though the error occurs

@nader-chmait
Copy link

import keras.utils

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

No branches or pull requests

3 participants