I’m in the process of rerunning the whole thing on a new os so I’ll let you know what I run into but I imagine you might just have to restart it again if the github code was updated (I imagine if the code was updated and you have a cloned code that is no longer up to date, calling on it might cause conflicts), you can also try cloning it again possibly but if it shares the same name it won’t allow you to.
Update, I have successfully made it past the ./install.sh command and am now running into the same error you are when I attempt to run “python basic_pipelines/detection.py” the terminal just closes and runs nothing, no error given. Solve one problem, run into another
And I am using the most updated github code I believe unless the url changed.
Okay.
Got the Example Code 1: Object Detection, Example Code 2: Counting Objects and Example Code 3: Object Location working
Basically hailo_rpi_common has been renamed to hailo_apps_infra.hailo_rpi_common
Original top part of the code:
from hailo_rpi_common import (
get_caps_from_pad,
get_numpy_from_buffer,
app_callback_class,
)
from detection_pipeline import GStreamerDetectionApp
Change it to:
from hailo_apps_infra.hailo_rpi_common import (
get_caps_from_pad,
get_numpy_from_buffer,
app_callback_class,
)
from hailo_apps_infra.detection_pipeline import GStreamerDetectionApp
Do you have the same issue running “python basic_pipelines/detection.py” closing the terminal? I seem to still run into it
I’m not having any issues with python basic_pipelines/detection.py
(it’s showing a new video).
One thing not mentioned in the guide is that you need to enable “PCIe Gen 3.0.”
You can enable this by adding it to /boot/firmware/config.txt
or by using sudo raspi-config
and setting it to “on.” (it’s under option 6 “Advanced Options” I believe)
More info about “PCIe Gen 3.0.” here: https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#pcie-gen-3-0
Maybe this could be causing your problem?
That would be exactly where my issue was, like I said I’ve never used a pi before so that’s definitely something I missed. Thanks! I now have object detection up and working, I will come back and ask where to edit the code once I get to that step as I will likely not know where to go for that.
Thanks @Leon and @Tom287534 for the investigation.
I’ve checked out the GitHub repo and I think you are on the money Leon with that name change for the commons folder. They have recently released a standalone version of the NPU from the AI HAT which can be used on non-raspberry Pi machines, and my guess is that this change is to make their pipelines run on all platforms.
As for the PCIe gen 3 issue, the first installation of “install hailo-all” should set it to gen 3 by default. This used to be the case but I will do a complete fresh install and see what’s up. I will also go ahead and update the code in the guide, thankfully this is all an easy fix. Hailo has been a bit of a headache to work with here and there…
They have also released a few bug fixes in the last few days for the environment set-up and install.sh, so you might have been running into some issues with those @Tom287534.
Keep us updated with how things go and if you do manage to draw custom elements in the window!
I’m running into issues running the object detection again, no errors or anything but when I do the python (or python3) basic_pipelines/detection.py --input rpi, the terminal shuts and no window opens with the camera, same with running it normally without the “–input rpi” modifier. What do we think is causing this issue?
Hey @Tom287534,
Sorry to hear you are still having issues with this object detection script.
I would first verify that your camera is being detected correctly. Running the command libcamera-hello
should give you an output that lists your connected camera. If you get an output that says something like “no cameras available” then this is likely a camera issue.
Next, I would step through the detection.py script using python’s built-in debugger to see when the script is failing. You can do this with the command python -m pdb basic_pipelines/detection.py
. This command will run the script line by line and only continue to the next line when you tell it to.
Once this command is run you will be able to step through the code by entering next
once each line has executed. You can also enter help
for a full list of acceptable commands. I would give this a go and see if you can figure out what part of the code specifically is causing this error.
Any terminal output you can share from this troubleshooting would be useful.
Hope this helps!
Running the libcamera-hello brought up the rpi camera and I see the video stream, so that isn’t the issue. I believe it is a problem with the git-hub names being different again, running the code line by line I found the error it gives:
"
(Pdb) next
from hailo_apps_infra.hailo_rpi_common import (
(Pdb) next
ModuleNotFoundError: No module named ‘hailo_apps_infra’
"
Soooo I am not sure how Leon solved this last time but this was the previous issue we ran into, we added the suffix “hailo_apps_infra” to the beginning of the code and it worked, maybe they reverted the change?
I removed the original hailo-rpi5-examples directory and recloned the github and it works perfectly now. I guess somewhere along the way of Jaryd updating the install.sh or something to do with the github updating to enable it to run on all platforms it must’ve changed something in where the infra file was and it couldn’t locate it in my directories.
Glad to hear you fixed it!
That was going to be my next recommendation with all these updates to the demo code and repo, best of luck and let us know if you have any other issues!!
Thanks for checking in Jaryd! So far I have the Ai detecting and finding the average bounding box coordinates for the person and writing it to a variable in an SQLite database and updating it once every second, I just have to batch this code with my code for retrieving the UWB distance and have that write to the database as a second variable then I’ll be on to writing the main python code for the PI controller for the PWM signal to control the drive motors (this main code references the 2 variables in the SQLite database). I’ll change the config settings so that on boot it runs a batch command running the 3 codes concurrently (the distance writing to SQLite, the AI x coordinate writing to SQLite, and the main code drawing from these variables to calculate the pwm signals, with a manual override and control function via bluetooth from an esp32).
Sounds like you know what you’re doing! That’s a full-on project you got yourself there, best of luck with it, and keep us updated with it as well!
So I just got the Raspberry Pi AI Hat+. Im looking and failing to find the API docs for Python so I can interface with the Hat. I am probably just missing it but can someone point me to them? Secondly is their a great resources to understand more about the Hailo Model Zoo and which models do exactly what? Lastly how do I load new models to be used with Python. I bet someone will find it way faster then I can. Thanks for any help!
Hey Joe, welcome to the forums!
Chasing some documentation, I would take a look at their GitHub repo for the Python project. Its a little disorganised but has a HEAP of good info in there.
There is also a very technical Python API documentation page that is very comprehensive. To access it you need to create a developer account (bit of a joke), but its free and you just need an email.
For information on models in the model zoo, there isn’t a good definitive guide, but asking an LLM like ChatGPT, Claude or Deep Seek can help out greatly here. If you do want to use a model from the zoo, scroll to the right of the table and download the “compiled” model. Then in the section of the guide where we run the -help option, you will find a setting to specify a path to run this custom model (or you can also modify the pipeline Python file to run it by default).
In terms of loading new models, if it is pre-compiled from the model zoo, do as above. But if it is a custom model you are looking for then this gets a bit tricky. It is quite an involved process that requires some decent hardware (several hours to retrain a model on even an RTX 4080). The official retraining guide, and a good guide by Cytron are some good places to start. Its on our list of guides to make, but that might a while away.
Best of luck with your project and let us know if there is anything else you need!
Follow up to my project, I am making some great headway on it and I now have the esp32 controlling the raspberry pi’s functionality and executing python scripts via button presses sent through bluetooth low energy. I am now running into an issue however. In order to save battery on our cart, we are attempting to shut down the processes when the user presses a button (ie stop following me), but I cannot for the life of me figure out how to stop the hailo detection from running. Is there a way you know of how to shut the process down and stop the hailo detection app from running completely until I tell it to boot up again? I’ve tried killing the processes related to hailo, and a bunch of other approaches but can’t figure it out other than manually clicking the x on the window (which is obviously not desirable in an autonomous vehicle).
Hmmmm, this is a little bit beyond my current knowledge. With how fresh the HAT is, you may be one of the first people trying to do this!
If I remember correctly from our testing we found that the HAT only consumes about 10 watts of power when processing which isn’t an incredible amount if you end up not being able to stop it.
You haven’t been able to just kill the terminal you are running it out of? That should stop the processing?
I’m not fully sure if I have tried that yet (I’m learning as I go and chatgpt has worked wonders), but I have attempting killing all processes related to hailo, the current code that still won’t close it is as follows:
def stop_hailo_window():
“”“Force close the Hailo Detection App if still running.”“”
try:
window_pid = os.popen(“xprop -name ‘Hailo Detection App’ | grep ‘_NET_WM_PID’ | awk ‘{print $3}’”).read().strip()
if not window_pid:
for proc in psutil.process_iter(attrs=['pid', 'name', 'cmdline']):
if any("detection.py" in cmd for cmd in proc.info['cmdline'] or []):
window_pid = proc.info['pid']
break
if window_pid:
print(f"✅ Stopping Hailo Detection App (PID: {window_pid})...")
os.kill(int(window_pid), signal.SIGKILL)
print("🛑 Hailo Detection App closed.")
else:
print("⚠️ Could not find Hailo Detection App PID.")
I kind of gave up on trying to close it to be honest but I’ll screw around with it, been having more issues trying to run a script on boot up of the pi that searches for the BLE signal of the esp32 and then waits to execute the script I have set up to automate running the detection script (auto-ai.py is what I named it) in an environment until it receives a button press via bluetooth but it keeps getting stuck when attempting to run the auto-ai script. I hate programming, I am an electrical engineer not comp sci