import degirum as dg
import cv2
# Load the segmentation model from the model zoo.
# Replace '<path_to_model_zoo>' with the directory path to your model assets.
model = dg.load_model(
model_name='yolov8n_seg',
inference_host_address='@local',
zoo_url='home/pi/hailo_examples/model_zoo'
)
# Run inference on an input image.
# Replace '<path_to_input_image>' with the actual path to your image.
inference_result = model('/home/pi/hailo_examples/assets/panel1.jpg')
# The segmentation overlay (with masks and labels) is available via the image_overlay attribute.
cv2.imshow("Segmentation Output", inference_result.image_overlay)
# Wait until the user presses 'x' or 'q' to close the window.
while True:
key = cv2.waitKey(0) & 0xFF
if key == ord('x') or key == ord('q'):
break
cv2.destroyAllWindows()
I took the example code I wrote above from the GitHub repository and tried running it on the RPi 5 8GB model, but I’m getting an error as shown in the image. You can see that my model exists in the file structure. How can I run my own model?.
The file structure is as follows:
The folder path: home/pi/hailo_examples/model_zoo/
Contents of the folder:
yolov8n_seg.hefyolov8n_seg.jsonlabels_coco.json
