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: