Multiprocessing issue on RPi5 and hailo AI-kit

We are using the raspberry Pi AI Kit with a raspberry pi 5 and running into an issue with running multiple processes in parallel. Right now, when using GStreamerApp from the hailo-rpi5-examples GitHub together with another file that makes decisions based on the outputted bounding box coordinates by combining them using the multiprocessing library in Python, it only runs the decision-making file once the video feed is closed. When looking at the cpu usage using top, we see that all cores are being used for about 50% when the video feed is active. What could be the issue?

Hey @jack.martin ,

Welcome to the Hailo Community!

The issue you’re encountering is likely due to how the multiprocessing library interacts with GStreamer’s main loop and threading model. GStreamerApp and your decision-making file may be blocking or competing for resources due to a shared Global Interpreter Lock (GIL) or improper process management. Here’s a breakdown and solution:


Possible Causes

  1. GStreamer Blocking the Main Loop:
  • GStreamer operates on a single-threaded main loop by default, which might block other processes when handling video feeds.
  1. I/O Contention:
  • Both processes (GStreamer and decision-making) could be competing for I/O resources, causing delays.
  1. CPU Usage and Thread Starvation:
  • Even if the cores are only at 50% usage, inefficient thread scheduling or blocking calls may prevent the decision-making process from running concurrently.

Recommended Solutions

1. Use Asynchronous Communication Between Processes

2. Increase GStreamer Threading

3. Reduce CPU Bottlenecks

4. Use Separate Python Environments