-
-
Save d-misra/8aa34bce67a5e3ed13b6edc5f0dacfe0 to your computer and use it in GitHub Desktop.
VGG16 model for clustering
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.models import load_model, Model | |
from keras.applications.vgg16 import VGG16, preprocess_input | |
def setup_model(layer='fc2'): | |
base_model = VGG16(weights='imagenet', include_top=True) | |
# base_model.summary(): | |
# .... | |
# block5_conv4 (Conv2D) (None, 15, 15, 512) 2359808 | |
# _________________________________________________________________ | |
# block5_pool (MaxPooling2D) (None, 7, 7, 512) 0 | |
# _________________________________________________________________ | |
# flatten (Flatten) (None, 25088) 0 | |
# _________________________________________________________________ | |
# fc1 (Dense) (None, 4096) 102764544 | |
# _________________________________________________________________ | |
# fc2 (Dense) (None, 4096) 16781312 | |
# _________________________________________________________________ | |
# predictions (Dense) (None, 1000) 4097000 | |
# | |
model = Model(inputs=base_model.input, | |
outputs=base_model.get_layer(layer).output) | |
return model |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment