From f6847475ba2f4970eb24d0d7e13bb7fd721b9e41 Mon Sep 17 00:00:00 2001 From: Jaeyun Date: Fri, 23 Nov 2018 13:54:22 +0900 Subject: [PATCH] [Example] update arithmetic for normalization update arith mode in tensor-transform to normalize Signed-off-by: Jaeyun Jung --- .../example_object_detection/gst-launch-object-detection.sh | 2 +- .../example_object_detection/nnstreamer_example_object_detection.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nnstreamer_example/example_object_detection/gst-launch-object-detection.sh b/nnstreamer_example/example_object_detection/gst-launch-object-detection.sh index 2b2256f..23431a2 100755 --- a/nnstreamer_example/example_object_detection/gst-launch-object-detection.sh +++ b/nnstreamer_example/example_object_detection/gst-launch-object-detection.sh @@ -2,7 +2,7 @@ gst-launch-1.0 \ v4l2src name=cam_src ! videoscale ! videoconvert ! video/x-raw,width=640,height=480,format=RGB,framerate=30/1 ! tee name=t \ t. ! queue leaky=2 max-size-buffers=2 ! videoscale ! video/x-raw,width=300,height=300,format=RGB ! tensor_converter ! \ - tensor_transform mode=arithmetic option=typecast:float32,add:-127,mul:0.007843 ! \ + tensor_transform mode=arithmetic option=typecast:float32,add:-127.5,div:127.5 ! \ tensor_filter framework=tensorflow-lite model=ssd_mobilenet_v2_coco.tflite ! \ tensor_decoder mode=bounding_boxes option1=ssd option2=coco_labels_list.txt option3=box_priors.txt option4=640:480 option5=300:300 ! \ compositor name=mix sink_0::zorder=2 sink_1::zorder=1 ! videoconvert ! ximagesink \ diff --git a/nnstreamer_example/example_object_detection/nnstreamer_example_object_detection.cc b/nnstreamer_example/example_object_detection/nnstreamer_example_object_detection.cc index 3fdcef7..d51e7a6 100644 --- a/nnstreamer_example/example_object_detection/nnstreamer_example_object_detection.cc +++ b/nnstreamer_example/example_object_detection/nnstreamer_example_object_detection.cc @@ -674,7 +674,7 @@ main (int argc, char ** argv) "video/x-raw,width=%d,height=%d,format=RGB ! tee name=t_raw " "t_raw. ! queue ! videoconvert ! cairooverlay name=tensor_res ! ximagesink name=img_tensor " "t_raw. ! queue leaky=2 max-size-buffers=2 ! videoscale ! video/x-raw,width=%d,height=%d ! tensor_converter ! " - "tensor_transform mode=arithmetic option=typecast:float32,add:-127,mul:0.007843 ! " + "tensor_transform mode=arithmetic option=typecast:float32,add:-127.5,div:127.5 ! " "tensor_filter framework=tensorflow-lite model=%s ! " "tensor_sink name=tensor_sink", VIDEO_WIDTH, VIDEO_HEIGHT, MODEL_WIDTH, MODEL_HEIGHT, -- 2.7.4