Test AI Kit by ssh connection command line

hello everyone

when we run to detection module in GitHub - hailo-ai/hailo-rpi5-examples as ssh command line by this command

python basic_pipelines/detection.py --input resources/detection0.mp4
we get this error :
python basic_pipelines/detection.py --input resources/detection0.mp4

filesrc location=“resources/detection0.mp4” name=source ! queue name=source_queue_dec264 leaky=no max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! qtdemux ! h264parse ! avdec_h264 max-threads=2 ! queue name=source_scale_q leaky=no max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! videoscale name=source_videoscale n-threads=2 ! queue name=source_convert_q leaky=no max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! videoconvert n-threads=3 name=source_convert qos=false ! video/x-raw, format=RGB, pixel-aspect-ratio=1/1 ! queue name=detection_scale_q leaky=no max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! videoscale name=detection_videoscale n-threads=2 qos=false ! queue name=detection_convert_q leaky=no max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! video/x-raw, pixel-aspect-ratio=1/1 ! videoconvert name=detection_videoconvert n-threads=2 ! queue name=detection_hailonet_q leaky=no max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! hailonet name=detection_hailonet hef-path=/home/rasai/ODMAIKIT/basic_pipelines/…/resources/yolov6n.hef batch-size=2 nms-score-threshold=0.3 nms-iou-threshold=0.45 output-format-type=HAILO_FORMAT_TYPE_FLOAT32 force-writable=true ! queue name=detection_hailofilter_q leaky=no max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! hailofilter name=detection_hailofilter so-path=/usr/lib/aarch64-linux-gnu/hailo/tappas/post_processes/libyolo_hailortpp_post.so qos=false ! queue name=identity_callback_q leaky=no max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! identity name=identity_callback ! queue name=hailo_display_hailooverlay_q leaky=no max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! hailooverlay name=hailo_display_hailooverlay ! queue name=hailo_display_videoconvert_q leaky=no max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! videoconvert name=hailo_display_videoconvert n-threads=2 qos=false ! queue name=hailo_display_q leaky=no max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! fpsdisplaysink name=hailo_display video-sink=xvimagesink sync=true text-overlay=false signal-fps-measurements=true

[HailoRT] [error] CHECK failed - Failed to create vdevice. there are not enough free devices. requested: 1, found: 0

[HailoRT] [error] CHECK_SUCCESS failed with status=HAILO_OUT_OF_PHYSICAL_DEVICES(74)

[HailoRT] [error] CHECK_SUCCESS failed with status=HAILO_OUT_OF_PHYSICAL_DEVICES(74)

[HailoRT] [error] CHECK_SUCCESS failed with status=HAILO_OUT_OF_PHYSICAL_DEVICES(74)

[HailoRT] [error] CHECK_SUCCESS failed with status=HAILO_OUT_OF_PHYSICAL_DEVICES(74)

CHECK_EXPECTED failed with status=74

Showing FPS

Error: gst-resource-error-quark: Could not initialise Xv output (10), …/sys/xvimage/xvimagesink.c(1944): gst_xv_image_sink_open (): /GstPipeline:pipeline0/GstFPSDisplaySink:hailo_display/GstXvImageSink:xvimagesink0:
Could not open display (null)

we need run detection module with out GUI

Hey @haldun

Welcome to the Hailo Community!

It looks like there are two main issues you’re encountering:

1. HailoRT Error: Out of Physical Devices

The error HAILO_OUT_OF_PHYSICAL_DEVICES(74) indicates that the Hailo device is either not connected or not being detected by the system. Here are some steps to resolve it:

  • Check Device Connection: Ensure that the Hailo device is properly connected to the Raspberry Pi and is being recognized. You can confirm this by running:

    hailortcli scan
    

    If the device isn’t listed, check the physical connection and power to the device.

  • Free the Device: If other processes are using the device, they could be causing the issue. Restart the Raspberry Pi or kill any processes holding onto the device:

    ps aux | grep hailo
    kill -9 <PID>  # Replace <PID> with the process ID using Hailo
    

2. GStreamer Error: Could not initialize Xv output

The error Could not open display (null) means that you’re running the script in a headless environment (such as over SSH), and xvimagesink (which requires a display) can’t find one.

Since you want to run the detection module without a GUI, you can replace the xvimagesink with either fakesink (to discard the output) or filesink (to save the video output).

  • Use fakesink to discard the video output:

    python basic_pipelines/detection.py --input resources/detection0.mp4 --output fakesink
    
  • Use filesink to save the video output to a file:

    ... ! filesink location=/path/to/output/video.mp4
    

To Summarize:

  1. Check if the Hailo device is recognized using hailortcli scan.
  2. Terminate any processes using the Hailo device.
  3. Modify the GStreamer pipeline to use fakesink or filesink for headless operation.

Let me know how it goes or if you need further help!

Best regards,
Omri

hello
I did but : : error: unrecognized arguments: --output fakesink
(venv_hailo_rpi5_examples) rasai@raspberrypi:~/kh/hailo-rpi5-examples $ python basic_pipelines/detection.py --input resources/detection0.mp4 --output fakesink
usage: detection.py [-h] [–input INPUT] [–use-frame] [–show-fps] [–disable-sync] [–dump-dot] [–network {yolov6n,yolov8s}] [–hef-path HEF_PATH]
[–labels-json LABELS_JSON]
detection.py: error: unrecognized arguments: --output fakesink

@haldun
Seems, --output argument is invalid. You can try changing in file.

Go to “detection_pipeline.py”

Replace this line with

 display_pipeline = fakesink

:star_struck: :star_struck: Thank you so much for your help with the programming problem. I really
it ok :grinning: :grinning:

but i have another question :
I want to perform separate detection using my business , as I have some specific code I want to implement. Is this possible as in the following example?"

cap = cv2.VideoCapture("speed3.mp4")
while True:                              
      success, frame = cap.read()
      roi = hailo.get_roi_from_buffer(frame)
     detections = roi.get_objects_typed(hailo.HAILO_DETECTION)

can I do that I try but I ger this error:
/home/rasai/kh/hailo-rpi5-examples/basic_pipelines/detection.py:99: Warning: g_type_set_qdata: assertion ‘quark != 0’ failed
roi = hailo.get_roi_from_buffer(frame)
Segmentation fault

Yes possible but you may need to do little bit adjustments. It’s not straight forward to use like yolo.

can you give me simple sample

You can take a look.

I have tried pose model…from same repo

You can open camera/video using cv2 and read the frames and queue them. HailoAsyncInference will process and queue them to output queue and you can process the result.

I’m trying to follow the previous example I mentioned in my last email, but when downloading this library, I can’t select the version.
pip install hailort-X.X.X-cpXX-cpXX-linux_x86_64.whl

in my server :
(hailo_env) rasai@raspberrypi:~/kh/kh10 $ pip install ./hailort-4.17.0-cp311-cp311-linux_aarch64.whl

WARNING: Requirement ‘./hailort-4.17.0-cp311-cp311-linux_aarch64.whl’ looks like a filename, but the file does not exist

Looking in indexes: Simple index, piwheels - Simple index

Processing ./hailort-4.17.0-cp311-cp311-linux_aarch64.whl

ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: ‘/home/rasai/kh/kh10/hailort-4.17.0-cp311-cp311-linux_aarch64.whl’


rasai@raspberrypi:~ $ uname -m

aarch64

rasai@raspberrypi:~ $ python --version

Python 3.11.2

How can I do that?

@haldun
I don’t remeber, But probably on raspberrypi we don’t need to
explicitly install .whl. It is installed when you setup the hailo AI Kit.
You tried running the app directly? You may have to setup virtualenv and download resources Hailo-Application-Code-Examples/runtime/python/object_detection/download_resources.sh at main · hailo-ai/Hailo-Application-Code-Examples · GitHub

But I think this will download the hef model for hailo8 not (hailo8l). you can replace with your custom object detection model hef or you can download pre compiled from model-explorer. Model Zoo by Hailo | AI Model Explorer to Find The Best NN Model.

I tied and run all steps

i get this error

(hailo_env) rasai@raspberrypi:~/kh/kh101/Hailo-Application-Code-Examples/runtime/python/object_detection $ ./object_detection.py -n ./yolov7.hef -i zidane.jpg

Traceback (most recent call last):

File “/home/rasai/kh/kh101/Hailo-Application-Code-Examples/runtime/python/object_detection/./object_detection.py”, line 17, in

from utils import HailoAsyncInference, load_input_images, validate_images, divide_list_to_batches

File “/home/rasai/kh/kh101/Hailo-Application-Code-Examples/runtime/python/utils.py”, line 8, in

from hailo_platform import (HEF, VDevice,

ModuleNotFoundError: No module named ‘hailo_platform’

can you help me my task have to finish today :unamused:

i found hailo library but i get error : virtualenv -p python3.10 hailo_platform_venv && . hailo_platform_venv/bin/activate && pip install ./hailort-4.17.0-cp310-cp310-linux_x86_64.whl
created virtual environment CPython3.10.0.final.0-64 in 1744ms
creator CPython3Posix(dest=/home/rasai/kh/kh10/hailo_platform_venv, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/rasai/.local/share/virtualenv)
added seed packages: pip==23.0.1, setuptools==66.1.1, wheel==0.38.4
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
WARNING: Requirement ‘./hailort-4.17.0-cp310-cp310-linux_x86_64.whl’ looks like a filename, but the file does not exist
Looking in indexes: Simple index, piwheels - Simple index
ERROR: hailort-4.17.0-cp310-cp310-linux_x86_64.whl is not a supported wheel on this platform.

@haldun
Can you try installing HailoRT – Python package (whl) for Python 3.11, aarch64 wheel.

yes rasai@raspberrypi:~ $ uname -m

aarch64

@haldun
I just confirmed the downloaded model “yolov7” is built for hailo8. you can download yolov8n/s from model explorer for hailo8l. It works.

i try to aarch64 but

rasai@raspberrypi:~/kh/kh10 $ virtualenv -p python3.10 hailo_platform_venv && . hailo_platform_venv/bin/activate && pip install ./hailort-4.17.0-cp310-cp310-linux_aarch64.whl

created virtual environment CPython3.10.0.final.0-64 in 424ms

creator CPython3Posix(dest=/home/rasai/kh/kh10/hailo_platform_venv, clear=False, no_vcs_ignore=False, global=False)

seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/rasai/.local/share/virtualenv)

added seed packages: pip==23.0.1, setuptools==66.1.1, wheel==0.38.4

activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

WARNING: Requirement ‘./hailort-4.17.0-cp310-cp310-linux_aarch64.whl’ looks like a filename, but the file does not exist

Looking in indexes: Simple index, piwheels - Simple index

Processing ./hailort-4.17.0-cp310-cp310-linux_aarch64.whl

ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: ‘/home/rasai/kh/kh10/hailort-4.17.0-cp310-cp310-linux_aarch64.whl’

Can you share steps, how you are installing?

1- rasai@raspberrypi:~ $ uname -m

aarch64

2- open Hailo-Application-Code-Examples/runtime/python/object_detection/README.md at main · hailo-ai/Hailo-Application-Code-Examples · GitHub

3- my problem now : i can not excite this step

  1. Install PyHailoRT
  • Download the HailoRT whl from the Hailo website - make sure to select the correct Python version.
  • Install whl:

pip install hailort-X.X.X-cpXX-cpXX-linux_x86_64.whl

when I run this command
pip install hailort-4.17.0-cp310-cp310-linux_aarch64.whl

4.17.0
i get this erro:

Looking in indexes: Simple index, piwheels - Simple index

Processing ./hailort-4.17.0-cp310-cp310-linux_aarch64.whl

ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: ‘/home/rasai/kh/kh10/hailort-4.17.0-cp310-cp310-linux_aarch64.whl’

I still think, I never installed the hailort wheel manually, still everything works on my pi5.
I followed the raspberry pi guide to install. https://www.raspberrypi.com/documentation/accessories/ai-kit.html

Have you followed the same way to install hailo on your device?

Regarding Installation issue-
Please confirm your hailort file path.
Create a virtualenv to install.