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

Fine tuning VGG16 #18

Open
jroberayalas opened this issue May 18, 2017 · 0 comments
Open

Fine tuning VGG16 #18

jroberayalas opened this issue May 18, 2017 · 0 comments

Comments

@jroberayalas
Copy link

Hi,

Just a quick question, I'm trying to fine tune the VGG16 as suggested in the notebook 2.4. However, I got an error: The shape of the input to "Flatten" is not fully defined (got (None, None, 512). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.. Not sure if anyone can give me a hint on this. My code is shown below:

from keras.applications import VGG16

model = VGG16(include_top=False)
for layer in model.layers:
    layer.trainable = False

top_model = Sequential()
top_model.add(Flatten(input_shape=model.output_shape[1:]))
top_model.add(Dense(768, activation='sigmoid'))
top_model.add(Dropout(0.0))
top_model.add(Dense(768, activation='sigmoid'))
top_model.add(Dropout(0.0))
top_model.add(Dense(n_labels, activation='softmax'))

model.add(top_model)

train_model(model,
            (X_train_gte5, y_train_gte5),
            (X_test_gte5, y_test_gte5), nb_classes)
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

1 participant