I am trying to convert a Detectron 2 model into Core ML. I have scripted it and now I have a model of type 'torch.jit._script.RecursiveScriptModule'. If I try and convert it into Core ML using this code:
mlmodel = ct.converters.convert(
torchscipt_model,
inputs=[ct.TensorType(shape=(1, 3, 64, 64))],
)
I get the following error:
RuntimeError: Unknown type bool encountered in graph lowering. This type is not supported in ONNX export.
I scripted the model using the following code (as illustrated in Detectron's documentation)
model = build_model(cfg)
model.eval()
fields = {"pred_boxes": Boxes, "scores": torch.Tensor, "pred_classes": torch.Tensor, "pred_masks": torch.Tensor, "proposal_boxes": Boxes, "objectness_logits": torch.Tensor}
torchscipt_model = scripting_with_instances(model, fields)
Do you know any other way to convert my Detectron2 model into Core ML?
Thank you so much for your help!