Hello,
I keep getting this error when trying out the tutorials from the Hailo website. I get the same error from the DFC_4_Inference_Tutorial, but here below I show that I also get it from the “Inference” part of the HailoRT tutorial. The Resnet_v1_18 model is downloaded in a compiled state from the model zoo. The data is from the hailo_tutorials notebooks.
Any help would be much appreciated.
Code from the tutorial (v4.20.0 | Hailo ).:
Resnet model downloaded here in the compiled .hef format. hailo_model_zoo/docs/public_models/HAILO8L/HAILO8L_classification.rst at master · hailo-ai/hailo_model_zoo · GitHub
import numpy as np
from multiprocessing import Process
from hailo_platform import (HEF, VDevice, HailoStreamInterface, InferVStreams, ConfigureParams,
InputVStreamParams, OutputVStreamParams, InputVStreams, OutputVStreams, FormatType)
# The target can be used as a context manager ("with" statement) to ensure it's released on time.
# Here it's avoided for the sake of simplicity
target = VDevice()
# Loading compiled HEFs to device:
model_name = 'resnet_v1_18'
hef_path = '{}.hef'.format(model_name)
hef = HEF(hef_path)
# Configure network groups
configure_params = ConfigureParams.create_from_hef(hef=hef, interface=HailoStreamInterface.PCIe)
network_groups = target.configure(hef, configure_params)
network_group = network_groups[0]
network_group_params = network_group.create_params()
# Create input and output virtual streams params
input_vstreams_params = InputVStreamParams.make(network_group, format_type=FormatType.FLOAT32)
output_vstreams_params = OutputVStreamParams.make(network_group, format_type=FormatType.UINT8)
# Define dataset params
input_vstream_info = hef.get_input_vstream_infos()[0]
output_vstream_info = hef.get_output_vstream_infos()[0]
image_height, image_width, channels = input_vstream_info.shape
num_of_images = 10
low, high = 2, 20
# Generate random dataset
dataset = np.random.randint(low, high, (num_of_images, image_height, image_width, channels)).astype(np.float32)
# Infer
with InferVStreams(network_group, input_vstreams_params, output_vstreams_params) as infer_pipeline:
input_data = {input_vstream_info.name: dataset}
with network_group.activate(network_group_params):
print(input_data['resnet_v1_18/input_layer1'].shape)
infer_results = infer_pipeline.infer(input_data)
print('Stream output shape is {}'.format(infer_results[output_vstream_info.name].shape))
Error
---------------------------------------------------------------------------
HailoRTStatusException Traceback (most recent call last)
File /usr/lib/python3/dist-packages/hailo_platform/pyhailort/pyhailort.py:957, in InferVStreams.infer(self, input_data)
956 time_before_infer = time.perf_counter()
--> 957 self._infer_pipeline.infer(input_data, output_buffers, batch_size)
958 self._hw_time = time.perf_counter() - time_before_infer
HailoRTStatusException: 2
The above exception was the direct cause of the following exception:
HailoRTInvalidArgumentException Traceback (most recent call last)
Cell In[6], line 6
4 with network_group.activate(network_group_params):
5 print(input_data['resnet_v1_18/input_layer1'].shape)
----> 6 infer_results = infer_pipeline.infer(input_data)
7 print('Stream output shape is {}'.format(infer_results[output_vstream_info.name].shape))
File /usr/lib/python3/dist-packages/hailo_platform/pyhailort/pyhailort.py:955, in InferVStreams.infer(self, input_data)
952 self._validate_input_data_format_type(input_layer_name, input_data)
953 self._make_c_contiguous_if_needed(input_layer_name, input_data)
--> 955 with ExceptionWrapper():
956 time_before_infer = time.perf_counter()
957 self._infer_pipeline.infer(input_data, output_buffers, batch_size)
...
154 def _raise_indicative_status_exception(self, libhailort_exception):
155 error_code = int(libhailort_exception.args[0])
--> 156 raise self.create_exception_from_status(error_code) from libhailort_exception
HailoRTInvalidArgumentException: Invalid argument. See hailort.log for more information