Created
June 11, 2022 04:54
-
-
Save Abhayparashar31/d0c80605e66f272c71564f8345f35fdb to your computer and use it in GitHub Desktop.
This file contains hidden or 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.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