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

no such layer flatten #12

Open
chaturbhuj02 opened this issue Dec 17, 2017 · 6 comments
Open

no such layer flatten #12

chaturbhuj02 opened this issue Dec 17, 2017 · 6 comments

Comments

@chaturbhuj02
Copy link

File "", line 1, in
data_manager.preprocess()

File "C:/Users/chaturbhuj/Downloads/Compressed/neural_image_captioning-master/src/data_manager.py", line 75, in preprocess
self.get_image_features(self.image_directory)

File "C:/Users/chaturbhuj/Downloads/Compressed/neural_image_captioning-master/src/data_manager.py", line 232, in get_image_features
output=base_model.get_layer('flatten').output)

File "C:\Users\chaturbhuj\Anaconda3\lib\site-packages\keras\engine\topology.py", line 1868, in get_layer
raise ValueError('No such layer: ' + name)

ValueError: No such layer: flatten

@chaturbhuj02
Copy link
Author

could you help me with that error

@vasudhabansal1994
Copy link

I am also facing the same error. Could you please help me to solve this issue.
Thank you.

@jubayer-hasan
Copy link

I'm having this error also.
File "train.py", line 22, in
data_manager.preprocess()
File "/home/jubayer/data_manager.py", line 75, in preprocess
self.get_image_features(self.image_directory)
File "/home/jubayer/data_manager.py", line 232, in get_image_features
output=base_model.get_layer('flatten').output)
File "/home/jubayer/Jubayer/lib/python3.5/site-packages/keras/engine/topology.py", line 1887, in get_layer
raise ValueError('No such layer: ' + name)
ValueError: No such layer: flatten
How can I solve this?

@HankyuJang
Copy link

Did anyone solve this error? I am stuck here...

@jubayer-hasan
Copy link

I think there was a problem extracting the image feature. If you set the flag to 'True' then it extracts all image features from scratch. But if you don't and run the train file then it uses the pre trained model of image features given by the author to generation. So, only the data_manager.preprocess() has the problem here.

@devinhee
Copy link

devinhee commented Dec 3, 2019

before you get the base_model, you can check the model summary to see name of each layer.
like this:
base_model = resnet50.ResNet50(weights="imagenet", include_top=True) base_model.summary()
you will find whether there is a layer called 'flatten', and find out name of the layer you real need
and then output=base_model.get_layer('flatten').output)

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

5 participants