First off, I'm mainly a wet-lab biologist, and Python is not my strong suit, so sorry if I seem a little clueless here. Anyways, I am having trouble converting a pretrained keras model (.h5 format) with coremltools. My code to try and convert the model:
DL_model = (path to .h5 file)
model_converted = ct.convert(DL_model, source = "tensorflow")
and it throws an error:
ValueError: Unknown metric function: binary_recall. 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.
I assume I need to pass some sort of custom_objects = {"custom_obj": custom_obj} argument in ct.convert, but I don't know how. I tried:
custom_objects = {"binary_recall": binary_recall})
but that caused
NameError: name 'binary_recall' is not defined
Can anyone give me some help here? It would be nice to speed up this model by converting it to Apple's format; I work with huge files and cutting down data processing time is important for me.
Thanks!!
Noah