Dataflow Compiler Error: Trying to compile Yolov10m model

Hello, I just received my RPI5 with HAILO Ai Kit. I want to compile my fine-tuned yolov10m model to HAR using the Dataflow Compiler. Modelzoo seems to not support Yolo10m (only, S and N). I get following error when trying to run my script:

from hailo_sdk_client import ClientRunner

chosen_hw_arch = "hailo8"
onnx_model_name = "yolov10m"
onnx_path = "license_detector_pi_1280.onnx"


runner = ClientRunner(hw_arch=chosen_hw_arch)
hn, npz = runner.translate_onnx_model(
onnx_path,
onnx_model_name,
#start_node_names=["input.1"],
#end_node_names=["1774"],
#net_input_shapes={"input.1": [1, 3, 1280, 1280]},
)
[info] Translation started on ONNX model license_detector_pi_1280_fixed
[info] Restored ONNX model license_detector_pi_1280_fixed (completion time: 00:00:00.36)
[info] Extracted ONNXRuntime meta-data for Hailo model (completion time: 00:00:02.70)
[info] Simplified ONNX model for a parsing retry attempt (completion time: 00:00:40.33)
Traceback (most recent call last):
  File "/home/jens/PycharmProjects/hailo_compile/.venv/lib/python3.8/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 220, in translate_onnx_model
    parsing_results = self._parse_onnx_model_to_hn(
  File "/home/jens/PycharmProjects/hailo_compile/.venv/lib/python3.8/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 300, in _parse_onnx_model_to_hn
    return self.parse_model_to_hn(
  File "/home/jens/PycharmProjects/hailo_compile/.venv/lib/python3.8/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 351, in parse_model_to_hn
    fuser = HailoNNFuser(converter.convert_model(), net_name, converter.end_node_names)
  File "/home/jens/PycharmProjects/hailo_compile/.venv/lib/python3.8/site-packages/hailo_sdk_client/model_translator/translator.py", line 79, in convert_model
    self._create_layers()
  File "/home/jens/PycharmProjects/hailo_compile/.venv/lib/python3.8/site-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 34, in _create_layers
    self._add_direct_layers()
  File "/home/jens/PycharmProjects/hailo_compile/.venv/lib/python3.8/site-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 111, in _add_direct_layers
    self._layer_callback_from_vertex(vertex)
  File "/home/jens/PycharmProjects/hailo_compile/.venv/lib/python3.8/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_translator.py", line 391, in _layer_callback_from_vertex
    consumed_vertices = self._create_tile_layer(vertex)
  File "/home/jens/PycharmProjects/hailo_compile/.venv/lib/python3.8/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_translator.py", line 1174, in _create_tile_layer
    axis, repeats = filtered_repeats[0]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jens/PycharmProjects/hailo_compile/onnx_to_har.py", line 12, in <module>
    hn, npz = runner.translate_onnx_model(
  File "/home/jens/PycharmProjects/hailo_compile/.venv/lib/python3.8/site-packages/hailo_sdk_common/states/states.py", line 16, in wrapped_func
    return func(self, *args, **kwargs)
  File "/home/jens/PycharmProjects/hailo_compile/.venv/lib/python3.8/site-packages/hailo_sdk_client/runner/client_runner.py", line 1158, in translate_onnx_model
    parser.translate_onnx_model(
  File "/home/jens/PycharmProjects/hailo_compile/.venv/lib/python3.8/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 260, in translate_onnx_model
    parsing_results = self._parse_onnx_model_to_hn(
  File "/home/jens/PycharmProjects/hailo_compile/.venv/lib/python3.8/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 300, in _parse_onnx_model_to_hn
    return self.parse_model_to_hn(
  File "/home/jens/PycharmProjects/hailo_compile/.venv/lib/python3.8/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 351, in parse_model_to_hn
    fuser = HailoNNFuser(converter.convert_model(), net_name, converter.end_node_names)
  File "/home/jens/PycharmProjects/hailo_compile/.venv/lib/python3.8/site-packages/hailo_sdk_client/model_translator/translator.py", line 79, in convert_model
    self._create_layers()
  File "/home/jens/PycharmProjects/hailo_compile/.venv/lib/python3.8/site-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 34, in _create_layers
    self._add_direct_layers()
  File "/home/jens/PycharmProjects/hailo_compile/.venv/lib/python3.8/site-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 111, in _add_direct_layers
    self._layer_callback_from_vertex(vertex)
  File "/home/jens/PycharmProjects/hailo_compile/.venv/lib/python3.8/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_translator.py", line 391, in _layer_callback_from_vertex
    consumed_vertices = self._create_tile_layer(vertex)
  File "/home/jens/PycharmProjects/hailo_compile/.venv/lib/python3.8/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_translator.py", line 1174, in _create_tile_layer
    axis, repeats = filtered_repeats[0]
IndexError: list index out of range

Process finished with exit code 1

I tried to replace Tile layers with Expand/Concat nodes and also tried to ONNX simplifier. Nothing of the above works. Thank you for any help.

1 Like

Hey @jens

Welcome to the Hailo Community !

The error you’re seeing during ONNX model translation indicates a problem with the Tile operation in your YOLOv10m model. Specifically, the “list index out of range” error in the create_tile_layer function suggests an issue in parsing or simplifying the Tile operation when converting to Hailo’s format.

To resolve this, consider trying these approaches:

  1. Manual Node Selection: Use start and end nodes in your translate_onnx_model function to exclude problematic layers during compilation. For example:
hn, npz = runner.translate_onnx_model(
    onnx_path,
    onnx_model_name,
    start_node_names=["input.1"],
    end_node_names=["1774"],
    net_input_shapes={"input.1": [1, 3, 1280, 1280]}
)

Adjust the node names based on your network’s structure.
2. Further ONNX Model Simplification: Use the ONNX optimizer tool to remove or replace unsupported operations:

python3 -m onnxsim license_detector_pi_1280.onnx simplified_model.onnx

Or target specific problematic nodes:

python3 -m onnxoptimizer license_detector_pi_1280.onnx optimized_model.onnx --passes fuse_pad_into_conv --fuse_bn_into_conv
  1. Custom Layer Handling: If Tile operations are crucial, consider implementing a custom layer workaround. Try rewriting the Tile operation using simpler layers that Hailo supports, such as Concat or Expand.

These methods aim to either bypass the problematic Tile operations or transform them into Hailo-compatible alternatives. Remember to adjust the specific node names and model paths according to your YOLOv10m model structure.