-
Notifications
You must be signed in to change notification settings - Fork 27
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
Unable to load mobilenetv2 version #20
Comments
You must first create the model after load weights:
You can try like this, but I see it doens't work for me:
|
Hello, thank you for your prompt response. If I try your code (modified to my shape): from classification_models_3D.tfkeras import Classifiers I get this error: You are trying to load a weight file containing 125 layers into a model with 105 layers. My model has been instantiated with this code: model = sm.Unet('mobilenetv2',weights=None,input_shape=input_model_shape,encoder_weights=None) Could I just use the above line, and do model.load_weights('MobileNetModel.h5')? I ask because when I tried this my model spits out all 0s, even though the training IOU is ~0.7. Wondering if perhaps this method of loading weights isn't quite right? |
You didn't say in first message which model you used. Try this:
|
Check if during training and inference you have the same preprocessing of volumes. |
Unfortunately I don't know why result is like this... ( |
Interesting, thank you for your response. Have you trained models with mobilenetv2? Perhaps it's an inherent bug related to this model. This seems to be exactly the issue I am getting: |
No I never tried mobilenetv2 model for 3D tasks. I propose you to try resnet18_3D first. It also not so large and may be you avoid this problem. |
OK, I will try that and get back to you. I tried resnet18 first but it was training slow so I swapped, but maybe this is an inherent issue to mobilenet |
Hello, when I try to load a model which used a mobilenetv2 backbone:
model = tensorflow.keras.models.load_model(MobileNetModel.h5',compile=False)
I get this issue:
ValueError: Unknown layer: DepthwiseConv3D. Please ensure this object is passed to the
custom_objects
argument. See https://www.tensorflow.org/guide/keras/save_and_serialize#registering_the_custom_object for details.Any ideas on how to fix this?
The text was updated successfully, but these errors were encountered: