The loaded model behaves inconsistently
See original GitHub issueFirst of all, thank you for this awesome library!
I exported, and imported the model with this code:
# save weights
model.save_weights("model.h5")
from keras_segmentation.models.unet import vgg_unet
# load model
model_weight_path = 'model.h5'
model = vgg_unet(n_classes=6, input_height=640, input_width=640)
model.load_weights(model_weight_path, by_name=True)
In some cases when I load the model, I got good prediction results that is middle in the table, and then if I use the same code, the same model, I got this strange result which is bottom in the table.
I use Google Colab, Keras 2.1.0. keras-segmentation-0.2.0
I installed keras-segmentation with pip. I tried with Keras 2.2.5 as well, and I got the same strange behavior.
What can it cause this phenomenon?
Thanks, for your help!
Original image | |
---|---|
Good result | |
Bad result |
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
python 3.x - Pytorch Loaded model giving inconsistent results
Now the model predicts the 0 has the output for every input. Is there anything wrong with way I saved the model or...
Read more >Loading saved models gives inconsistent results each time
When I load multiple models one after another with below method only first gives expected results on the test, others fail.
Read more >Legitimate cases of having .equals() behaving inconsistently ...
When the Java documentation says that these two methods must behave consistently, what they mean is that the .equals method must return true...
Read more >How AWS dumps the mental burden of inconsistent APIs on ...
So functionally, they behave like the List operations in IAM. Inconsistency between related AWS services. Kinesis is a great example of ...
Read more >10. Common pitfalls and recommended practices - Scikit-learn
10.2. Data leakage¶. Data leakage occurs when information that would not be available at prediction time is used when building the model. This...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@bessszilard , replace
model.load_weights(model_weight_path, by_name=True)
withmodel.load_weights(model_weight_path)
and it should work fine!That is strange. Could you share some reproducible snippet or the maybe the collab notebook? I can take a look.
One reason causing the problem could be that weights of all the layers are not being loaded properly. That could be checked by comparing the weights.