Try to complie YOLOv11 with DFC 3.30 got ValueError: failed to initialize intent(inout) array -- expected elsize=8 but got 4

Hello everyone. I try to compile YOLOv11 with DFC 3.30, downloaded from pretrained in the GitHub repo hailo_model_zoo/docs/public_models/HAILO8L/HAILO8L_object_detection.rst at master · hailo-ai/hailo_model_zoo · GitHub, and prepare the calibration path with ImageNet Val 2017. It is not working and struck at ValueError: failed to initialize intent(inout) array–expected elsize=8 but got 4

I used the latest version of SciPy, 1.15.1, and downgraded to 1.10.1 and 1.9.3, which didn’t work. Please assist me in identifying a viable solution for this issue. By the way, I compile YOLOv8, and YOLOv10 works well (both pretrained and my custom data training. Thank you.

My previous topic is quiet. DFC 3.30 ZOO 2.14.0 error on matmul equalization got ValueError: failed to initialize intent(inout) array -- expected elsize=8 but got 4

It is my logging from terminal on Ubuntu system.

hailomz compile yolov11s --ckpt=./yolo11s.onnx --hw-arch hailo8l --calib-path ./val2017 --classes 80 --performance
Start run for network yolov11s …
Initializing the hailo8l runner…
[info] Translation started on ONNX model yolov11s
[info] Restored ONNX model yolov11s (completion time: 00:00:00.16)
[info] Extracted ONNXRuntime meta-data for Hailo model (completion time: 00:00:00.60)
[info] NMS structure of yolov8 (or equivalent architecture) was detected.
[info] In order to use HailoRT post-processing capabilities, these end node names should be used: /model.23/cv3.0/cv3.0.2/Conv /model.23/cv2.0/cv2.0.2/Conv /model.23/cv3.1/cv3.1.2/Conv /model.23/cv2.1/cv2.1.2/Conv /model.23/cv2.2/cv2.2.2/Conv /model.23/cv3.2/cv3.2.2/Conv.
[info] Start nodes mapped from original model: ‘images’: ‘yolov11s/input_layer1’.
[info] End nodes mapped from original model: ‘/model.23/cv2.0/cv2.0.2/Conv’, ‘/model.23/cv3.0/cv3.0.2/Conv’, ‘/model.23/cv2.1/cv2.1.2/Conv’, ‘/model.23/cv3.1/cv3.1.2/Conv’, ‘/model.23/cv2.2/cv2.2.2/Conv’, ‘/model.23/cv3.2/cv3.2.2/Conv’.
[info] Translation completed on ONNX model yolov11s (completion time: 00:00:01.21)
[info] Appending model script commands to yolov11s from string
[info] Added nms postprocess command to model script.
[info] Saved HAR to: /home/nachodeng48/Hailo_custom/yolov11s.har
Using generic alls script found in /home/nachodeng48/Hailo_custom/hailo_model_zoo/hailo_model_zoo/cfg/alls/generic/yolov11s.alls because there is no specific hardware alls
Preparing calibration data…
[info] Loading model script commands to yolov11s from /home/nachodeng48/Hailo_custom/hailo_model_zoo/hailo_model_zoo/cfg/alls/generic/yolov11s.alls
[info] Loading model script commands to yolov11s from string
[info] Starting Model Optimization
[warning] Reducing optimization level to 0 (the accuracy won’t be optimized and compression won’t be used) because there’s no available GPU
[warning] Running model optimization with zero level of optimization is not recommended for production use and might lead to suboptimal accuracy results
[info] Model received quantization params from the hn
[info] MatmulDecompose skipped
[info] Starting Mixed Precision
[info] Model Optimization Algorithm Mixed Precision is done (completion time is 00:00:00.55)
[info] LayerNorm Decomposition skipped
[info] Starting Statistics Collector
[info] Using dataset with 64 entries for calibration
Calibration: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 64/64 [00:40<00:00, 1.59entries/s]
[info] Model Optimization Algorithm Statistics Collector is done (completion time is 00:00:41.95)
[info] Starting Fix zp_comp Encoding
[info] Model Optimization Algorithm Fix zp_comp Encoding is done (completion time is 00:00:00.00)
[info] Starting Matmul Equalization
Traceback (most recent call last):
File “/home/nachodeng48/.local/bin/hailomz”, line 33, in
sys.exit(load_entry_point(‘hailo-model-zoo’, ‘console_scripts’, ‘hailomz’)())
File “/home/nachodeng48/Hailo_custom/hailo_model_zoo/hailo_model_zoo/main.py”, line 122, in main
run(args)
File “/home/nachodeng48/Hailo_custom/hailo_model_zoo/hailo_model_zoo/main.py”, line 111, in run
return handlersargs.command
File “/home/nachodeng48/Hailo_custom/hailo_model_zoo/hailo_model_zoo/main_driver.py”, line 250, in compile
runner = _ensure_optimized(runner, logger, args, network_info)
File “/home/nachodeng48/Hailo_custom/hailo_model_zoo/hailo_model_zoo/main_driver.py”, line 91, in _ensure_optimized
optimize_model(
File “/home/nachodeng48/Hailo_custom/hailo_model_zoo/hailo_model_zoo/core/main_utils.py”, line 353, in optimize_model
runner.optimize(calib_feed_callback)
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_sdk_common/states/states.py”, line 16, in wrapped_func
return func(self, *args, **kwargs)
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_sdk_client/runner/client_runner.py”, line 2128, in optimize
self._optimize(calib_data, data_type=data_type, work_dir=work_dir)
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_sdk_common/states/states.py”, line 16, in wrapped_func
return func(self, *args, **kwargs)
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_sdk_client/runner/client_runner.py”, line 1970, in _optimize
self._sdk_backend.full_quantization(calib_data, data_type=data_type, work_dir=work_dir)
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/sdk_backend.py”, line 1125, in full_quantization
self._full_acceleras_run(self.calibration_data, data_type)
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/sdk_backend.py”, line 1319, in _full_acceleras_run
optimization_flow.run()
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_model_optimization/tools/orchestator.py”, line 306, in wrapper
return func(self, *args, **kwargs)
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_model_optimization/flows/optimization_flow.py”, line 335, in run
step_func()
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_model_optimization/tools/orchestator.py”, line 250, in wrapped
result = method(*args, **kwargs)
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_model_optimization/tools/subprocess_wrapper.py”, line 124, in parent_wrapper
func(self, *args, **kwargs)
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_model_optimization/flows/optimization_flow.py”, line 354, in step1
self.core_quantization()
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_model_optimization/tools/orchestator.py”, line 250, in wrapped
result = method(*args, **kwargs)
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_model_optimization/flows/optimization_flow.py”, line 414, in core_quantization
self._matmul_equalization()
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_model_optimization/tools/orchestator.py”, line 250, in wrapped
result = method(*args, **kwargs)
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_model_optimization/flows/optimization_flow.py”, line 599, in _matmul_equalization
algo.run()
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_model_optimization/algorithms/optimization_algorithm.py”, line 54, in run
return super().run()
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_model_optimization/algorithms/algorithm_base.py”, line 150, in run
self._run_int()
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_model_optimization/algorithms/matmul_equalization/matmul_equalization.py”, line 123, in _run_int
self.equalize_input_paths(normal_subflow, transpose_subflow, layer)
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_model_optimization/algorithms/matmul_equalization/matmul_equalization.py”, line 162, in equalize_input_paths
set_scales_forward(self._model, normal_flow, layer.groups, factors)
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_model_optimization/algorithms/matmul_equalization/matmul_equalization.py”, line 340, in set_scales_forward
scales, zp_points = get_scales_output(in_layer, groups, factors, transpose)
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_model_optimization/algorithms/matmul_equalization/matmul_equalization.py”, line 367, in get_scales_output
scales, zp = find_the_best_zp(
File “/home/nachodeng48/.local/lib/python3.10/site-packages/hailo_model_optimization/algorithms/matmul_equalization/optimal_zp_finder.py”, line 237, in find_the_best_zp
result = minimize(objective, x0, method=“SLSQP”, constraints=cons)
File “/home/nachodeng48/.local/lib/python3.10/site-packages/scipy/optimize/_minimize.py”, line 722, in minimize
res = _minimize_slsqp(fun, x0, args, jac, bounds,
File “/home/nachodeng48/.local/lib/python3.10/site-packages/scipy/optimize/_slsqp_py.py”, line 431, in _minimize_slsqp
slsqp(m, meq, x, xl, xu, fx, c, g, a, acc, majiter, mode, w, jw,
ValueError: failed to initialize intent(inout) array – expected elsize=8 but got 4

I was facing the same issue during compiling my optimized-model.har file to .hef file
To solve this issue, please downgrade the scipy version to 1.9.3
pip install scipy==1.9.3
This solved the issue for me, and I was able to compile my model and generate hef file of it.

1 Like

Hi @hellofloppy,

For DFC 3.30, the following versions have been confirmed to work:

  • SciPy: 1.8.1
  • NumPy: 1.21.6
1 Like

@omban @omria

Thanks for all the advice everyone, now I can do it perfectly using SciPy==1.8.1 and NumPy==1.23.3 Thank you from the bottom of my heart. Now I can use a her file to work perfectly on my Raspberry Pi 5 from the YOLOv11 model complied by DFC 3.30.

1 Like

@hellofloppy That’s wonderful to hear! Looking forward to seeing the incredible projects you create with the AI Kit. Have fun exploring!

@hellofloppy Can you share how did you compile Yolov11 Onnx to HEF using DFC. When I downgraded the numpy and scipy, It doesn’t meet the requirements of Numba.

image