(pi5 + hailo8l) Unable to write python applications using hailort

I recently purchased a raspberry pi 5 and ai hat (with Hailo8l) so I could port an application (originally written on a Jetson Nano) to this more powerful platform for evaluation. I followed the setup instructions from Raspberry Pi (Here) and the sample applications run and work very well.

My next step was going to be to write a standalone python test app that uses hailoRT and yolov8s-pose.hef to do pose estimation/detection, but I’m having trouble even getting started. I’ve found several examples of how to load a hef file in python, but none of them work for me.

For example, if I try the following:

from hailo_platform import Device, Hef, VStreamsManager
import numpy as np

# Load the HEF file
hef_path = "yolov8s-pose.hef"
hef = Hef(hef_path)

then I get the error

Traceback (most recent call last):
  File "/home/uatu/src/test/posetest/posetest.py", line 1, in <module>
    from hailo_platform import Device, Hef, VStreamsManager
ImportError: cannot import name 'Hef' from 'hailo_platform' (/home/uatu/.local/lib/python3.11/site-packages/hailo_platform/__init__.py)

Can you please point me towards the proper way to load the pose estimation model in a python program? I plan on passing it input data from an opencv data source that is part of my application code, so all I want to be able to do is load the model and then, in a loop, take frames from the opencv source and run an inference on them, getting the results to pass to another part of the code for use.

Thanks in advance

Hi @Marc_Jasner
Welcome to the Hailo community. At DeGirum, we developed PySDK, a python package to simplify application development with Hailo devices. You can see setup instructions and examples at: DeGirum/hailo_examples: DeGirum PySDK with Hailo AI Accelerators. For your specific use case, you can see hailo_examples/examples/002_yolov8.ipynb at main · DeGirum/hailo_examples

Thanks @shashi, I’ll take a look at that, but I’d be interested in learning to do it without using a 3rd party API if possible. Is that not something that’s easily achievable?

Hi @Marc_Jasner
Understood.

Hey @Marc_Jasner,

Check out these examples - they should get you started with the Hailo API:

Object Detection:

Utils (How to run ASYNC infernce on hailo8):

Pose Estimation:

These examples cover the basics of working with the Hailo API and should give you a good foundation. If you run into any specific issues or need help with a particular use case, just let me know!

Awesome, thanks! I’ll take a look!