!pip install -q efficientnet
import efficientnet.tfkeras as efn
# Need this line so Google will recite some incantations
# for Turing to magically load the model onto the TPU
with strategy.scope():
enet = efn.EfficientNetB7(
input_shape=(IMAGE_SIZE[0], IMAGE_SIZE[1], 3),
weights='imagenet',
include_top=False
)
enet.trainable = True
model = tf.keras.Sequential([
enet,
tf.keras.layers.GlobalAveragePooling2D(),
tf.keras.layers.Dense(len(CLASSES), activation='softmax')
])
model.compile(
optimizer='adam',
loss = 'sparse_categorical_crossentropy',
metrics=['sparse_categorical_accuracy']
)
model.summary()
models.append(model)