Hello,
I’m having trouble progressing with compiling the HEF file, so I’m here to ask for help.
I have successfully converted the model to ONNX, but I’m encountering an error at the following line of code:
code_line
runner.optimize(calibration_data)
How can I resolve this issue?
I’ll also share the code for the conversion process and the model.
Convert_HEF
import numpy as np
from hailo_sdk_client import ClientRunner
model_name = ‘RTNH_Dense’
onnx_path = ‘RTNH_Dense.onnx’
start_node = [‘dense_input’]
end_node = [‘box_preds’, ‘cls_preds’]
chosen_hw_arch = ‘hailo8’
model_script = ‘’’
model_optimization_flavor(optimization_level=0, compression_level=1)
resources_param(max_control_utilization=0.6, max_compute_utilization=0.6, max_memory_utilization=0.6)
performance_param(fps=20)
‘’’
runner = ClientRunner(hw_arch=chosen_hw_arch)
hn = runner.translate_onnx_model(
model=onnx_path,
start_node_names=start_node,
end_node_names=end_node
)
parsed_model_har_path = f’{model_name}_parsed_model.har’
runner.save_har(parsed_model_har_path)
runner.load_model_script(model_script)
calibration_data = np.random.randn(8, 80, 180, 96).astype(np.float32)
runner.optimize(calibration_data)
quantized_model_har_path = f’{model_name}_quantized_model.har’
runner.save_har(quantized_model_har_path)
hef = runner.compile()
hef_file_name = f’{model_name}.hef’
with open(hef_file_name, ‘wb’) as f:
f.write(hef)
compiled_model_har_path = f’{model_name}_compiled_model.har’
runner.save_har(compiled_model_har_path)
The image above shows the terminal window when the error occurs.
Also, I’m curious if there’s a parameter that allows for early termination of the iterations, as seen in the image above.
Thank you!