Dataflow compiler (3.28.0) fails to parse fine-tuned yolov10n ONNX model

Hi :wave:

I’m trying to convert a yolov10n model, which was fine-tuned from ultralytics yolov10n.pt on a roboflow dataset with 1 objects class. The model was trained with this simple code:

from ultralytics import YOLO

model = YOLO("models/yolov10n.pt")

model.train(data="data/Aerial_Tank_Images.v2i.yolov9/data.yaml", epochs=100, imgsz=640,)

where data.yaml is:

train: ../train/images
val: ../valid/images
test: ../test/images

nc: 1
names: ['Tank']

roboflow:
  workspace: cv-9hntr
  project: aerial_tank_images
  version: 2
  license: CC BY 4.0
  url: https://universe.roboflow.com/cv-9hntr/aerial_tank_images/dataset/2

When I’m trying to parse the fine-tuned model (exported to ONNX), I get this error:

$ hailo parser onnx --hw-arch hailo8l best.onnx
[info] Current Time: 18:55:22, 07/20/24
[info] CPU: Architecture: , Model: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz, Number Of Cores: 12, Utilization: 1.5%
[info] Memory: Total: 46GB, Available: 36GB
[info] System info: OS: Linux, Kernel: 6.9.10-zen1-1-zen
[info] Hailo DFC Version: 3.28.0
[info] HailoRT Version: Not Installed
[info] PCIe: No Hailo PCIe device was found
[info] Running `hailo parser onnx --hw-arch hailo8l best.onnx`
[info] Translation started on ONNX model best
[info] Restored ONNX model best (completion time: 00:00:00.05)
[info] Extracted ONNXRuntime meta-data for Hailo model (completion time: 00:00:00.31)
[info] Simplified ONNX model for a parsing retry attempt (completion time: 00:00:01.29)
Traceback (most recent call last):
  File "/home/alex/T7/src/object_detection/hailo/venv/lib/python3.10/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/alex/T7/src/object_detection/hailo/venv/lib/python3.10/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/alex/T7/src/object_detection/hailo/venv/lib/python3.10/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/alex/T7/src/object_detection/hailo/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/translator.py", line 79, in convert_model
    self._create_layers()
  File "/home/alex/T7/src/object_detection/hailo/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 34, in _create_layers
    self._add_direct_layers()
  File "/home/alex/T7/src/object_detection/hailo/venv/lib/python3.10/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/alex/T7/src/object_detection/hailo/venv/lib/python3.10/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/alex/T7/src/object_detection/hailo/venv/lib/python3.10/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/alex/T7/src/object_detection/hailo/venv/bin/hailo", line 8, in <module>
    sys.exit(main())
  File "/home/alex/T7/src/object_detection/hailo/venv/lib/python3.10/site-packages/hailo_sdk_client/tools/cmd_utils/main.py", line 111, in main
    ret_val = client_command_runner.run()
  File "/home/alex/T7/src/object_detection/hailo/venv/lib/python3.10/site-packages/hailo_sdk_client/tools/cmd_utils/base_utils.py", line 68, in run
    return self._run(argv)
  File "/home/alex/T7/src/object_detection/hailo/venv/lib/python3.10/site-packages/hailo_sdk_client/tools/cmd_utils/base_utils.py", line 89, in _run
    return args.func(args)
  File "/home/alex/T7/src/object_detection/hailo/venv/lib/python3.10/site-packages/hailo_sdk_client/tools/parser_cli.py", line 188, in run
    runner = self._parse(net_name, args, tensor_shapes)
  File "/home/alex/T7/src/object_detection/hailo/venv/lib/python3.10/site-packages/hailo_sdk_client/tools/parser_cli.py", line 251, in _parse
    runner.translate_onnx_model(
  File "/home/alex/T7/src/object_detection/hailo/venv/lib/python3.10/site-packages/hailo_sdk_common/states/states.py", line 16, in wrapped_func
    return func(self, *args, **kwargs)
  File "/home/alex/T7/src/object_detection/hailo/venv/lib/python3.10/site-packages/hailo_sdk_client/runner/client_runner.py", line 1158, in translate_onnx_model
    parser.translate_onnx_model(
  File "/home/alex/T7/src/object_detection/hailo/venv/lib/python3.10/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/alex/T7/src/object_detection/hailo/venv/lib/python3.10/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/alex/T7/src/object_detection/hailo/venv/lib/python3.10/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/alex/T7/src/object_detection/hailo/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/translator.py", line 79, in convert_model
    self._create_layers()
  File "/home/alex/T7/src/object_detection/hailo/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 34, in _create_layers
    self._add_direct_layers()
  File "/home/alex/T7/src/object_detection/hailo/venv/lib/python3.10/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/alex/T7/src/object_detection/hailo/venv/lib/python3.10/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/alex/T7/src/object_detection/hailo/venv/lib/python3.10/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

I know that DFC on my system works with yolov10n in general, since I can parse the original yolov10n model from ultralytics after also exporting it to ONNX:

$ hailo parser onnx --hw-arch hailo8l yolov10n.onnx
[info] Current Time: 18:54:59, 07/20/24
[info] CPU: Architecture: , Model: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz, Number Of Cores: 12, Utilization: 18.0%
[info] Memory: Total: 46GB, Available: 36GB
[info] System info: OS: Linux, Kernel: 6.9.10-zen1-1-zen
[info] Hailo DFC Version: 3.28.0
[info] HailoRT Version: Not Installed
[info] PCIe: No Hailo PCIe device was found
[info] Running `hailo parser onnx --hw-arch hailo8l yolov10n.onnx`
[info] Translation started on ONNX model yolov10n
[info] Restored ONNX model yolov10n (completion time: 00:00:00.05)
[info] Extracted ONNXRuntime meta-data for Hailo model (completion time: 00:00:00.31)
[info] Simplified ONNX model for a parsing retry attempt (completion time: 00:00:01.39)
Parsing failed with recommendations for end node names: ['/model.23/Sigmoid', '/model.23/dfl/Reshape_1'].
Would you like to parse again with the recommendation? (y/n) 
y
[info] According to recommendations, retrying parsing with end node names: ['/model.23/Sigmoid', '/model.23/dfl/Reshape_1'].
[info] Translation started on ONNX model yolov10n
[info] Restored ONNX model yolov10n (completion time: 00:00:00.03)
[info] Extracted ONNXRuntime meta-data for Hailo model (completion time: 00:00:00.30)
[info] Start nodes mapped from original model: 'images': 'yolov10n/input_layer1'.
[info] End nodes mapped from original model: '/model.23/Sigmoid', '/model.23/dfl/Reshape_1'.
[info] Translation completed on ONNX model yolov10n (completion time: 00:00:01.46)
[info] Saved HAR to: /home/alex/T7/src/object_detection/hailo/yolov10n.har

It looks like something breaks after the model is fine-tuned, or maybe the number of classes is the culprit, IDK.

Thanks in advance!

Hi,
I suggest to use the hailo-model-zoo. The YOLOv10 is supported there.

1 Like

Hi @Nadav ,
I somehow missed that’s it’s part of the model zoo. I’ve been able to compile my fine-tuned model with instructions from hailo-rpi5-examples/doc/retraining-example.md at main · hailo-ai/hailo-rpi5-examples · GitHub
Thanks a lot!

1 Like