optimize the har file while nms post process is failing

(hailodfc) mk@DESKTOP-ASCOF9E:/mnt/c/Users/ASUS/dataset$ hailo optimize yolov8_fixed.har --calib-set-path /mnt/c/Users/ASUS/dataset/calib_npy --output-har-path yolov8_optimized.har
[info] No GPU chosen and no suitable GPU found, falling back to CPU.
[info] Current Time: 11:12:32, 10/23/25
[info] CPU: Architecture: x86_64, Model: 13th Gen Intel(R) Core™ i5-1340P, Number Of Cores: 4, Utilization: 0.3%
[info] Memory: Total: 11GB, Available: 10GB
[info] System info: OS: Linux, Kernel: 5.15.167.4-microsoft-standard-WSL2
[info] Hailo DFC Version: 3.33.0
[info] HailoRT Version: 4.23.0
[info] PCIe: No Hailo PCIe device was found
[info] Running hailo optimize yolov8_fixed.har --calib-set-path /mnt/c/Users/ASUS/dataset/calib_npy --output-har-path yolov8_optimized.har
[info] For NMS architecture yolov8 the default engine is cpu. For other engine please use the ‘engine’ flag in the nms_postprocess model script command. If the NMS has been added during parsing, please parse the model again without confirming the addition of the NMS, and add the command manually with the desired engine.
[info] The layer best/conv41 was detected as reg_layer.
Traceback (most recent call last):
File “/mnt/c/Users/ASUS/hailodfc/bin/hailo”, line 7, in
sys.exit(main())
File “/mnt/c/Users/ASUS/hailodfc/lib/python3.10/site-packages/hailo_sdk_client/tools/cmd_utils/main.py”, line 111, in main
ret_val = client_command_runner.run()
File “/mnt/c/Users/ASUS/hailodfc/lib/python3.10/site-packages/hailo_sdk_client/tools/cmd_utils/base_utils.py”, line 68, in run
return self._run(argv)
File “/mnt/c/Users/ASUS/hailodfc/lib/python3.10/site-packages/hailo_sdk_client/tools/cmd_utils/base_utils.py”, line 89, in _run
return args.func(args)
File “/mnt/c/Users/ASUS/hailodfc/lib/python3.10/site-packages/hailo_sdk_client/tools/optimize_cli.py”, line 113, in run
self._runner.optimize_full_precision(calib_data=dataset)
File “/mnt/c/Users/ASUS/hailodfc/lib/python3.10/site-packages/hailo_sdk_common/states/states.py”, line 16, in wrapped_func
return func(self, *args, **kwargs)
File “/mnt/c/Users/ASUS/hailodfc/lib/python3.10/site-packages/hailo_sdk_client/runner/client_runner.py”, line 2095, in optimize_full_precision
self._optimize_full_precision(data_continer)
File “/mnt/c/Users/ASUS/hailodfc/lib/python3.10/site-packages/hailo_sdk_client/runner/client_runner.py”, line 2098, in _optimize_full_precision
self._sdk_backend.optimize_full_precision(data_continer)
File “/mnt/c/Users/ASUS/hailodfc/lib/python3.10/site-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 “/mnt/c/Users/ASUS/hailodfc/lib/python3.10/site-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 “/mnt/c/Users/ASUS/hailodfc/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/script_parser/nms_postprocess_command.py”, line 402, in apply
self._update_config_file(hailo_nn)
File “/mnt/c/Users/ASUS/hailodfc/lib/python3.10/site-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 “/mnt/c/Users/ASUS/hailodfc/lib/python3.10/site-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 “/mnt/c/Users/ASUS/hailodfc/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/script_parser/nms_postprocess_command.py”, line 670, in _set_yolo_config_layers
self._set_anchorless_yolo_config_layer(branch_layers, decoder, f_out)
File “/mnt/c/Users/ASUS/hailodfc/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/script_parser/nms_postprocess_command.py”, line 716, in _set_anchorless_yolo_config_layer
raise AllocatorScriptParserException(msg)
hailo_sdk_client.sdk_backend.sdk_backend_exceptions.AllocatorScriptParserException: Cannot infer bbox conv layers automatically. Please specify the bbox layer in the json configuration file.

Hey @dragon_gu,

The error you’re seeing means the Hailo compiler can’t figure out which layers in your YOLOv8 model handle the bounding box outputs. This happens a lot with custom YOLO models where the layer names or structure don’t match what the compiler expects.

The fix is pretty straightforward - you just need to tell the compiler exactly which layers to use by creating a configuration file.

Here’s what you need to do:

First, open your ONNX model in Netron (or any model viewer) and find the output layers that handle bounding boxes and class predictions. Write down their exact names.

Next, create a JSON config file with those layer names. Here’s a template you can adapt:

{
  "nms_scores_th": 0.3,
  "nms_iou_th": 0.7,
  "image_dims": [640, 640],
  "max_proposals_per_class": 100,
  "classes": 80,
  "regression_length": 4,
  "background_removal": false,
  "bbox_decoders": [
    {
      "name": "bbox_decoder_P3",
      "stride": 8,
      "reg_layer": "best/conv41",
      "cls_layer": "best/conv42"
    }
  ]
}

The important parts are reg_layer and cls_layer - replace those with the actual layer names from your model. If your model has multiple output heads, add more decoder entries.

Then update your .alls file to reference this config:

nms_postprocess("/path/to/your_nms_config.json", meta_arch=yolov8, engine=cpu)

Hope this helps!

(hailodfc) mk@DESKTOP-ASCOF9E:/mnt/c/Users/ASUS/dataset$ hailo compiler best_optimized.har --hw-arch hailo8l --output-dir ./compiled --auto-model-script ./auto_script.py
[info] No GPU chosen and no suitable GPU found, falling back to CPU.
[info] Current Time: 11:16:42, 10/25/25
[info] CPU: Architecture: x86_64, Model: 13th Gen Intel(R) Core™ i5-1340P, Number Of Cores: 4, Utilization: 0.2%
[info] Memory: Total: 11GB, Available: 10GB
[info] System info: OS: Linux, Kernel: 5.15.167.4-microsoft-standard-WSL2
[info] Hailo DFC Version: 3.33.0
[info] HailoRT Version: 4.23.0
[info] PCIe: No Hailo PCIe device was found
[info] Running hailo compiler best_optimized.har --hw-arch hailo8l --output-dir ./compiled --auto-model-script ./auto_script.py
[info] Compiling network
[info] To achieve optimal performance, set the compiler_optimization_level to “max” by adding performance_param(compiler_optimization_level=max) to the model script. Note that this may increase compilation time.
[info] Loading network parameters
[info] Starting Hailo allocation and compilation flow
[info] Building optimization options for network layers…
[info] Successfully built optimization options - 4s 229ms
[info] Trying to compile the network in a single context
[info] Single context flow failed: Recoverable single context error
[info] Building optimization options for network layers…
[info] Successfully built optimization options - 5s 91ms
[error] Mapping Failed (allocation time: 5s)
No successful assignments: concat17 errors:
Agent infeasible

[error] Failed to produce compiled graph
[error] BackendAllocatorException: Compilation failed: No successful assignments: concat17 errors:
Agent infeasible