broadinstitute / keras-resnet

Keras package for deep residual networks
Other
300 stars 127 forks source link

load model? #29

Open whmrtm opened 6 years ago

whmrtm commented 6 years ago

Hi @0x00b1, when I was trying to load the saved resnet18, got the error: "ResNet18' object has no attribute 'load' . Can we have the load function implemented?

hgaiser commented 6 years ago

load_model is implemented in keras.models. Try:

model = keras.models.load_model(model_path)
NicolettaK commented 6 years ago

When I reload a saved model with keras.models.load_model(model_path) I got a the following error:

TypeError: ('Keyword argument not understood:', 'freeze')

how can I overcome it?

nhannguyen2709 commented 6 years ago

@NicolettaK You got that error since keras_resnet library uses a custom BatchNormalization layer

The following code works for me: model = load_model(model_path, custom_objects={'BatchNormalization': keras_resnet.layers.BatchNormalization})

AirFishWang commented 4 years ago

@NicolettaK You got that error since keras_resnet library uses a custom BatchNormalization layer

The following code works for me: model = load_model(model_path, custom_objects={'BatchNormalization': keras_resnet.layers.BatchNormalization})

@nhannguyen2709 it not works for me, I don't know why