Skip to content

Instantly share code, notes, and snippets.

@Abhayparashar31
Created June 11, 2022 04:54
Show Gist options
  • Save Abhayparashar31/d0c80605e66f272c71564f8345f35fdb to your computer and use it in GitHub Desktop.
Save Abhayparashar31/d0c80605e66f272c71564f8345f35fdb to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
from keras.layers import Dense,Flatten
from keras.models import Model
from keras.models import Sequential
# Image Size
IMAGE_SIZE = [224, 224]
# Load Pretrained Model
from keras.applications.vgg16 import VGG16
vgg = VGG16(input_shape= IMAGE_SIZE + [3], weights ='imagenet',
include_top= False)
# Freeze layers
for layer in vgg.layers:
layer.trainable = False
# Add custom output layer
x = Flatten()(vgg.output)
prediction = Dense(3, activation= 'softmax')(x)
model_1 = Model(inputs= vgg.input, outputs=prediction)
# Generate Model Summary
model_1.summary()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment