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

How can we add or change a layer #70

Open
Arindam-Jain opened this issue Feb 24, 2021 · 1 comment
Open

How can we add or change a layer #70

Arindam-Jain opened this issue Feb 24, 2021 · 1 comment

Comments

@Arindam-Jain
Copy link

Arindam-Jain commented Feb 24, 2021

Please guide me on how can I change the in btw layer or last layer

shape, classes = (150, 150, 3), 11
x = keras.layers.Input(shape)

model = keras_resnet.models.ResNet50(x, classes=classes)
model.add(Dense(11, activation = "softmax")) <----- How can I add this layer? or make it last layer
model.compile(Adam(lr=0.0001), loss='binary_crossentropy', metrics=['accuracy'])

Thanks,
Arindam

@ro-hit81
Copy link

ro-hit81 commented Jul 21, 2022

You can do as:

x = keras.layers.Input(shape)

resnet_arch= keras_resnet.models.ResNet50(x, classes=classes)
layer_1 = (keras.layers.Dense(11, activation='softmax', name="Dense_1"))(resnet_arch.output)
model = keras.models.Model(inputs=resnet_arch.input, outputs=layer_1)
model.compile(Adam(lr=0.0001), loss='binary_crossentropy', metrics=['accuracy'])
model.summary() ```

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

2 participants