Hailo Dataflow Compiler Error in the last layers of the model, expected conv but found concat layer.

Hello, I’ve recently been trying to convert an onnx model into hef hailo 8, following these tutorials: Deploying a custom YOLOv8 model on Raspberry Pi 5 with Hailo AI Hat+ | GitHub - BetaUtopia/Hailo8l: How to Setup Raspberry Pi 5 with Hailo8l AI Kit using yolov8n on Windows (WSL2 Ubuntu) · GitHub | Raspberry Pi AI Defect Detection Kit : Converting ONNX to HEF Model . However, I’ve come across the error: hailo_sdk_client.sdk_backend.sdk_backend_exceptions.AllocatorScriptParserException: Error in the last layers of the model, expected conv but found concat layer.


Does anyone know if its an issue with how the model was made, or if theres anything that we can do with the DFC to overcome this error. I put the link to the model and full error at the bottom. I tried with on google colab and wsl but still got stuck on the same error. Im using Model Zoo 2.18 and hailo DFC 3.31

Model: https://drive.google.com/file/d/1YsxmBTIxmpFAfHz27-OcE90UyGRIEk58/view?usp=sharing

[info] No GPU chosen, Selected GPU 0
Start run for network yolov8m …
Initializing the hailo8 runner…
[info] Translation started on ONNX model yolov8m
[info] Restored ONNX model yolov8m (completion time: 00:00:00.53)
[info] Extracted ONNXRuntime meta-data for Hailo model (completion time: 00:00:01.96)
[info] Simplified ONNX model for a parsing retry attempt (completion time: 00:00:03.74)
[info] According to recommendations, retrying parsing with end node names: [‘/model.22/Concat’, ‘/model.22/Sigmoid’].
[info] Translation started on ONNX model yolov8m
[info] Restored ONNX model yolov8m (completion time: 00:00:00.39)
[info] Extracted ONNXRuntime meta-data for Hailo model (completion time: 00:00:01.90)
[info] Start nodes mapped from original model: ‘images’: ‘yolov8m/input_layer1’.
[info] End nodes mapped from original model: ‘/model.22/Concat’, ‘/model.22/Sigmoid’.
[info] Translation completed on ONNX model yolov8m (completion time: 00:00:02.96)
[info] Saved HAR to: /root/yolov8m.har
Preparing calibration data…
[info] Loading model script commands to yolov8m from /usr/local/lib/python3.10/dist-packages/hailo_model_zoo/cfg/alls/generic/yolov8m.alls
[info] Loading model script commands to yolov8m from string
Traceback (most recent call last):
File “/usr/local/bin/hailomz”, line 8, in
sys.exit(main())
File “/usr/local/lib/python3.10/dist-packages/hailo_model_zoo/main.py”, line 122, in main
run(args)
File “/usr/local/lib/python3.10/dist-packages/hailo_model_zoo/main.py”, line 111, in run
return handlers[args.command](args)
File “/usr/local/lib/python3.10/dist-packages/hailo_model_zoo/main_driver.py”, line 255, in compile
_ensure_optimized(runner, logger, args, network_info)
File “/usr/local/lib/python3.10/dist-packages/hailo_model_zoo/main_driver.py”, line 91, in _ensure_optimized
optimize_model(
File “/usr/local/lib/python3.10/dist-packages/hailo_model_zoo/core/main_utils.py”, line 351, in optimize_model
optimize_full_precision_model(runner, calib_feed_callback, logger, model_script, resize, input_conversion, classes)
File “/usr/local/lib/python3.10/dist-packages/hailo_model_zoo/core/main_utils.py”, line 337, in optimize_full_precision_model
runner.optimize_full_precision(calib_data=calib_feed_callback)
File “/usr/local/lib/python3.10/dist-packages/hailo_sdk_common/states/states.py”, line 16, in wrapped_func
return func(self, *args, **kwargs)
File “/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/runner/client_runner.py”, line 2095, in optimize_full_precision
self._optimize_full_precision(data_continer)
File “/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/runner/client_runner.py”, line 2098, in _optimize_full_precision
self._sdk_backend.optimize_full_precision(data_continer)
File “/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/sdk_backend/sdk_backend.py”, line 1664, in optimize_full_precision
model, params = self._apply_model_modification_commands(model, params, update_model_and_params)
File “/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/sdk_backend/sdk_backend.py”, line 1552, in _apply_model_modification_commands
model, params = command.apply(model, params, hw_consts=self.hw_arch.consts)
File “/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/sdk_backend/script_parser/nms_postprocess_command.py”, line 402, in apply
self._update_config_file(hailo_nn)
File “/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/sdk_backend/script_parser/nms_postprocess_command.py”, line 564, in _update_config_file
self._update_config_layers(hailo_nn)
File “/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/sdk_backend/script_parser/nms_postprocess_command.py”, line 614, in _update_config_layers
self._set_yolo_config_layers(hailo_nn)
File “/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/sdk_backend/script_parser/nms_postprocess_command.py”, line 642, in _set_yolo_config_layers
conv_layers = self._get_output_preds(hailo_nn)
File “/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/sdk_backend/script_parser/nms_postprocess_command.py”, line 624, in _get_output_preds
raise AllocatorScriptParserException(
hailo_sdk_client.sdk_backend.sdk_backend_exceptions.AllocatorScriptParserException: Error in the last layers of the model, expected conv but found concat layer.

Hi @user1132,

This is a known issue that happens when the DFC’s auto-parser picks the wrong end nodes for your model. Looking at your log, the parser fell back to /model.22/Concat and /model.22/Sigmoid as end nodes, but the NMS postprocess expects the model to end at 6 specific conv layers (before the YOLO decode head). When it finds a concat layer there instead, it throws that error.

You might try re-running the compile command with the end node names specified explicitly:

hailomz compile \
    --ckpt your_model.onnx \
    --hw-arch hailo8 \
    --calib-path /path/to/calibration/images \
    --yaml yolov8m.yaml \
    --classes <your_num_classes> \
    --end-node-names \
        /model.22/cv2.0/cv2.0.2/Conv \
        /model.22/cv3.0/cv3.0.2/Conv \
        /model.22/cv2.1/cv2.1.2/Conv \
        /model.22/cv3.1/cv3.1.2/Conv \
        /model.22/cv2.2/cv2.2.2/Conv \
        /model.22/cv3.2/cv3.2.2/Conv

However, since the auto-parser didn’t detect the standard YOLOv8 NMS structure (it usually prints “NMS structure of yolov8 was detected” - yours didn’t), it’s possible your ONNX model has non-standard layer names. To verify, you could open your .onnx file in https://netron.app and check whether those 6 conv layer names actually exist in your model graph. If the layer names are different, you’ll need to find the equivalent conv layers right before the detection head’s concat/decode operations and use those instead.

Also worth checking - how did you export from .pt to .onnx? The standard Ultralytics export (yolo export model=best.pt format=onnx opset=11 imgsz=640) should produce a graph structure the parser recognizes. If the model was exported through Roboflow or a different tool, the graph structure might differ.

For a related thread where other users solved this same error, see Running hailomz optimize reports layer yolov8n/conv41 doesn't have one output layer and Error while compile ONXX TO HEF

Thanks,
Michael.