keras-onnx icon indicating copy to clipboard operation
keras-onnx copied to clipboard

How can do custom conversion?

Open K-M-Ibrahim-Khalilullah opened this issue 4 years ago • 5 comments

@jiafatom @nswamy @buddhapuneeth Thank you very much for your repo. I want to convert keras model of maskrcnn into onnx format. I need custom conversion.

Is there any example or clue?

K-M-Ibrahim-Khalilullah avatar Jul 22 '20 22:07 K-M-Ibrahim-Khalilullah

The example of converting keras mask-rcnn is here and running in our nightly build every day. The model has a custom conversion example: set_converter('CropAndResize', convert_tf_crop_and_resize).

jiafatom avatar Jul 22 '20 22:07 jiafatom

Hi @jiafatom,

Thanks for sharing that code, I'm trying to do this but with custom trained weights, I see you downloaded mask_rcnn_coco.h5, but I don't see where the weights gets loaded into the model... how could I change that to load the custom weights ?

Also where did you get test_utils ? (from test_utils import run_onnx_runtime, print_mismatches, convert_tf_crop_and_resize)

danielsernabuitrago avatar Aug 14 '20 14:08 danielsernabuitrago

To load your custom weights, just change model.load_weights here. test_utils is in our source code, please search inside our repo.

jiafatom avatar Aug 14 '20 17:08 jiafatom

thanks a lot @jiafatom, yeah I found it now... I'm going to try it out.

danielsernabuitrago avatar Aug 14 '20 18:08 danielsernabuitrago

Thanks a lot @jiafatom it worked !!

danielsernabuitrago avatar Aug 14 '20 20:08 danielsernabuitrago