First of all, thank you for your help .
I currently have a .hef costom_modelyolov8 and have triedhailo-rpi5-examples Work efficiently
Now here comes the problem I’m facing, I want to know how to use model.hef in my python code but it doesn’t work because I think it’s not installed import hailo_platform I have installed HailoRT 4.18 But it doesn’t work.
andthis my code
import cv2
import numpy as np
from hailo_platform import InferVDevice
Initialize Hailo VDevice
vdevice = InferVDevice()
Load the Hailo model
model = vdevice.load_network_from_hef(“havegoodday.hef”)
cap = cv2.VideoCapture(“/dev/video0”)
if not cap.isOpened():
print(“Error: Unable to open /dev/video0”)
exit()
try:
while True:
# Read a frame from the camera
ret, frame = cap.read()
if not ret:
print(“Error: Unable to read frame from camera”)
break
# Preprocess the frame
frame_resized = cv2.resize(frame, (width, height))
frame_rgb = cv2.cvtColor(frame_resized, cv2.COLOR_BGR2RGB)
input_data = np.transpose(frame_rgb, (2, 0, 1)) # Convert HWC to CHW
input_data = np.expand_dims(input_data, axis=0).astype(np.float32) # Add batch dimension
# Perform inference
result = model.infer(input_data)
# Post-process the result
print(“Inference result:”, result)
# Display the frame (optional)
cv2.imshow(“Camera Feed”, frame)
if cv2.waitKey(1) & 0xFF == ord(‘q’): # Quit on ‘q’ key
break
finally:
# Release resources
cap.release()
cv2.destroyAllWindows()
vdevice.release()
and this erorr
Traceback (most recent call last):
File “/home/hrimpact/hailo-rpi5-examples/env1/test2.py”, line 3, in
from hailo_platform.some_module import InferVDevice
File “/home/hrimpact/hailo-rpi5-examples/env1/lib/python3.11/site-packages/hailo_platform/init.py”, line 17, in
import hailo_platform.pyhailort._pyhailort as _pyhailort
ImportError: /home/hrimpact/hailo-rpi5-examples/env1/lib/python3.11/site-packages/hailo_platform/pyhailort/_pyhailort.cpython-311-aarch64-linux-gnu.so: undefined symbol: ZN7hailort20ConfiguredInferModel3runENS08BindingsENSt6chrono8durationIlSt5ratioILl1ELl1000EEEE
thank you , [Nadav]
yes i’m in env and run code and error .
in env I installed hailort-4.18.0-cp311-cp311-linux_aarch64.whl and opencv and Ultralytics .
I think I have it all installed or is there something I need to download?
I have more questions
pyhailort whl == hailort-4.18.0-cp311-cp311-linux_aarch64.whl
hailo_pci deb file == hailort-pcie-driver_4.18.0_all (1).deb
libhailort deb file ==
thank you
I want to update
I changed version to 4.19.0
and i install hailort-pcie-driver_4.19.0_all (1).deb , hailort-4.19.0-cp311-cp311-linux_aarch64.whl,hailort_4.19.0_arm64.deb
no erorr but i can’t run my code
and
this error
Traceback (most recent call last):
File “/home/hrimpact/hailo-rpi5-examples/env1/test2.py”, line 3, in
from hailo_platform.pyhailort import InferVDevice
ImportError: cannot import name ‘InferVDevice’ from ‘hailo_platform.pyhailort’ (/home/hrimpact/hailo-rpi5-examples/env1/lib/python3.11/site-packages/hailo_platform/pyhailort/init.py)
and I have a second question.
in env [hailo-rpi5-examples]
and i Forced installation For the 3 you mentioned(pyhailort,hailo_pci deb file ,libhailort deb file)
and this error
[HailoRT] [error] CHECK failed - max_desc_page_size given 16384 is bigger than hw max desc page size 4096
[HailoRT] [error] CHECK_SUCCESS failed with status=HAILO_INTERNAL_FAILURE(8)
[HailoRT] [error] CHECK_SUCCESS failed with status=HAILO_INTERNAL_FAILURE(8)
[HailoRT] [error] CHECK failed - Cannot find an executable buffer planning for the given edge layers
[HailoRT] [error] CHECK_SUCCESS failed with status=HAILO_CANT_MEET_BUFFER_REQUIREMENTS(84)
I’m confused because I used python basic_pipelines/detection.py --labels-json resources/barcode-labels.json --hef resources/yolov8s-hailo8l-barcode.hef --input resources/barcode.mp4
My goal is to find a method that allows me to simply run python test.py, where the code can efficiently execute through the NPU. Do you have any resources or simple examples that could help me understand this better?
Currently, I only have a .hef model ready to run on the NPU, but I don’t know how to integrate it or use it in my project
Thank you
The asnwer is simple, just use what already works on your end - hailo-rpi5-examples. This is the reccommended (while not only) way to work with the AI Kit.
Even though I try to study hailo-rpi5-examples
besides basepipline
I have tried other things like
my code python is not run because of a problem from ImportError: cannot import name ‘VStreamParams’ from ‘hailo_platform’ (/usr/lib/python3/dist-packages/hailo_platform/init.py)
Can you recommend me anything besides python basic_pipelines/detection.py --labels-json resources/barcode-labels.json --hef resources/yolov8s-hailo8l-barcode.hef --input resources/barcode.mp4
Are there other routes that the .hef model can be deployed?
Hi [Nadav]
i have question
ModuleNotFoundError:No module named ‘hailort’
i set up hailort-4.19.0-cp311-cp311-linux_aarch64.whl , hailort ubuntu for arm64, pcie_4.19.0
but not import hailort
can you help pls
To help you better understand the different components and address the ModuleNotFoundError: No module named 'hailort' issue, let’s break things down:
hailo-rpi-examples: This repository provides a GStreamer infrastructure for capturing and processing input from video files or cameras. It uses Python to extend the functionality. If you want to use your own HEF (Hailo Executable Format) file and customize the pipeline, you’ll need to modify the callback function. You can find more information and the code in the following repository: GitHub - hailo-ai/hailo-rpi5-examples
Hailo Code Applications Example: This repository contains generic Python and C++ examples demonstrating how to run Hailo inference on various platforms. It serves as a reference for integrating Hailo into your own applications. You can explore the examples in this repository: GitHub - hailo-ai/Hailo-Application-Code-Examples
Now, regarding the error you encountered:
ModuleNotFoundError: No module named 'hailort'
This error indicates that the hailort module is not installed, rather than an issue with pyhailort. The hailort module is part of the Hailo Runtime Library, which is required for running Hailo inference.
if you keep seeing this no hailort error , please run the installation in here