conv_base = Net(weights='imagenet', include_top=False,pooling='max')
conv_base.trainable = False
model = models.Sequential()
model.add(conv_base)
model.add(layers.GlobalMaxPooling2D(name="gap"))
model.add(layers.Dropout(dropout_rate, name="dropout_out"))
model.add(layers.Dense(4, activation='softmax', name="fc_out"))
model.summary()
The Error is TypeError: The added layer must be an instance of class Layer. Found:
This worked for me on Keras 2.2.5 and Tensorflow 1.15.0.
from keras.applications.resnet import ResNet50
from keras import layers
from keras import models
conv_base = ResNet50(weights='imagenet', include_top=False,pooling=None)
conv_base.trainable = False
model = models.Sequential()
model.add(conv_base)
model.add(layers.GlobalMaxPooling2D(name="gap"))
model.add(layers.Dropout(0.5, name="dropout_out"))
model.add(layers.Dense(4, activation='softmax', name="fc_out"))
model.summary()
Most helpful comment
This worked for me on Keras 2.2.5 and Tensorflow 1.15.0.