Modell with 2 Inputs using python class HailoInfer

Hi.

I’m new on Hailo and I have some trouble. I started with de Hailo_app / Python / standalone_apps and so far so good.
Now I created a simple ONNX - Modell for calculating the mean of to images, builded the href and tryed do write a Python script for inference, but i’m runing in trouble, because it seem’s that the class HailoInfer didn’t support more than one Input …

Any help ?

Hi @Armin_71,

Can you please share the code you’re trying to use?

Thanks,

Hi Michael,

this is my code:

from hailo_inference import HailoInfer

net = “/home/armin/hailo_compile/testadd.hef”

#the parameter input_type cause an error

#hailo_inference = HailoInfer(hef_path = net,batch_size=1, input_type=“FLOAT32”, output_type=“FLOAT32”)

hailo_inference = HailoInfer(hef_path = net,batch_size=1, output_type=“FLOAT32”)

#here I get the shape only from one input

dest_hh, dest_ww, _ = hailo_inference.get_input_shape()

random_input1 = np.random.rand([256,256,3]).astype(np.float32)
random_input2 = np.random.rand(
[256,256,3]).astype(np.float32)

input_batch = [
{
“testadd/input_layer1”: random_input1,
“testadd/input_layer2”: random_input2
}
]

output_queue = queue.Queue(10)

inference_callback_fn = partial(
inference_callback,
input_batch=input_batch,
output_queue=output_queue
)

#here I get another error

job = hailo_inference.run(input_batch, inference_callback_fn)

regards

Armin

Hi @Armin_71,

The HailoInfer wrapper class in hailo_apps was designed as a convenience for single-input models, so it doesn’t handle multi-input HEFs out of the box. For models with multiple inputs, you might want to use the lower-level hailo_platform InferModel API directly, which does support addressing each input by name via .input("layer_name").
You can find the relevant Python async inference tutorial and API reference here: v5.2.0 | Hailo.
You might also find it helpful to run hailortcli parse-hef testadd.hef to verify the exact input layer names your HEF expects.

Thanks,
Michael.