This patch adds tests for dimension declaration.
Related issue #3937
Signed-off-by: Yelin Jeong <yelini.jeong@samsung.com>
gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} multifilesrc location=\"testsequence_%1d.png\" index=0 caps=\"image/png,framerate=\(fraction\)30/1\" ! pngdec ! videoconvert ! tensor_converter ! filesink location=\"testcase08.log\"" 6-1 0 0 $PERFORMANCE
callCompareTest testcase08.golden testcase08.log 6-2 "PNG Stream Test" 0 0
+# Dimension declaration test cases
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} videotestsrc num-buffers=1 ! videoscale ! videoconvert ! video/x-raw,format=RGB,framerate=30/1,height=300,width=300 ! tensor_converter ! other/tensor,dimension=3:300:300,types=uint8,framerate=30/1,format=static ! fakesink" 7-1 0 0 $PERFORMANCE
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} videotestsrc num-buffers=1 ! videoscale ! videoconvert ! video/x-raw,format=RGB,framerate=30/1,height=300,width=300 ! tensor_converter ! other/tensors,num_tensors=1,dimension=3:300:300,types=uint8,framerate=30/1,format=static ! fakesink" 7-2 0 0 $PERFORMANCE
+
rm *.log *.bmp *.png *.golden
report
## transform after filter specifying format as static
gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} videotestsrc num-buffers=2 ! videoscale ! videoconvert ! video/x-raw,width=3,height=4,format=GRAY8,framerate=0/1 ! tensor_converter ! tensor_transform mode=transpose option=2:1:0:3 ! other/tensors,num_tensors=1,dimensions=4:3:1:1,types=uint8,format=static,framerate=0/1 ! tensor_transform mode=typecast option=float32 ! tee name=t t. ! queue ! mux.sink_0 t. ! queue ! mux.sink_1 tensor_mux name=mux sync_mode=nosync ! queue ! tensor_filter framework=pytorch model=${PATH_TO_MODEL} input=4:3:1:1.4:3:1:1 inputtype=float32.float32 output=4:3:1:1.4:3:1:1 outputtype=float32.float32 ! other/tensors,format=static ! tensor_transform mode=typecast option=uint8 ! filesink location=tensorfilter.out.log" 9 0 0 $PERFORMANCE
+## Dimension declaration test cases
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} videotestsrc num-buffers=2 ! videoscale ! videoconvert ! video/x-raw,width=3,height=4,format=GRAY8,framerate=0/1 ! tensor_converter ! tensor_transform mode=transpose option=2:1:0:3 ! other/tensors,num_tensors=1,dimensions=4:3:1:1,types=uint8,format=static,framerate=0/1 ! tensor_transform mode=typecast option=float32 ! tee name=t t. ! queue ! mux.sink_0 t. ! queue ! mux.sink_1 tensor_mux name=mux sync_mode=nosync ! queue ! tensor_filter framework=pytorch model=${PATH_TO_MODEL} input=4:3:1:1.4:3:1:1 inputtype=float32.float32 output=4:3:1:1.4:3:1:1 outputtype=float32.float32 ! other/tensors,num_tensors=2,dimensions=4:3:1.4:3:1 ! filesink location=tensorfilter.out.log" 10-1 0 0 $PERFORMANCE
+
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} videotestsrc num-buffers=2 ! videoscale ! videoconvert ! video/x-raw,width=3,height=4,format=GRAY8,framerate=0/1 ! tensor_converter ! tensor_transform mode=transpose option=2:1:0:3 ! other/tensors,num_tensors=1,dimensions=4:3:1:1,types=uint8,format=static,framerate=0/1 ! tensor_transform mode=typecast option=float32 ! tee name=t t. ! queue ! mux.sink_0 t. ! queue ! mux.sink_1 tensor_mux name=mux sync_mode=nosync ! queue ! tensor_filter framework=pytorch model=${PATH_TO_MODEL} input=4:3:1:1.4:3:1:1 inputtype=float32.float32 output=4:3:1:1.4:3:1:1 outputtype=float32.float32 ! other/tensors,num_tensors=2,dimensions=4:3.4:3 ! filesink location=tensorfilter.out.log" 10-2 0 0 $PERFORMANCE
+
# Cleanup
rm info *.log *.golden
cat info | grep "accl = ${auto_accl}$"
testResult $? 2-17 "accelerator set test" 0 1
+# Dimension declaration test cases
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=${PATH_TO_IMAGE} ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=RGB,framerate=0/1 ! tensor_converter ! tensor_filter framework=tensorflow2-lite model=${PATH_TO_MODEL} ! \"other/tensors,num_tensors=1,dimensions=1001:1:1\" !filesink location=tensorfilter.out.log" 3 0 0 $PERFORMANCE
+python3 checkLabel.py tensorfilter.out.log ${PATH_TO_LABEL} orange
+testResult $? 3 "Golden test comparison" 0 1
+
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=${PATH_TO_IMAGE} ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=RGB,framerate=0/1 ! tensor_converter ! tensor_filter framework=tensorflow2-lite model=${PATH_TO_MODEL} ! \"other/tensors,num_tensors=1,dimensions=(string)1001:1\" !filesink location=tensorfilter.out.log" 4 0 0 $PERFORMANCE
+python3 checkLabel.py tensorfilter.out.log ${PATH_TO_LABEL} orange
+testResult $? 4 "Golden test comparison" 0 1
+
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=${PATH_TO_IMAGE} ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=RGB,framerate=0/1 ! tensor_converter ! tensor_filter framework=tensorflow2-lite model=${PATH_TO_MODEL} ! \"other/tensors,num_tensors=1,dimensions=(string)1001\" !filesink location=tensorfilter.out.log" 5 0 0 $PERFORMANCE
+python3 checkLabel.py tensorfilter.out.log ${PATH_TO_LABEL} orange
+testResult $? 5 "Golden test comparison" 0 1
+
# Cleanup
rm info *.log
cat info | grep "accl = gpu$"
testResult $? 2-18 "accelerator set test" 0 1
+# Dimension declaration test cases
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=${PATH_TO_IMAGE} ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=RGB,framerate=0/1 ! tensor_converter ! tensor_filter framework=tensorflow1-lite model=${PATH_TO_MODEL} ! \"other/tensors,num_tensors=1,dimensions=1001:1:1\" ! filesink location=tensorfilter.out.log" 3 0 0 $PERFORMANCE
+python3 checkLabel.py tensorfilter.out.log ${PATH_TO_LABEL} orange
+testResult $? 3 "Golden test comparison" 0 1
+
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=${PATH_TO_IMAGE} ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=RGB,framerate=0/1 ! tensor_converter ! tensor_filter framework=tensorflow1-lite model=${PATH_TO_MODEL} ! \"other/tensors,num_tensors=1,dimensions=(string)1001:1\" ! filesink location=tensorfilter.out.log" 4 0 0 $PERFORMANCE
+python3 checkLabel.py tensorfilter.out.log ${PATH_TO_LABEL} orange
+testResult $? 4 "Golden test comparison" 0 1
+
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=${PATH_TO_IMAGE} ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=RGB,framerate=0/1 ! tensor_converter ! tensor_filter framework=tensorflow1-lite model=${PATH_TO_MODEL} ! \"other/tensors,num_tensors=1,dimensions=(string)1001\" ! filesink location=tensorfilter.out.log" 5 0 0 $PERFORMANCE
+python3 checkLabel.py tensorfilter.out.log ${PATH_TO_LABEL} orange
+testResult $? 5 "Golden test comparison" 0 1
+
# Cleanup
rm info *.log *.golden
callCompareTest testsequence_9.golden testsequence03_2_9.log 3-29 "Compare 3-29" 1 0
callCompareTest testsequence_10.golden testsequence03_2_10.log 3-30 "Compare 3-30" 1 0
+# Dimension declaration test case
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} multifilesrc location=testsequence_%1d.png index=0 caps=\"image/png,framerate=(fraction)3/1\" ! pngdec ! tensor_converter ! queue ! tensor_reposink silent=false slot-index=0 tensor_reposrc silent=false slot-index=0 caps=\"other/tensor,dimension=(string)3:16:16,type=(string)uint8,framerate=(fraction)3/1\" ! multifilesink location=testsequence04_%1d.log" 4 0 0 $PERFORMANCE
+
+callCompareTest testsequence_1.golden testsequence04_1.log 4-1 "Compare 4-1" 1 0
+callCompareTest testsequence_2.golden testsequence04_2.log 4-2 "Compare 4-2" 1 0
+callCompareTest testsequence_3.golden testsequence04_3.log 4-3 "Compare 4-3" 1 0
+callCompareTest testsequence_4.golden testsequence04_4.log 4-4 "Compare 4-4" 1 0
+callCompareTest testsequence_5.golden testsequence04_5.log 4-5 "Compare 4-5" 1 0
+callCompareTest testsequence_6.golden testsequence04_6.log 4-6 "Compare 4-6" 1 0
+callCompareTest testsequence_7.golden testsequence04_7.log 4-7 "Compare 4-7" 1 0
+callCompareTest testsequence_8.golden testsequence04_8.log 4-8 "Compare 4-8" 1 0
+callCompareTest testsequence_9.golden testsequence04_9.log 4-9 "Compare 4-9" 1 0
+callCompareTest testsequence_10.golden testsequence04_10.log 4-10 "Compare 4-10" 1 0
+
rm *.log *.bmp *.png *.golden *.raw *.dat
report
callCompareTest test03_00.dat.golden result04_1_00.log 3 "Compare 3" 1 0
callCompareTest test03_00.dat.golden result04_2_00.log 3 "Compare 3" 1 0
+# Dimension declaration test cases
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} multifilesrc location=\"test01_%02d.dat\" caps=\"application/octet-stream\" ! tensor_converter input-dim=100:50:3:1 input-type=float32 ! tensor_transform mode=transpose option=2:0:1:3 ! other/tensor,dimension=3:100:50 ! multifilesink location=\"./result05_%02d.log\" sync=true" 5 0 0 $PERFORMANCE
+
+callCompareTest test01_00.dat.golden result05_00.log 5 "Compare 5" 1 0
+
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} multifilesrc location=\"test01_%02d.dat\" caps=\"application/octet-stream\" ! tensor_converter input-dim=100:50:3:1 input-type=float32 ! tensor_transform mode=transpose option=2:0:1:3 ! other/tensors,num_tensors=1,dimensions=3:100:50 ! multifilesink location=\"./result06_%02d.log\" sync=true" 6 0 0 $PERFORMANCE
+
+callCompareTest test01_00.dat.golden result06_00.log 6 "Compare 6" 1 0
+
rm *.log *.bmp *.png *.golden *.raw *.dat
report
gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} videotestsrc num-buffers=3 ! video/x-raw,format=RGB,width=4,height=4 ! tensor_converter ! tensor_transform mode=typecast option=float16 ! other/tensors,num_tensors=1,types=uint8 ! fakesink" 19_n 0 1 $PERFORMANCE
+# Dimension declaration test case
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} videotestsrc num-buffers=3 ! video/x-raw,format=RGB,width=4,height=4 ! tensor_converter ! tensor_transform mode=typecast option=float32 ! other/tensors,num_tensors=1,types=float32,dimensions=3:4:4 ! fakesink" 20-1 0 0 $PERFORMANCE
+
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} videotestsrc num-buffers=3 ! video/x-raw,format=RGB,width=4,height=4 ! tensor_converter ! tensor_transform mode=typecast option=float32 ! other/tensor,types=float32,dimensions=3:4:4 ! fakesink" 20-2 0 0 $PERFORMANCE
+
rm *.log *.bmp *.png *.golden *.raw *.dat
report