-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathyolov8_efficientnet_dual.sh
More file actions
executable file
·163 lines (143 loc) · 15 KB
/
yolov8_efficientnet_dual.sh
File metadata and controls
executable file
·163 lines (143 loc) · 15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/bin/bash
#
# Copyright (C) 2023 Intel Corporation.
#
# SPDX-License-Identifier: Apache-2.0
#
cid_count=0
pid_count=0
pid_count2=1
# change pre_process="" if using USB or RealSense cameras
pre_process="pre-process-backend=vaapi-surface-sharing pre-process-config=VAAPI_FAST_SCALE_LOAD_FACTOR=1"
# User configured parameters
if [ -z "$INPUT_TYPE" ]
then
echo "INPUT_TYPE required"
exit
#INPUT_TYPE="FILE_H264"
#INPUT_TYPE="RTSP_H265"
fi
if [ -z "$INPUTSRC" ]
then
echo "INPUTSRC required"
exit
#INPUTSRC="sample-video.mp4 "
#INPUTSRC="rtsp://127.0.0.1:8554/camera_0 "
fi
if [ -z "$INPUT_TYPE2" ]
then
echo "INPUT_TYPE2 required"
exit
#INPUT_TYPE2="FILE_H264"
#INPUT_TYPE2="RTSP_H265"
fi
if [ -z "$INPUTSRC2" ]
then
echo "INPUTSRC2 required"
exit
#INPUTSRC2="sample-video.mp4 "
#INPUTSRC2="rtsp://127.0.0.1:8554/camera_0 "
fi
# Stream 1
if [ "$INPUT_TYPE" == "FILE_H264" ]
then
INPUTSRC="filesrc location=$INPUTSRC ! qtdemux ! h264parse "
elif [ "$INPUT_TYPE" == "RTSP_H264" ]
then
INPUTSRC="$INPUTSRC ! rtph264depay "
elif [ "$INPUT_TYPE" == "FILE_H265" ]
then
INPUTSRC="filesrc location=$INPUTSRC ! qtdemux ! h265parse "
elif [ "$INPUT_TYPE" == "RTSP_H265" ]
then
INPUTSRC="$INPUTSRC ! rtph265depay "
fi
# Stream 2
if [ "$INPUT_TYPE2" == "FILE_H264" ]
then
INPUTSRC2="filesrc location=$INPUTSRC2 ! qtdemux ! h264parse "
elif [ "$INPUT_TYPE2" == "RTSP_H264" ]
then
INPUTSRC2="$INPUTSRC2 ! rtph264depay "
elif [ "$INPUT_TYPE2" == "FILE_H265" ]
then
INPUTSRC2="filesrc location=$INPUTSRC2 ! qtdemux ! h265parse "
elif [ "$INPUT_TYPE2" == "RTSP_H265" ]
then
INPUTSRC2="$INPUTSRC2 ! rtph265depay "
fi
DET_MODEL="models/yolov8/yolov8n-int8.xml"
DET_MODEL_PROC="/home/dlstreamer/dlstreamer_gst/samples/gstreamer/model_proc/public/yolo-v8.json"
RECOG_MODEL="models/efficientnet-b0/1/FP16-INT8/efficientnet-b0.xml"
RECOG_MODEL_PROC="models/efficientnet-b0/1/efficientnet-b0.json"
RECOG_LABELS="models/efficientnet-b0/1/imagenet_2012.txt"
if [ "1" == "$MAX" ]
then
echo "Enabled MAX pipeline "
if [ -z "$DC" ]
then
gst-launch-1.0 \
$INPUTSRC ! vaapidecodebin ! gvadetect model-instance-id=odmodel name=detection reshape=1 reshape-width=416 reshape-height=416 model=$DET_MODEL model-proc=$DET_MODEL_PROC threshold=.5 device=GPU $pre_process ! gvaclassify model-instance-id=clasifier labels=$RECOG_LABELS model=$RECOG_MODEL model-proc=$RECOG_MODEL_PROC device=GPU inference-region=roi-list name=classification $pre_process ! gvametaconvert name=metaconvert add-empty-results=true ! gvametapublish name=destination file-format=2 file-path=/app/dlstreamer/results/r$cid_count.jsonl ! fpsdisplaysink video-sink=fakesink sync=false --verbose \
$INPUTSRC2 ! vaapidecodebin ! gvadetect model-instance-id=odmodel2 name=detection2 reshape=1 reshape-width=416 reshape-height=416 model=$DET_MODEL model-proc=$DET_MODEL_PROC threshold=.5 device=GPU $pre_process ! gvaclassify model-instance-id=clasifier2 labels=$RECOG_LABELS model=$RECOG_MODEL model-proc=$RECOG_MODEL_PROC device=CPU inference-region=roi-list name=classification2 ! gvametaconvert name=metaconvert2 add-empty-results=true ! gvametapublish name=destination2 file-format=2 file-path=/app/dlstreamer/results/r$cid_count2.jsonl ! fpsdisplaysink video-sink=fakesink sync=false --verbose \
2>&1 | tee >/app/dlstreamer/results/gst-launch_core_$cid_count.log >(stdbuf -oL sed -n -e 's/^.*current: //p' | stdbuf -oL cut -d , -f 1 > /app/dlstreamer/results/pipeline$cid_count.log)
else
gst-launch-1.0 \
$INPUTSRC ! vaapidecodebin ! gvadetect model-instance-id=odmodel name=detection reshape=1 reshape-width=416 reshape-height=416 model=$DET_MODEL model-proc=$DET_MODEL_PROC threshold=.5 device=GPU $pre_process ! gvaclassify model-instance-id=clasifier labels=$RECOG_LABELS model=$RECOG_MODEL model-proc=$RECOG_MODEL_PROC device=GPU inference-region=roi-list name=classification $pre_process ! gvametaconvert name=metaconvert add-empty-results=true ! gvametapublish name=destination file-format=2 file-path=/app/dlstreamer/results/r$cid_count.jsonl ! fpsdisplaysink video-sink=fakesink sync=false --verbose \
$INPUTSRC2 ! vaapidecodebin ! gvadetect model-instance-id=odmodel2 name=detection2 reshape=1 reshape-width=416 reshape-height=416 model=$DET_MODEL model-proc=$DET_MODEL_PROC threshold=.5 device=GPU $pre_process ! gvaclassify model-instance-id=clasifier2 labels=$RECOG_LABELS model=$RECOG_MODEL model-proc=$RECOG_MODEL_PROC device=CPU inference-region=roi-list name=classification2 ! gvametaconvert name=metaconvert2 add-empty-results=true ! gvametapublish name=destination2 file-format=2 file-path=/app/dlstreamer/results/r$cid_count2.jsonl ! fpsdisplaysink video-sink=fakesink sync=false --verbose
fi
elif [ "1" == "$LOW_POWER" ]
then
echo "Enabled GPU based low power pipeline "
if [ -z "$DC" ]
then
gst-launch-1.0 \
$INPUTSRC ! vaapidecodebin ! gvadetect model-instance-id=odmodel name=detection reshape=1 reshape-width=416 reshape-height=416 model=$DET_MODEL model-proc=$DET_MODEL_PROC threshold=.5 device=GPU $pre_process ! gvaclassify model-instance-id=clasifier labels=$RECOG_LABELS model=$RECOG_MODEL model-proc=$RECOG_MODEL_PROC device=GPU inference-region=roi-list name=classification $pre_process ! gvametaconvert name=metaconvert add-empty-results=true ! gvametapublish name=destination file-format=2 file-path=/app/dlstreamer/results/r$cid_count.jsonl ! fpsdisplaysink video-sink=fakesink sync=false --verbose \
$INPUTSRC2 ! vaapidecodebin ! gvadetect model-instance-id=odmodel2 name=detection2 reshape=1 reshape-width=416 reshape-height=416 model=$DET_MODEL model-proc=$DET_MODEL_PROC threshold=.5 device=GPU $pre_process ! gvaclassify model-instance-id=clasifier2 labels=$RECOG_LABELS model=$RECOG_MODEL model-proc=$RECOG_MODEL_PROC device=GPU inference-region=roi-list name=classification2 $pre_process ! gvametaconvert name=metaconvert2 add-empty-results=true ! gvametapublish name=destination2 file-format=2 file-path=/app/dlstreamer/results/r$cid_count2.jsonl ! fpsdisplaysink video-sink=fakesink sync=false --verbose \
2>&1 | tee >/app/dlstreamer/results/gst-launch_core_$cid_count.log >(stdbuf -oL sed -n -e 's/^.*current: //p' | stdbuf -oL cut -d , -f 1 > /app/dlstreamer/results/pipeline$cid_count.log)
else
gst-launch-1.0 \
$INPUTSRC ! vaapidecodebin ! gvadetect model-instance-id=odmodel name=detection reshape=1 reshape-width=416 reshape-height=416 model=$DET_MODEL model-proc=$DET_MODEL_PROC threshold=.5 device=GPU $pre_process ! gvaclassify model-instance-id=clasifier labels=$RECOG_LABELS model=$RECOG_MODEL model-proc=$RECOG_MODEL_PROC device=GPU inference-region=roi-list name=classification $pre_process ! gvametaconvert name=metaconvert add-empty-results=true ! gvametapublish name=destination file-format=2 file-path=/app/dlstreamer/results/r$cid_count.jsonl ! fpsdisplaysink video-sink=fakesink sync=false --verbose \
$INPUTSRC2 ! vaapidecodebin ! gvadetect model-instance-id=odmodel2 name=detection2 reshape=1 reshape-width=416 reshape-height=416 model=$DET_MODEL model-proc=$DET_MODEL_PROC threshold=.5 device=GPU $pre_process ! gvaclassify model-instance-id=clasifier2 labels=$RECOG_LABELS model=$RECOG_MODEL model-proc=$RECOG_MODEL_PROC device=GPU inference-region=roi-list name=classification2 $pre_process ! gvametaconvert name=metaconvert2 add-empty-results=true ! gvametapublish name=destination2 file-format=2 file-path=/app/dlstreamer/results/r$cid_count2.jsonl ! fpsdisplaysink video-sink=fakesink sync=false --verbose
fi
elif [ "$RENDER_MODE" == "1" ]
then
echo "Launching rendered pipeline"
if [ -z "$DC" ]
then
gst-launch-1.0 \
$INPUTSRC ! vaapidecodebin ! gvadetect model-instance-id=odmodel name=detection reshape=1 reshape-width=416 reshape-height=416 model=$DET_MODEL model-proc=$DET_MODEL_PROC threshold=.5 device=GPU $pre_process ! gvaclassify model-instance-id=clasifier labels=$RECOG_LABELS model=$RECOG_MODEL model-proc=$RECOG_MODEL_PROC device=GPU inference-region=roi-list name=classification $pre_process ! gvametaconvert name=metaconvert add-empty-results=true ! vaapipostproc ! gvawatermark ! videoconvert ! fpsdisplaysink video-sink=autovideosink sync=false --verbose \
$INPUTSRC2 ! vaapidecodebin ! gvadetect model-instance-id=odmodel2 name=detection2 reshape=1 reshape-width=416 reshape-height=416 model=$DET_MODEL model-proc=$DET_MODEL_PROC threshold=.5 device=GPU $pre_process ! gvaclassify model-instance-id=clasifier2 labels=$RECOG_LABELS model=$RECOG_MODEL model-proc=$RECOG_MODEL_PROC device=GPU inference-region=roi-list name=classification2 $pre_process ! gvametaconvert name=metaconvert2 add-empty-results=true ! vaapipostproc ! gvawatermark ! videoconvert ! fpsdisplaysink video-sink=autovideosink sync=false --verbose \
2>&1 | tee >/app/dlstreamer/results/gst-launch_core_$cid_count.log >(stdbuf -oL sed -n -e 's/^.*current: //p' | stdbuf -oL cut -d , -f 1 > /app/dlstreamer/results/pipeline$cid_count.log)
else
gst-launch-1.0 \
$INPUTSRC ! vaapidecodebin ! gvadetect model-instance-id=odmodel name=detection reshape=1 reshape-width=416 reshape-height=416 model=$DET_MODEL model-proc=$DET_MODEL_PROC threshold=.5 device=GPU $pre_process ! gvaclassify model-instance-id=clasifier labels=$RECOG_LABELS model=$RECOG_MODEL model-proc=$RECOG_MODEL_PROC device=GPU inference-region=roi-list name=classification $pre_process ! gvametaconvert name=metaconvert add-empty-results=true ! vaapipostproc ! gvawatermark ! videoconvert ! fpsdisplaysink video-sink=autovideosink sync=false --verbose \
$INPUTSRC2 ! vaapidecodebin ! gvadetect model-instance-id=odmodel2 name=detection2 reshape=1 reshape-width=416 reshape-height=416 model=$DET_MODEL model-proc=$DET_MODEL_PROC threshold=.5 device=GPU $pre_process ! gvaclassify model-instance-id=clasifier2 labels=$RECOG_LABELS model=$RECOG_MODEL model-proc=$RECOG_MODEL_PROC device=GPU inference-region=roi-list name=classification2 $pre_process ! gvametaconvert name=metaconvert2 add-empty-results=true ! vaapipostproc ! gvawatermark ! videoconvert ! fpsdisplaysink video-sink=autovideosink sync=false --verbose
fi
elif [ "$CPU_ONLY" == "1" ]
then
echo "Enabled CPU inference pipeline only"
if [ -z "$DC" ]
then
gst-launch-1.0 \
$INPUTSRC ! decodebin force-sw-decoders=1 ! gvadetect model-instance-id=odmodel name=detection reshape=1 reshape-width=416 reshape-height=416 model=$DET_MODEL model-proc=$DET_MODEL_PROC threshold=.5 device=CPU ! gvaclassify model-instance-id=clasifier labels=$RECOG_LABELS model=$RECOG_MODEL model-proc=$RECOG_MODEL_PROC device=CPU inference-region=roi-list name=classification ! gvametaconvert name=metaconvert add-empty-results=true ! gvametapublish name=destination file-format=2 file-path=/app/dlstreamer/results/r$pid_count.jsonl ! fpsdisplaysink video-sink=fakesink sync=false --verbose \
$INPUTSRC2 ! decodebin force-sw-decoders=1 ! gvadetect model-instance-id=odmodel2 name=detection2 reshape=1 reshape-width=416 reshape-height=416 model=$DET_MODEL model-proc=$DET_MODEL_PROC threshold=.5 device=CPU ! gvaclassify model-instance-id=clasifier2 labels=$RECOG_LABELS model=$RECOG_MODEL model-proc=$RECOG_MODEL_PROC device=CPU inference-region=roi-list name=classification2 ! gvametaconvert name=metaconvert2 add-empty-results=true ! gvametapublish name=destination2 file-format=2 file-path=/app/dlstreamer/results/r$pid_count2.jsonl ! fpsdisplaysink video-sink=fakesink sync=false --verbose \
2>&1 | tee >/app/dlstreamer/results/gst-launch_core_$cid_count.log >(stdbuf -oL sed -n -e 's/^.*current: //p' | stdbuf -oL cut -d , -f 1 > /app/dlstreamer/results/pipeline$cid_count.log)
else
gst-launch-1.0 \
$INPUTSRC ! decodebin force-sw-decoders=1 ! gvadetect model-instance-id=odmodel name=detection reshape=1 reshape-width=416 reshape-height=416 model=$DET_MODEL model-proc=$DET_MODEL_PROC threshold=.5 device=CPU ! gvaclassify model-instance-id=clasifier labels=$RECOG_LABELS model=$RECOG_MODEL model-proc=$RECOG_MODEL_PROC device=CPU inference-region=roi-list name=classification ! gvametaconvert name=metaconvert add-empty-results=true ! gvametapublish name=destination file-format=2 file-path=/app/dlstreamer/results/r$pid_count.jsonl ! fpsdisplaysink video-sink=fakesink sync=false --verbose \
$INPUTSRC2 ! decodebin force-sw-decoders=1 ! gvadetect model-instance-id=odmodel2 name=detection2 reshape=1 reshape-width=416 reshape-height=416 model=$DET_MODEL model-proc=$DET_MODEL_PROC threshold=.5 device=CPU ! gvaclassify model-instance-id=clasifier2 labels=$RECOG_LABELS model=$RECOG_MODEL model-proc=$RECOG_MODEL_PROC device=CPU inference-region=roi-list name=classification2 ! gvametaconvert name=metaconvert2 add-empty-results=true ! gvametapublish name=destination2 file-format=2 file-path=/app/dlstreamer/results/r$pid_count2.jsonl ! fpsdisplaysink video-sink=fakesink sync=false --verbose
fi
else
echo "Enabled CPU+iGPU pipeline"
if [ -z "$DC" ]
then
gst-launch-1.0 \
$INPUTSRC ! vaapidecodebin ! gvadetect model-instance-id=odmodel name=detection reshape=1 reshape-width=416 reshape-height=416 model=$DET_MODEL model-proc=$DET_MODEL_PROC threshold=.5 device=GPU $pre_process ! gvaclassify model-instance-id=clasifier labels=$RECOG_LABELS model=$RECOG_MODEL model-proc=$RECOG_MODEL_PROC device=CPU inference-region=roi-list name=classification $pre_process ! gvametaconvert name=metaconvert add-empty-results=true ! vaapipostproc ! gvawatermark ! videoconvert ! fpsdisplaysink video-sink=autovideosink sync=false --verbose \
$INPUTSRC2 ! vaapidecodebin ! gvadetect model-instance-id=odmodel2 name=detection2 reshape=1 reshape-width=416 reshape-height=416 model=$DET_MODEL model-proc=$DET_MODEL_PROC threshold=.5 device=GPU $pre_process ! gvaclassify model-instance-id=clasifier2 labels=$RECOG_LABELS model=$RECOG_MODEL model-proc=$RECOG_MODEL_PROC device=CPU inference-region=roi-list name=classification2 $pre_process ! gvametaconvert name=metaconvert2 add-empty-results=true ! vaapipostproc ! gvawatermark ! videoconvert ! fpsdisplaysink video-sink=autovideosink sync=false --verbose \
2>&1 | tee >/app/dlstreamer/results/gst-launch_core_$cid_count.log >(stdbuf -oL sed -n -e 's/^.*current: //p' | stdbuf -oL cut -d , -f 1 > /app/dlstreamer/results/pipeline$cid_count.log)
else
gst-launch-1.0 \
$INPUTSRC ! vaapidecodebin ! gvadetect model-instance-id=odmodel name=detection reshape=1 reshape-width=416 reshape-height=416 model=$DET_MODEL model-proc=$DET_MODEL_PROC threshold=.5 device=GPU $pre_process ! gvaclassify model-instance-id=clasifier labels=$RECOG_LABELS model=$RECOG_MODEL model-proc=$RECOG_MODEL_PROC device=CPU inference-region=roi-list name=classification $pre_process ! gvametaconvert name=metaconvert add-empty-results=true ! vaapipostproc ! gvawatermark ! videoconvert ! fpsdisplaysink video-sink=autovideosink sync=false --verbose \
$INPUTSRC2 ! vaapidecodebin ! gvadetect model-instance-id=odmodel2 name=detection2 reshape=1 reshape-width=416 reshape-height=416 model=$DET_MODEL model-proc=$DET_MODEL_PROC threshold=.5 device=GPU $pre_process ! gvaclassify model-instance-id=clasifier2 labels=$RECOG_LABELS model=$RECOG_MODEL model-proc=$RECOG_MODEL_PROC device=CPU inference-region=roi-list name=classification2 $pre_process ! gvametaconvert name=metaconvert2 add-empty-results=true ! vaapipostproc ! gvawatermark ! videoconvert ! fpsdisplaysink video-sink=autovideosink sync=false --verbose
fi
fi