Running detection models in my own code

Hi everyone.
I have a raspberry pi 5 and Hailo 8L ai kit. I want to run hailo models such as yolov8.hef on my own detection code. Is it possible? ChatGPT gave me a code like:

from hailo_platform import PcieDevice
from hailo_sdk_client import Client
from hailo_sdk_client.structs import DetectionROI

device = PcieDevice()
device.open()

hef_path = "yolov8m.hef"
client = Client(device)
client.load_hef(hef_path)

def hailo_detect(roi):
    input_data = DetectionROI(roi)

    results = client.run(input_data)

    return results

results = hailo_detect(roi)

but I think its incorrect. There are library errors like “ModuleNotFoundError: No module named hailo_platform”. I installed the hailo with the official github repo “hailo-ai/hailo-rpi5-examples” and I run the tests, its all ok. Am I only able to run hailo-ai/hailo-rpi5-examples/detection.py, or is it possible that I can detect objects in my own code with a command like results = hailo_detect(roi), thanks for the answers.

Hi @ergul.guvenliksistem,

Welcome to the Hailo Community!

The RPi examples are based on Python with GStreamer. If you want to use the Python API directly, there is a way, but it’s not covered in the RPi examples. Instead, you’ll need to follow the examples provided here:

You can either build on top of these examples or use them as a starting point for your own code.

Best Regards,
Omri