segmentation_models icon indicating copy to clipboard operation
segmentation_models copied to clipboard

Unable to load the save model

Open sumanttyagi opened this issue 4 years ago • 3 comments

#i have saved model in metric term of iou_score but when trying to load it up it throw the below error can somebody please guide me how to load the model???

9 frames /tensorflow-1.15.2/python3.7/tensorflow_core/python/keras/utils/generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name) 208 obj = module_objects.get(object_name) 209 if obj is None: --> 210 raise ValueError('Unknown ' + printable_module_name + ':' + object_name) 211 # Classes passed by name are instantiated with no args, functions are 212 # returned as-is.

ValueError: Unknown metric function:iou_score

sumanttyagi avatar May 29 '21 07:05 sumanttyagi

I haven't tried this but it's very likely the problem is the same as #466. Presumably you need to pass the custom object of iou_score when you load the model.

twVolc avatar Jun 03 '21 13:06 twVolc

Dont forget to add this import -> import segmentation_models as sm

'iou_score': sm.metrics.iou_score,

sachinkmohan avatar Jan 12 '22 13:01 sachinkmohan

You can close this issue!

sachinkmohan avatar Jan 12 '22 13:01 sachinkmohan