Hailo8 multi-VDevice in python

Hello,

i had already developed an application using Multi-VDevice in Gstreamer Pipeline, but we need to move it to Python.

i want to know if Multi-VDevice is possible or not in Hailo_platform API using Python

scan

in that API, Device scan show 4 Hailo VDevice in it

but, i think only 1 Hailo Vdevice is used as Default as it shown.

Also, my application performance has not improved while using Multi-VDevice .

How should i set up the API to use all chips like this?

Thank you for your help

Hey @rhymus314,

If you want to use Python while still taking advantage of GStreamer’s powerful video support in the background, I recommend checking out the Hailo RPI5 examples. Even though they’re designed for the RPI5, these examples also work great on x86 systems. They show you how to combine GStreamer with the Hailo platform API for smooth video handling.

Multi-Device Support in Hailo

One of the cool things about Hailo is that it supports multiple devices through its platform API. Here’s a quick Python code snippet (untested) showing how you can set up and use multiple VDevices:

vdevice_params = VDevice.create_params()
vdevice_params.scheduling_algorithm = HailoSchedulingAlgorithm.ROUND_ROBIN
vdevices = [VDevice(vdevice_params) for _ in range(num_of_devices)]

# Load models on each VDevice
infer_models = []
for vdevice in vdevices:
    infer_model = vdevice.create_infer_model(hef_path)
    infer_model.set_batch_size(batch_size)
    infer_models.append(infer_model)

# Distribute batches
for batch_data in input_batches:
    for infer_model in infer_models:
        # Execute async inference
        infer_model.wait_for_async_ready(timeout_ms=10000)
        infer_model.run_async(batch_data, callback)

GStreamer vs. Python: A Comparison

GStreamer Example

When using GStreamer, you manage multiple devices through the hailonet element. You just need to specify the device count explicitly:

gst-launch-1.0 \
    $source_element ! videoconvert ! videoscale ! \
    queue leaky=no max-size-buffers=30 max-size-bytes=0 max-size-time=0 ! \
    hailonet hef-path=$hef_path device-count=$device_count is-active=true

Python Equivalent

In Python, you achieve the same functionality by programmatically configuring VDevices and managing streams directly:

for vdevice in vdevices:
    network_group = vdevice.configure(hef)
    # Distribute and process frames through streams

I hope this helps clarify how to leverage Python and GStreamer together with Hailo devices! Let me know if you have any other questions.