segmentation_models
segmentation_models copied to clipboard
AttributeError: module 'keras.utils' has no attribute 'get_file'
import efficientnet.keras as efn
import keras.backend as backend
with strategy.scope(): def build_model(): eff0 = efn.EfficientNetB0(weights='imagenet',include_top=False,input_shape=(224,224,3)) X = GlobalAveragePooling2D()(eff0.output) X = Dropout(0.5)(X) X = Dense(64)(X) X = Activation('relu')(X) X = Dense(7)(X) X = Activation('softmax')(X)
model = Model(inputs = eff0.input, outputs = X)
opt = Adam(lr=1.5e-4)
model.compile(loss='categorical_crossentropy',
optimizer=opt,
metrics=['accuracy'])
return model
model = build_model() model.summary()
#Error occur in bold line
use this: %env SM_FRAMEWORK=tf.keras before you run the model. it worked for me. or you can use this: import os os.environ['SM_FRAMEWORK'] = 'tf.keras' from segmentation_models import Unet #(for example)