Error when running detection.sh file in /tappas_v3.30.0/apps/h8/gstreamer/rockchip/detection

./detection.sh -i /dev/video21 --show-fps

I modified the detection.sh file as follows to run the newly created yolov8n.hef.
--------------------------------------------------------------------------------------------------------------#!/bin/bash

set -e

function init_variables() {

print_help_if_needed $@



script_dir=$(dirname $(realpath "$0"))

source $script_dir/../../../../../scripts/misc/checks_before_run.sh



readonly POSTPROCESS_DIR="$TAPPAS_WORKSPACE/apps/h8/gstreamer/libs/post_processes/"

readonly RESOURCES_DIR="$TAPPAS_WORKSPACE/apps/h8/gstreamer/rockchip/detection/resources"



readonly DEFAULT_POSTPROCESS_SO="$POSTPROCESS_DIR/libyolo_hailortpp_post.so"

readonly DEFAULT_NETWORK_NAME="yolov8n"

readonly DEFAULT_BATCH_SIZE="1"

readonly DEFAULT_VIDEO_SOURCE="$RESOURCES_DIR/detection.mp4"

readonly DEFAULT_HEF_PATH="$RESOURCES_DIR/yolov8n.hef"

readonly DEFAULT_JSON_CONFIG_PATH="$RESOURCES_DIR/configs/yolov8.json"





video_sink_element=$([ "$XV_SUPPORTED" = "true" ] && echo "xvimagesink" || echo "ximagesink")

video_sink="fpsdisplaysink video-sink=$video_sink_element text-overlay=false"

postprocess_so=$DEFAULT_POSTPROCESS_SO

network_name=$DEFAULT_NETWORK_NAME

input_source=$DEFAULT_VIDEO_SOURCE

batch_size=$DEFAULT_BATCH_SIZE

hef_path=$DEFAULT_HEF_PATH

json_config_path=$DEFAULT_JSON_CONFIG_PATH

nms_score_threshold=0.3 

nms_iou_threshold=0.45



thresholds_str="nms-score-threshold=${nms_score_threshold} nms-iou-threshold=${nms_iou_threshold}"

hailonet_props="output-format-type=HAILO_FORMAT_TYPE_FLOAT32"

print_gst_launch_only=false

additional_parameters=""

stats_element=""

debug_stats_export=""

sync_pipeline=false

device_id_prop=""

}

function print_help_if_needed() {

while test $# -gt 0; do

    if [ "$1" = "--help" ] || [ "$1" == "-h" ]; then

        print_usage

    fi



    shift

done

}

function print_usage() {

echo "Detection pipeline usage:"

echo ""

echo "Options:"

echo "  -h --help                  Show this help"

echo "  --network NETWORK          Set network to use. choose from [yolov5, nanodet], default is yolov5"

echo "  -i INPUT --input INPUT     Set the input source (default $input_source)"

echo "  --show-fps                 Print fps"

echo "  --print-gst-launch         Print the ready gst-launch command without running it"

echo "  --print-device-stats       Print the power and temperature measured"

exit 0

}

function parse_args() {

while test $# -gt 0; do

    if [ $1 == "--network" ]; then

        if [ $2 == "nanodet" ]; then

            network_name="nanodet_repvgg"

            hef_path="$RESOURCES_DIR/nanodet_repvgg.hef"

            postprocess_so="$POSTPROCESS_DIR/libnanodet_post.so"

            json_config_path="null"

            thresholds_str=""

            hailonet_props=""

        elif [ $2 != "yolov8" ]; then

            echo "Received invalid network: $2. See expected arguments below:"

            print_usage

            exit 1

        fi

        shift

    elif [ "$1" = "--print-gst-launch" ]; then

        print_gst_launch_only=true

    elif [ "$1" = "--print-device-stats" ]; then

        hailo_bus_id=$(hailortcli scan | awk '{ print $NF }' | tail -n 1)

        device_id_prop="device_id=$hailo_bus_id"

        stats_element="hailodevicestats $device_id_prop"

        debug_stats_export="GST_DEBUG=hailodevicestats:5"

    elif [ "$1" = "--show-fps" ]; then

        echo "Printing fps"

        additional_parameters="-v | grep -e hailo_display -e hailodevicestats"

    elif [ "$1" = "--input" ] || [ "$1" == "-i" ]; then

        input_source="$2"

        shift

    else

        echo "Received invalid argument: $1. See expected arguments below:"

        print_usage

        exit 1

    fi



    shift

done

}

init_variables $@

parse_args $@

If the video provided is from a camera

if [[ $input_source =~ “/dev/video” ]]; then

source_element="v4l2src device=$input_source name=src_0 ! videoflip video-direction=horiz"

else

source_element="filesrc location=$input_source name=src_0 ! decodebin"

fi

PIPELINE="${debug_stats_export} gst-launch-1.0 ${stats_element} \

$source_element ! \

queue leaky=no max-size-buffers=30 max-size-bytes=0 max-size-time=0 ! \

videoscale qos=false n-threads=2 ! video/x-raw, width=1920, height=1080, pixel-aspect-ratio=1/1 ! \

queue leaky=no max-size-buffers=30 max-size-bytes=0 max-size-time=0 ! \

videoconvert n-threads=2 qos=false ! \

queue leaky=no max-size-buffers=30 max-size-bytes=0 max-size-time=0 ! \

hailonet hef-path=$hef_path $device_id_prop batch-size=$batch_size $thresholds_str $hailonet_props ! \

queue leaky=no max-size-buffers=30 max-size-bytes=0 max-size-time=0 ! \

hailofilter function-name=$network_name so-path=$postprocess_so config-path=$json_config_path qos=false ! \

queue leaky=no max-size-buffers=30 max-size-bytes=0 max-size-time=0 ! \

hailooverlay qos=false ! \

queue leaky=no max-size-buffers=30 max-size-bytes=0 max-size-time=0 ! \

videoconvert n-threads=2 qos=false ! \

queue leaky=no max-size-buffers=30 max-size-bytes=0 max-size-time=0 ! \

$video_sink name=hailo_display sync=$sync_pipeline ${additional_parameters}"

echo “Running $network_name”

echo ${PIPELINE}

if [ “$print_gst_launch_only” = true ]; then

exit 0

fi

eval ${PIPELINE}

When you run the above code, an error occurs as follows.

pi@CM3588:~/Downloads/tappas_v3.30.0/apps/h8/gstreamer/rockchip/detection$ ./detection.sh -i /dev/video21 --show-fpsNo XV adaptors found, using ximagesink instead

Printing fps

Running yolov8n

gst-launch-1.0 v4l2src device=/dev/video21 name=src_0 ! videoflip video-direction=horiz ! queue leaky=no max-size-buffers=30 max-size-bytes=0 max-size-time=0 ! videoscale qos=false n-threads=2 ! video/x-raw, width=640, height=480, format=NV12, pixel-aspect-ratio=1/1 ! queue leaky=no max-size-buffers=30 max-size-bytes=0 max-size-time=0 ! videoconvert n-threads=2 qos=false ! video/x-raw, format=RGB ! queue leaky=no max-size-buffers=30 max-size-bytes=0 max-size-time=0 ! hailonet hef-path=/home/pi/Downloads/tappas_v3.30.0/apps/h8/gstreamer/rockchip/detection/resources/yolov8n.hef batch-size=1 nms-score-threshold=0.3 nms-iou-threshold=0.45 output-format-type=HAILO_FORMAT_TYPE_FLOAT32 ! queue leaky=no max-size-buffers=30 max-size-bytes=0 max-size-time=0 ! hailofilter function-name=yolov8n so-path=/home/pi/Downloads/tappas_v3.30.0/apps/h8/gstreamer/libs/post_processes//libyolo_hailortpp_post.so config-path=/home/pi/Downloads/tappas_v3.30.0/apps/h8/gstreamer/rockchip/detection/resources/configs/yolov8.json qos=false ! queue leaky=no max-size-buffers=30 max-size-bytes=0 max-size-time=0 ! hailooverlay qos=false ! queue leaky=no max-size-buffers=30 max-size-bytes=0 max-size-time=0 ! videoconvert n-threads=2 qos=false ! queue leaky=no max-size-buffers=30 max-size-bytes=0 max-size-time=0 ! fpsdisplaysink video-sink=ximagesink text-overlay=false name=hailo_display sync=false -v | grep -e hailo_display -e hailodevicestats

Please give me some advice and steps to take.
WARNING: erroneous pipeline: could not link queue2 to hailonet0

Hey @hcpark

It looks like the GStreamer pipeline error (could not link queue2 to hailonet0) is due to a format or configuration mismatch between elements in the pipeline. Here are some steps you can try to troubleshoot and resolve the issue:

1. Check Video Format Compatibility

  • Make sure the video format from videoconvert matches what hailonet expects. Right before linking to hailonet, you’re setting the format to RGB, but hailonet might require something like NV12 or BGR.
  • If that’s the case, try adjusting the format in the video/x-raw element:
    video/x-raw, format=NV12
    

2. Test Individual Pipeline Elements

  • Run a simpler version of the pipeline to isolate the problem. Start with just the video source, conversion, and display elements:
    gst-launch-1.0 v4l2src device=/dev/video21 ! videoconvert ! ximagesink
    
  • Then, add elements back in one by one (e.g., hailonet, hailofilter) to find where the linking issue starts.

3. Example Minimal Pipeline for Testing

  • Here’s a minimal version of the pipeline that you can use to test compatibility between each element:
    gst-launch-1.0 v4l2src device=/dev/video21 ! videoconvert ! video/x-raw, format=RGB ! \
    hailonet hef-path=$hef_path batch-size=1 output-format-type=HAILO_FORMAT_TYPE_FLOAT32 ! \
    hailofilter function-name=$network_name so-path=$postprocess_so config-path=$json_config_path ! \
    videoconvert ! ximagesink
    

Give these steps a try, and if you’re still stuck, feel free to check the GStreamer logs for more insights. Let me know if you need further help with any of these steps!

Thanks for your reply. Have a nice day.