conversion from yolov11n_seg onnx model to `hef`

I am trying to create a conversion from yolov11n_seg onnx model to hef.
The onnx model is exported through the ultralytics yolo cli natively. and along with that. I got the data.yaml file containing nc and name of classes.

I am not certain on how shall I define the yaml file, If a new alls files is required etc.
I have gone through several tries and did’nt manage to do so.
will be glad to provide more info if I’m missing something :slight_smile:
Thanks!

Hey @Itai_Mizlish,

Here’s a quick step-by-step I put together for compiling model with DFC. It’s a pretty generic flow, but it should get you up and running.


:wrench: What you’ll need:

  • Your yolov11n_seg.onnx model file
  • A data.yaml (from Ultralytics — tweak as needed)
  • A folder of calibration images (JPEG/PNG)
  • A custom YAML file to define the model config (more below)

1. Custom YAML Setup

Here’s a basic template you can start from:

base:
  network_name: yolov11n_seg_custom
  input_shape: [1, 3, 320, 320]
  classes: 2
  preprocessing:
    normalization: [0.0, 1.0]
    input_shape: [1, 3, 320, 320]
  postprocessing:
    nms: true
    instance_segmentation: true
    masks: true
    num_classes: 2
    confidence_threshold: 0.25
    iou_threshold: 0.45

Things to check:

  • Match input_shape to your ONNX model input
  • Update classes based on your data.yaml
  • Make sure postprocessing reflects what your model outputs — segmentation, masks, etc. (nms should probably be enabled too)

2. Parse the ONNX model

hailo parser onnx yolov11n_seg.onnx --output yolov11n_seg.har

If parsing fails or you need only part of the graph, try using --start-node-names and --end-node-names.


3. Optimize the model

Use your calibration image folder here:

hailo optimize yolov11n_seg.har --calib-path ./calib_images --output yolov11n_seg_optimized.har

If you’ve got a model script with preprocessing/resizing, include it with:

--model-script yolov11n_seg.alls

4. Compile to HEF

hailo compiler yolov11n_seg_optimized.har --output yolov11n_seg.hef --hw-arch hailo15h

Don’t forget to set the right hardware architecture (hailo15h, hailo8, etc.).


:gear: A Few Extra Notes:

  • YAML vs ALLS: YAML is fine for simpler use cases and common models. If you need custom pre/post-processing, go with an alls script instead. You can’t use both at once.
  • Validation: After each stage (parse, optimize, compile), it’s a good idea to run hailo profiler or test with the SDK to make sure everything still works and accuracy looks good.

Let me know if anything’s unclear or if you hit any roadblocks!