hailo-ai / hailo-rpi5-examples

MIT License
385 stars 59 forks source link

Error running basic_pipelines/detection.py on RPi 5 #31

Closed GuyYaacov closed 3 months ago

GuyYaacov commented 3 months ago

Hello everyone,

I encountered an issue when running the basic_pipelines/detection.py script from the hailo-rpi5-examples repository on my Raspberry Pi. The script fails with an error I'm trying to resolve.

My hardwere:

Additional Information:

Steps to Reproduce:

  1. I have installed the hailo-rpi5-examples as per the provided instructions in
  2. Run the following command: python basic_pipelines/detection.py --input rpi
  3. Observe the error output.

Observed output:

(venv_hailo_rpi5_examples) pi@MyPiAI:~/hailo-rpi5-examples $ python basic_pipelines/detection.py --input rpi
hailomuxer name=hmux libcamerasrc name=src_0 auto-focus-mode=2 ! video/x-raw, format=RGB, width=1536, height=864 ! queue name=queue_src_scale max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! videoscale ! video/x-raw, format=RGB, width=640, height=640, framerate=30/1 ! queue name=queue_scale max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! videoscale n-threads=2 ! queue name=queue_src_convert max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! videoconvert n-threads=3 name=src_convert qos=false ! video/x-raw, format=RGB, width=640, height=640, pixel-aspect-ratio=1/1 ! tee name=t ! queue name=bypass_queue max-size-buffers=20 max-size-bytes=0 max-size-time=0 ! hmux.sink_0 t. ! queue name=queue_hailonet max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! videoconvert n-threads=3 ! hailonet hef-path=/home/pi/hailo-rpi5-examples/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=queue_hailofilter max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! hailofilter so-path=/home/pi/hailo-rpi5-examples/basic_pipelines/../resources/libyolo_hailortpp_post.so  qos=false ! queue name=queue_hmuc max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! hmux.sink_1 hmux. ! queue name=queue_hailo_python max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! queue name=queue_user_callback max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! identity name=identity_callback ! queue name=queue_hailooverlay max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! hailooverlay ! queue name=queue_videoconvert max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! videoconvert n-threads=3 qos=false ! queue name=queue_hailo_display max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! fpsdisplaysink video-sink=xvimagesink name=hailo_display sync=false text-overlay=False signal-fps-measurements=true 
[0:01:55.821719478] [2604]  INFO Camera camera_manager.cpp:313 libcamera v0.3.0+65-6ddd79b5
[0:01:55.829544474] [2613]  INFO RPI pisp.cpp:695 libpisp version v1.0.6 b567f0455680 17-06-2024 (10:20:00)
[0:01:55.839489505] [2613]  INFO RPI pisp.cpp:1154 Registered camera /base/axi/pcie@120000/rp1/i2c@88000/imx296@1a to CFE device /dev/media2 and ISP device /dev/media0 using PiSP variant BCM2712_C0
[0:01:55.851063487] [2628]  WARN V4L2 v4l2_pixelformat.cpp:344 Unsupported V4L2 pixel format RPBP
[0:01:55.877218222] [2628]  WARN V4L2 v4l2_pixelformat.cpp:344 Unsupported V4L2 pixel format RPBP
Error: gst-stream-error-quark: Internal data stream error. (1), ../src/gstreamer/gstlibcamerasrc.cpp(646): gst_libcamera_src_task_enter (): /GstPipeline:pipeline0/GstLibcameraSrc:src_0:
streaming stopped, reason not-negotiated (-4)

Thank you!

GuyYaacov commented 3 months ago

Problem solved: Just had to edit get_pipeline_string method:

def get_pipeline_string(self):
        if (self.source_type == "rpi"):
            source_element = f"libcamerasrc name=src_0 auto-focus-mode=AfModeManual ! "
            source_element += f"video/x-raw, format=RGB, width=1088, height=1088 ! "
            source_element += QUEUE("queue_src_scale")
            source_element += f"videoscale ! "
            source_element += f"video/x-raw, format={self.network_format}, width={self.network_width}, height={self.network_height}, framerate=60/1 ! "

        #the rest is the same