Hi there,
I’m trying to compile a custom MaskRCNN for an hailo8.
The hardware has on it hailort 4.15 on it that’s why I’m using an old version of the DFC.
I successfully converted my model to onnx, I have both a straight model and a simplified version. Both of them are throwing errors during first conversion to .har .
Here is the snippet I’m running:
“”"
onnx_model = onnx.load(ONNX_MODEL_PATH)
if start_node is None:
start_node = onnx_model.graph.node[0]
print(f"start node: \n{start_node}“)
start_node = start_node.name
if end_node is None:
end_node = onnx_model.graph.node[-1]
print(f"end_node: \n{end_node}”)
end_node = end_node.name
try:
runner = ClientRunner(hw_arch=hardware)
hn, npz = runner.translate_onnx_model(ONNX_MODEL_PATH, model_name, start_node_names=[start_node], end_node_names=[end_node])
“”"
But the translation is throwing:
“”"
start node:
input: “backbone.body.layer4.0.bn3.bias”
output: “backbone.body.layer4.0.downsample.1.bias”
name: “Identity_1053”
op_type: “Identity”
end_node:
input: “res_append.7”
input: “/Constant_35_output_0”
output: “masks”
name: “/Unsqueeze_8”
op_type: “Unsqueeze”
[warning] Large model detected. The graph contains a large number of operators and variables, and might take a bit longer to load from ONNX.
[warning] ONNX shape inference failed: Unsupported dynamic shape([-1, 3, 0, 0]) found on input node input. Please use net_input_shapes, see documentation for additional info.
[info] Found a net_name that starts with a digit, added a prefix. New net_name is net_20k_longlong
[info] Attempting to retry parsing on a simplified model, using onnx simplifier
[warning] ONNX shape inference failed: Unsupported dynamic shape([-1, 3, 0, 0]) found on input node input. Please use net_input_shapes, see documentation for additional info.
[info] Found a net_name that starts with a digit, added a prefix. New net_name is net_20k_longlong
Failed to convert onnx to har: Can’t find vertex Identity_1053 in graph
“”"
I visualized the graph and found the first node to be a “/Split” immediatly below the input. So I fed it as start_node, moreover I added the option “net_input_shapes=[-1,480,640,3]” to solve the dynamic input warning. By the way [-1,480,640,3] is the shape of the images that I feed to the pytorch model.
The output changes to:
“”"
[warning] Large model detected. The graph contains a large number of operators and variables, and might take a bit longer to load from ONNX.
[warning] ONNX shape inference failed: [ONNXRuntimeError] : 1 : FAIL : Node (/transform/Sub) Op (Sub) [ShapeInferenceError] Incompatible dimensions
[info] Found a net_name that starts with a digit, added a prefix. New net_name is net_20k_longlong
[info] Attempting to retry parsing on a simplified model, using onnx simplifier
[warning] ONNX shape inference failed: [ONNXRuntimeError] : 1 : FAIL : Node (/transform/Sub) Op (Sub) [ShapeInferenceError] Incompatible dimensions
[info] Found a net_name that starts with a digit, added a prefix. New net_name is net_20k_longlong
Failed to convert onnx to har: list index out of range
“”"
What can I do? Are there any good practices to adopt while dealing big models?
I tried the same code with a different model and successfully compiled it.