How to train, parse, optimize, and compile yolov5s_wo_spp or yolov5m_wo_spp on my own dataset??

Thank you for reading. I’m looking forward to your prompt response, this is really bothering me
I noticed that in “hailo_model_zoo”, it was mentioned that “yolov5m_wo_spp” would achieve the best performance on hailo8.
Therefore, I attempted to train the “yolov5m_wo_spp” model, but I’m still unclear: what is “yolov5m_wo_spp”? Is it simply the “yolov5m” model with the SPP layer removed? Could you explain in detail how to train this model?

Additionally, during parser and optimize operations, I noticed that hailo_model_zoo contains many “network”, “alls”, and “postprocess_config” files. How should I use these files?

I aim to deploy either yolov5s or yolov5m on my Raspberry Pi + Hailo8 setup (and prefer the more efficient wo_spp version if it performs better). I also plan to use my own dataset.

These issues are causing me significant confusion. Below is my workflow:

I used Dataflow for operations (due to unknown reasons preventing normal use of Hailomz).

  1. Trained yolov5s on my dataset (attempting to remove the SPP layer)
    Used the following YAML file:
    yolov5s_wo_spp.yaml

Ultralytics :rocket: AGPL-3.0 License - Ultralytics License

Parameters

nc: 4 # number of classes
depth_multiple: 0.33 # model depth multiple
width_multiple: 0.50 # layer channel multiple
anchors:

  • [10, 13, 16, 30, 33, 23] # P3/8
  • [30, 61, 62, 45, 59, 119] # P4/16
  • [116, 90, 156, 198, 373, 326] # P5/32

YOLOv5 v6.0 backbone

backbone:

[from, number, module, args]

[
[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
[-1, 3, C3, [128]],
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
[-1, 6, C3, [256]],
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
[-1, 9, C3, [512]],
[-1, 1, Conv, [1024, 3, 2]], # 7-P5/32
[-1, 3, C3, [1024]],
[-1, 1, Conv, [1024, 1, 1]], # 9
]

YOLOv5 v6.0 head

head: [
[-1, 1, Conv, [512, 1, 1]],
[-1, 1, nn.Upsample, [None, 2, “nearest”]],
[[-1, 6], 1, Concat, [1]], # cat backbone P4
[-1, 3, C3, [512, False]], # 13

[-1, 1, Conv, [256, 1, 1]],
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
[[-1, 4], 1, Concat, [1]], # cat backbone P3
[-1, 3, C3, [256, False]], # 17 (P3/8-small)

[-1, 1, Conv, [256, 3, 2]],
[[-1, 14], 1, Concat, [1]], # cat head P4
[-1, 3, C3, [512, False]], # 20 (P4/16-medium)

[-1, 1, Conv, [512, 3, 2]],
[[-1, 10], 1, Concat, [1]], # cat head P5
[-1, 3, C3, [1024, False]], # 23 (P5/32-large)

[[17, 20, 23], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5)

]

  1. Converted .pt model to ONNX with:
    python export.py --weights runs/train/exp/weights/best.pt --img 640 --batch 1 --include onnx
    3.Parsed ONNX model:
    hailo parser onnx ../best.onnx --har-path best.har --hw-arch hailo8
    Informations:
    (hailo) (base) root@autodl-container-30fd499380-3c54d130:~/autodl-fs/yolo_hailo# hailo parser onnx ../best.onnx --har-path best.har --hw-arch hailo8
    [info] Current Time: 00:12:32, 06/19/25
    [info] CPU: Architecture: x86_64, Model: Intel(R) Xeon(R) Platinum 8352V CPU @ 2.10GHz, Number Of Cores: 128, Utilization: 2.7%
    [info] Memory: Total: 251GB, Available: 204GB
    [info] System info: OS: Linux, Kernel: 5.15.0-87-generic
    [info] Hailo DFC Version: 3.31.0
    [info] HailoRT Version: Not Installed
    [info] PCIe: No Hailo PCIe device was found
    [info] Running hailo parser onnx ../best.onnx --har-path best.har --hw-arch hailo8
    [info] Translation started on ONNX model best
    [info] Restored ONNX model best (completion time: 00:00:00.18)
    [info] Extracted ONNXRuntime meta-data for Hailo model (completion time: 00:00:00.46)
    2025-06-19 00:12:34.667568556 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4457, index: 0, mask: {1, 65, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:34.667576775 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4458, index: 1, mask: {2, 66, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:34.667672293 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4459, index: 2, mask: {3, 67, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:34.667838166 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4460, index: 3, mask: {4, 68, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:34.668038761 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4464, index: 7, mask: {8, 72, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:34.667970039 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4461, index: 4, mask: {5, 69, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.


    2025-06-19 00:12:34.669494553 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4484, index: 27, mask: {28, 92, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:34.677818750 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4487, index: 30, mask: {31, 95, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:34.697911895 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4486, index: 29, mask: {30, 94, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:34.749815441 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4485, index: 28, mask: {29, 93, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    [info] Simplified ONNX model for a parsing retry attempt (completion time: 00:00:02.04)
    2025-06-19 00:12:36.319031047 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4529, index: 0, mask: {1, 65, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319127292 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4531, index: 2, mask: {3, 67, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319128570 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4530, index: 1, mask: {2, 66, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319181704 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4535, index: 6, mask: {7, 71, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319247253 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4533, index: 4, mask: {5, 69, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319275013 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4539, index: 10, mask: {11, 75, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319309712 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4540, index: 11, mask: {12, 76, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319334177 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4536, index: 7, mask: {8, 72, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319358460 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4542, index: 13, mask: {14, 78, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319322152 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4541, index: 12, mask: {13, 77, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319336511 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4537, index: 8, mask: {9, 73, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319337777 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4538, index: 9, mask: {10, 74, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319486433 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4547, index: 18, mask: {19, 83, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319512538 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4548, index: 19, mask: {20, 84, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319529178 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4543, index: 14, mask: {15, 79, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319252467 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4534, index: 5, mask: {6, 70, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319601512 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4551, index: 22, mask: {23, 87, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319620351 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4552, index: 23, mask: {24, 88, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319533808 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4549, index: 20, mask: {21, 85, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319248677 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4532, index: 3, mask: {4, 68, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319727140 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4556, index: 27, mask: {28, 92, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319755419 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4558, index: 29, mask: {30, 94, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319622621 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4553, index: 24, mask: {25, 89, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319528398 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4544, index: 15, mask: {16, 80, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319675601 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4554, index: 25, mask: {26, 90, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319706050 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4555, index: 26, mask: {27, 91, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319575493 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4550, index: 21, mask: {22, 86, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319525077 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4545, index: 16, mask: {17, 81, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319775043 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4559, index: 30, mask: {31, 95, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319625547 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4546, index: 17, mask: {18, 82, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:12:36.319762344 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4557, index: 28, mask: {29, 93, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    Parsing failed with recommendations for end node names: [‘/model.24/Sigmoid_1’, ‘/model.24/Sigmoid’, ‘/model.24/Sigmoid_2’].
    Would you like to parse again with the recommendation? (y/n)
    y
    [info] According to recommendations, retrying parsing with end node names: [‘/model.24/Sigmoid_1’, ‘/model.24/Sigmoid’, ‘/model.24/Sigmoid_2’].
    [info] Translation started on ONNX model best
    [info] Restored ONNX model best (completion time: 00:00:00.15)
    [info] Extracted ONNXRuntime meta-data for Hailo model (completion time: 00:00:00.46)
    2025-06-19 00:14:09.758105991 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4616, index: 0, mask: {1, 65, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758145740 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4617, index: 1, mask: {2, 66, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758173319 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4618, index: 2, mask: {3, 67, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758218253 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4619, index: 3, mask: {4, 68, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758292161 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4621, index: 5, mask: {6, 70, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758293052 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4620, index: 4, mask: {5, 69, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758365166 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4625, index: 9, mask: {10, 74, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758375870 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4622, index: 6, mask: {7, 71, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758464759 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4624, index: 8, mask: {9, 73, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758538337 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4627, index: 11, mask: {12, 76, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758540227 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4626, index: 10, mask: {11, 75, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758635086 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4629, index: 13, mask: {14, 78, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758633835 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4630, index: 14, mask: {15, 79, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758376026 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4623, index: 7, mask: {8, 72, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758713784 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4635, index: 19, mask: {20, 84, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758813833 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4634, index: 18, mask: {19, 83, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758836952 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4639, index: 23, mask: {24, 88, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758540788 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4628, index: 12, mask: {13, 77, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758914491 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4637, index: 21, mask: {22, 86, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758724220 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4633, index: 17, mask: {18, 82, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.759009249 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4641, index: 25, mask: {26, 90, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758721459 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4632, index: 16, mask: {17, 81, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.759073168 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4646, index: 30, mask: {31, 95, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758916740 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4638, index: 22, mask: {23, 87, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.759018290 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4644, index: 28, mask: {29, 93, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.759110752 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4642, index: 26, mask: {27, 91, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.759011125 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4640, index: 24, mask: {25, 89, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758917041 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4636, index: 20, mask: {21, 85, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.758722279 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4631, index: 15, mask: {16, 80, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.759109262 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4643, index: 27, mask: {28, 92, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    2025-06-19 00:14:09.759215091 [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 4645, index: 29, mask: {30, 94, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
    [info] NMS structure of yolov5 (or equivalent architecture) was detected.
    [info] Start nodes mapped from original model: ‘images’: ‘best/input_layer1’.
    [info] End nodes mapped from original model: ‘/model.24/Sigmoid_1’, ‘/model.24/Sigmoid’, ‘/model.24/Sigmoid_2’.
    [info] Translation completed on ONNX model best (completion time: 00:00:01.94)
    Would you like to parse the model again with the mentioned end nodes and add nms postprocess command to the model script? (y/n)
    4.Extracted scripts from best.har:
    hailo har extract best.har --model-script-path best.alls
    hailo har extract best.har --nms-config-path best.nms.json
    Modified best.alls as follows (inspired by yolov5s_wo_spp configs in hailo_model_zoo):
  • normalization1 = normalization([0.0, 0.0, 0.0], [255.0, 255.0, 255.0])
  • change_output_activation(sigmoid)
  • nms_postprocess(meta_arch=yolov5) ##This is what was originally in best.alls
  • post_quantization_optimization(finetune, policy=enabled, learning_rate=0.0002, epochs=8, dataset_size=2048)
  • model_optimization_config(calibration, batch_size=16)
    5.Optimized using modified script:
    hailo optimize best.har --use-random-calib-set --output-har-path best_optimized.har --model-script best.alls
    Informations:
    [info] Using dataset with 64 entries for calibration
    Calibration: 0%| | 0/64 [00:00<?, ?entries/s]Calibration: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 64/64 [00:33<00:00, 1.91entries/s]
    [info] Model Optimization Algorithm Statistics Collector is done (completion time is 00:00:35.42)
    [info] Starting Fix zp_comp Encoding
    [info] Model Optimization Algorithm Fix zp_comp Encoding is done (completion time is 00:00:00.00)
    [info] Matmul Equalization skipped
    [info] Starting MatmulDecomposeFix
    [info] Model Optimization Algorithm MatmulDecomposeFix is done (completion time is 00:00:00.00)
    [info] No shifts available for layer best/conv1/conv_op, using max shift instead. delta=3.4482
    [info] No shifts available for layer best/conv1/conv_op, using max shift instead. delta=1.7241
    [info] Finetune encoding skipped
    [info] Bias Correction skipped
    [info] Adaround skipped
    [info] Starting Quantization-Aware Fine-Tuning
    [warning] Dataset is larger than expected size. Increasing the algorithm dataset size might improve the results
    [info] Using dataset with 2048 entries for finetune
    Epoch 1/8
    128/128 [==============================] - 1174s 8s/step - total_distill_loss: 2.8667 - _distill_loss_best/feature_multiplier46: 1.0134 - _distill_loss_best/feature_multiplier53: 1.0197 - _distill_loss_best/feature_multiplier59: 0.6712 - _distill_loss_best/conv51: 0.0864 - _distill_loss_best/conv44: 0.0760B^[[A

    Epoch 7/8
    128/128 [==============================] - 1062s 8s/step - total_distill_loss: 3.1391 - _distill_loss_best/feature_multiplier46: 1.0093 - _distill_loss_best/feature_multiplier53: 1.0116 - _distill_loss_best/feature_multiplier59: 1.0121 - _distill_loss_best/conv51: 0.0515 - _distill_loss_best/conv44: 0.0547
    Epoch 8/8
    128/128 [==============================] - 1062s 8s/step - total_distill_loss: 3.1385 - _distill_loss_best/feature_multiplier46: 1.0093 - _distill_loss_best/feature_multiplier53: 1.0116 - _distill_loss_best/feature_multiplier59: 1.0116 - _distill_loss_best/conv51: 0.0514 - _distill_loss_best/conv44: 0.0546
    [info] Model Optimization Algorithm Quantization-Aware Fine-Tuning is done (completion time is 02:23:29.25)
    [info] Layer Noise Analysis skipped
    [warning] The expected calibration set should be [0, 255] when using an in-net normalization layer, but the range received is [(0.0, 1.0), (0.0, 1.0), (0.0, 1.0)].
    [info] Model Optimization is done
    [info] Saved HAR to: /autodl-fs/data/yolo_hailo/best_optimized.har
    6.Compiled despite warnings:
    hailo compiler best_optimized.har --hw-arch hailo8 --output-dir ./
    7.Ran object detection:
    ./object_detection.py -n ./model/best.hef -i camera -l ./model/labels_wo_spp.txt -b 1
    8.Output:
    Raw model output: [array(, shape=(0, 5), dtype=float64), array(, shape=(0, 5), dtype=float64), array(, shape=(0, 5), dtype=float64), array(, shape=(0, 5), dtype=float64)]
    Raw model output: [array(, shape=(0, 5), dtype=float64), array(, shape=(0, 5), dtype=float64), array(, shape=(0, 5), dtype=float64), array(, shape=(0, 5), dtype=float64)]
    Raw model output: [array(, shape=(0, 5), dtype=float64), array(, shape=(0, 5), dtype=float64), array(, shape=(0, 5), dtype=float64), array(, shape=(0, 5), dtype=float64)]
    2025-06-19 11:28:56.368 | INFO | main:infer:291 - Inference was successful!
    pi@yahboom:~/hailo_yolov5m/Hailo-Application-Code-Examples/runtime/hailo-8/python/object_detection $

Key observations from your workflow:
The critical warning during optimization:
[warning] The expected calibration set should be [0, 255]… but received [(0.0, 1.0)…]
indicates a normalization mismatch - your .alls config expects 0-255 input while your model likely outputs 0-1 normalized tensors.
Empty detection arrays (shape=(0,5)) suggest either:
Incorrect preprocessing (normalization mismatch)
Model convergence issues
Output layer misconfiguration