GstInference/Example pipelines with hierarchical metadata/PC
Tensorflow
Inceptionv1
Image file
- Get the graph used on this example from this link
- You will need a image file from one of ImageNet classes
- Pipeline
IMAGE_FILE=cat.jpg MODEL_LOCATION='graph_inceptionv1_tensorflow.pb' INPUT_LAYER='input' OUTPUT_LAYER='InceptionV1/Logits/Predictions/Reshape_1' LABELS='imagenet_labels.txt' GST_DEBUG=inceptionv1:6 gst-launch-1.0 \ multifilesrc location=$IMAGE_FILE start-index=0 stop-index=0 loop=true ! jpegparse ! jpegdec ! videoconvert ! videoscale ! queue ! net.sink_model \ inceptionv1 name=net model-location=$MODEL_LOCATION labels=$(cat $LABELS) backend=tensorflow backend::input-layer=$INPUT_LAYER backend::output-layer=$OUTPUT_LAYER
- Output
0:00:00.626529976 6700 0x55a306b258a0 LOG inceptionv1 gstinceptionv1.c:150:gst_inceptionv1_preprocess:<net> Preprocess 0:00:00.643145025 6700 0x55a306b258a0 LOG inceptionv1 gstinceptionv1.c:162:gst_inceptionv1_postprocess_old:<net> Postprocess 0:00:00.643180120 6700 0x55a306b258a0 LOG inceptionv1 gstinferencedebug.c:74:gst_inference_print_highest_probability:<net> Highest probability is label 3804 : (4.191162) 0:00:00.643186095 6700 0x55a306b258a0 LOG inceptionv1 gstinceptionv1.c:187:gst_inceptionv1_postprocess_new:<net> Postprocess Meta 0:00:00.643211153 6700 0x55a306b258a0 LOG inceptionv1 gstinferencedebug.c:111:gst_inference_print_predictions: { id : 7, enabled : True, bbox : { x : 0 y : 0 width : 224 height : 224 }, classes : [ { Id : 14 Class : 3804 Label : (null) Probability : 4.191162 Classes : 4004 }, ], predictions : [ ] }
Video file
- Get the graph used on this example from this link
- You will need a video file from one of ImageNet classes
- Pipeline
VIDEO_FILE='cat.mp4' MODEL_LOCATION='graph_inceptionv1_tensorflow.pb' INPUT_LAYER='input' OUTPUT_LAYER='InceptionV1/Logits/Predictions/Reshape_1' LABELS='imagenet_labels.txt' GST_DEBUG=inceptionv1:6 gst-launch-1.0 \ filesrc location=$VIDEO_FILE ! decodebin ! videoconvert ! videoscale ! queue ! net.sink_model \ inceptionv1 name=net model-location=$MODEL_LOCATION labels=$(cat $LABELS) backend=tensorflow backend::input-layer=$INPUT_LAYER backend::output-layer=$OUTPUT_LAYER
- Output
0:00:00.881389256 6700 0x55a306b258a0 LOG inceptionv1 gstinceptionv1.c:150:gst_inceptionv1_preprocess:<net> Preprocess 0:00:00.898481750 6700 0x55a306b258a0 LOG inceptionv1 gstinceptionv1.c:162:gst_inceptionv1_postprocess_old:<net> Postprocess 0:00:00.898515118 6700 0x55a306b258a0 LOG inceptionv1 gstinferencedebug.c:74:gst_inference_print_highest_probability:<net> Highest probability is label 1016 : (4.182041) 0:00:00.898521200 6700 0x55a306b258a0 LOG inceptionv1 gstinceptionv1.c:187:gst_inceptionv1_postprocess_new:<net> Postprocess Meta 0:00:00.898546079 6700 0x55a306b258a0 LOG inceptionv1 gstinferencedebug.c:111:gst_inference_print_predictions: { id : 22, enabled : True, bbox : { x : 0 y : 0 width : 224 height : 224 }, classes : [ { Id : 44 Class : 1016 Label : (null) Probability : 4.182041 Classes : 4004 }, ], predictions : [ ] }
Camera stream
- Get the graph used on this example from this link
- You will need a v4l2 compatible camera
- Pipeline
CAMERA='/dev/video0' MODEL_LOCATION='graph_inceptionv1_tensorflow.pb' INPUT_LAYER='input' OUTPUT_LAYER='InceptionV1/Logits/Predictions/Reshape_1' LABELS='imagenet_labels.txt' GST_DEBUG=inceptionv1:6 gst-launch-1.0 \ v4l2src device=$CAMERA ! videoconvert ! videoscale ! queue ! net.sink_model \ inceptionv1 name=net model-location=$MODEL_LOCATION labels=$(cat $LABELS) backend=tensorflow backend::input-layer=$INPUT_LAYER backend::output-layer=$OUTPUT_LAYER
- Output
0:00:03.858432794 6899 0x558a68bf0e80 LOG inceptionv1 gstinceptionv1.c:150:gst_inceptionv1_preprocess:<net> Preprocess 0:00:03.875012119 6899 0x558a68bf0e80 LOG inceptionv1 gstinceptionv1.c:162:gst_inceptionv1_postprocess_old:<net> Postprocess 0:00:03.875053519 6899 0x558a68bf0e80 LOG inceptionv1 gstinferencedebug.c:74:gst_inference_print_highest_probability:<net> Highest probability is label 3022 : (9897291000005358165649701398904832.000000) 0:00:03.875061545 6899 0x558a68bf0e80 LOG inceptionv1 gstinceptionv1.c:187:gst_inceptionv1_postprocess_new:<net> Postprocess Meta 0:00:03.875089371 6899 0x558a68bf0e80 LOG inceptionv1 gstinferencedebug.c:111:gst_inference_print_predictions: { id : 93, enabled : True, bbox : { x : 0 y : 0 width : 224 height : 224 }, classes : [ { Id : 186 Class : 3022 Label : (null) Probability : 9897291000005358165649701398904832.000000 Classes : 4004 }, ], predictions : [ ] }
Visualization with inference overlay
- Get the graph used on this example from this link
- You will need a v4l2 compatible camera
- Pipeline
CAMERA='/dev/video0' MODEL_LOCATION='graph_inceptionv1_tensorflow.pb' INPUT_LAYER='input' OUTPUT_LAYER='InceptionV1/Logits/Predictions/Reshape_1' LABELS='imagenet_labels.txt' gst-launch-1.0 \ v4l2src device=$CAMERA ! "video/x-raw, width=1280, height=720" ! videoconvert ! tee name=t \ t. ! videoscale ! queue ! net.sink_model \ t. ! queue ! net.sink_bypass \ inceptionv1 name=net model-location=$MODEL_LOCATION labels=$(cat $LABELS) backend=tensorflow backend::input-layer=$INPUT_LAYER backend::output-layer=$OUTPUT_LAYER \ net.src_bypass ! inferenceoverlay ! videoconvert ! queue ! xvimagesink async=false sync=false qos=false
Inceptionv2
Image file
- Get the graph used on this example from this link
- You will need a image file from one of ImageNet classes
- Pipeline
IMAGE_FILE=cat.jpg MODEL_LOCATION='graph_inceptionv2_tensorflow.pb' INPUT_LAYER='input' OUTPUT_LAYER='Softmax' GST_DEBUG=inceptionv2:6 gst-launch-1.0 \ multifilesrc location=$IMAGE_FILE start-index=0 stop-index=0 loop=true ! jpegparse ! jpegdec ! videoconvert ! videoscale ! videorate ! queue ! net.sink_model \ inceptionv2 name=net model-location=$MODEL_LOCATION backend=tensorflow backend::input-layer=$INPUT_LAYER backend::output-layer=$OUTPUT_LAYER
- Output
0:00:01.167111306 12853 0x55bc0eeb9770 LOG inceptionv2 gstinceptionv2.c:217:gst_inceptionv2_preprocess:<net> Preprocess 0:00:01.190633209 12853 0x55bc0eeb9770 LOG inceptionv2 gstinceptionv2.c:229:gst_inceptionv2_postprocess_old:<net> Postprocess 0:00:01.190667056 12853 0x55bc0eeb9770 LOG inceptionv2 gstinferencedebug.c:74:gst_inference_print_highest_probability:<net> Highest probability is label 2058 : (33799702613643740784668592694586507264.000000) 0:00:01.190673102 12853 0x55bc0eeb9770 LOG inceptionv2 gstinceptionv2.c:254:gst_inceptionv2_postprocess_new:<net> Postprocess Meta 0:00:01.190699590 12853 0x55bc0eeb9770 LOG inceptionv2 gstinferencedebug.c:111:gst_inference_print_predictions: { id : 23, enabled : True, bbox : { x : 0 y : 0 width : 224 height : 224 }, classes : [ { Id : 46 Class : 2058 Label : (null) Probability : 33799702613643740784668592694586507264.000000 Classes : 4004 }, ], predictions : [ ] }
Video file
- Get the graph used on this example from this link
- You will need a video file from one of ImageNet classes
- Pipeline
VIDEO_FILE='cat.mp4' MODEL_LOCATION='graph_inceptionv2_tensorflow.pb' INPUT_LAYER='input' OUTPUT_LAYER='Softmax' LABELS='imagenet_labels.txt' GST_DEBUG=inceptionv2:6 gst-launch-1.0 \ filesrc location=$VIDEO_FILE ! decodebin ! videoconvert ! videoscale ! queue ! net.sink_model \ inceptionv2 name=net model-location=$MODEL_LOCATION labels=$(cat $LABELS) backend=tensorflow backend::input-layer=$INPUT_LAYER backend::output-layer=$OUTPUT_LAYER
- Output
0:00:01.167111306 12853 0x55bc0eeb9770 LOG inceptionv2 gstinceptionv2.c:217:gst_inceptionv2_preprocess:<net> Preprocess 0:00:01.190633209 12853 0x55bc0eeb9770 LOG inceptionv2 gstinceptionv2.c:229:gst_inceptionv2_postprocess_old:<net> Postprocess 0:00:01.190667056 12853 0x55bc0eeb9770 LOG inceptionv2 gstinferencedebug.c:74:gst_inference_print_highest_probability:<net> Highest probability is label 2058 : (33799702613643740784668592694586507264.000000) 0:00:01.190673102 12853 0x55bc0eeb9770 LOG inceptionv2 gstinceptionv2.c:254:gst_inceptionv2_postprocess_new:<net> Postprocess Meta 0:00:01.190699590 12853 0x55bc0eeb9770 LOG inceptionv2 gstinferencedebug.c:111:gst_inference_print_predictions: { id : 23, enabled : True, bbox : { x : 0 y : 0 width : 224 height : 224 }, classes : [ { Id : 46 Class : 2058 Label : (null) Probability : 33799702613643740784668592694586507264.000000 Classes : 4004 }, ], predictions : [ ] }
Camera stream
- Get the graph used on this example from this link
- You will need a v4l2 compatible camera
- Pipeline
CAMERA='/dev/video0' MODEL_LOCATION='graph_inceptionv2_tensorflow.pb' INPUT_LAYER='input' OUTPUT_LAYER='Softmax' LABELS='imagenet_labels.txt' GST_DEBUG=inceptionv2:6 gst-launch-1.0 \ v4l2src device=$CAMERA ! videoconvert ! videoscale ! queue ! net.sink_model \ inceptionv2 name=net model-location=$MODEL_LOCATION labels=$(cat $LABELS) backend=tensorflow backend::input-layer=$INPUT_LAYER backend::output-layer=$OUTPUT_LAYER
- Output
0:00:01.647715258 12963 0x55be7ee48a80 LOG inceptionv2 gstinceptionv2.c:217:gst_inceptionv2_preprocess:<net> Preprocess 0:00:01.673402231 12963 0x55be7ee48a80 LOG inceptionv2 gstinceptionv2.c:229:gst_inceptionv2_postprocess_old:<net> Postprocess 0:00:01.673436695 12963 0x55be7ee48a80 LOG inceptionv2 gstinferencedebug.c:74:gst_inference_print_highest_probability:<net> Highest probability is label 3364 : (3.972995) 0:00:01.673445162 12963 0x55be7ee48a80 LOG inceptionv2 gstinceptionv2.c:254:gst_inceptionv2_postprocess_new:<net> Postprocess Meta 0:00:01.673476625 12963 0x55be7ee48a80 LOG inceptionv2 gstinferencedebug.c:111:gst_inference_print_predictions: { id : 26, enabled : True, bbox : { x : 0 y : 0 width : 224 height : 224 }, classes : [ { Id : 52 Class : 3364 Label : (null) Probability : 3.972995 Classes : 4004 }, ], predictions : [ ] }
Visualization with inference overlay
- Get the graph used on this example from this link
- You will need a v4l2 compatible camera
- Pipeline
CAMERA='/dev/video0' MODEL_LOCATION='graph_inceptionv2_tensorflow.pb' INPUT_LAYER='input' OUTPUT_LAYER='Softmax' LABELS='imagenet_labels.txt' gst-launch-1.0 \ v4l2src device=$CAMERA ! "video/x-raw, width=1280, height=720" ! videoconvert ! tee name=t \ t. ! videoscale ! queue ! net.sink_model \ t. ! queue ! net.sink_bypass \ inceptionv2 name=net model-location=$MODEL_LOCATION labels=$(cat $LABELS) backend=tensorflow backend::input-layer=$INPUT_LAYER backend::output-layer=$OUTPUT_LAYER \ net.src_bypass ! inferenceoverlay ! videoconvert ! queue ! xvimagesink async=false sync=false qos=false
Inceptionv3
Image file
- Get the graph used on this example from this link
- You will need a image file from one of ImageNet classes
- Pipeline
IMAGE_FILE=cat.jpg MODEL_LOCATION='graph_inceptionv3_tensorflow.pb' INPUT_LAYER='input' OUTPUT_LAYER='InceptionV3/Predictions/Reshape_1 GST_DEBUG=inceptionv3:6 gst-launch-1.0 \ multifilesrc location=$IMAGE_FILE start-index=0 stop-index=0 loop=true ! jpegparse ! jpegdec ! videoconvert ! videoscale ! queue ! net.sink_model \ inceptionv3 name=net model-location=$MODEL_LOCATION labels=$(cat $LABELS) backend=tensorflow backend::input-layer=$INPUT_LAYER backend::output-layer=$OUTPUT_LAYER
- Output
0:00:01.696274261 13153 0x55c06386e8a0 LOG inceptionv3 gstinceptionv3.c:149:gst_inceptionv3_preprocess:<net> Preprocess 0:00:01.751348188 13153 0x55c06386e8a0 LOG inceptionv3 gstinceptionv3.c:161:gst_inceptionv3_postprocess_old:<net> Postprocess 0:00:01.751379427 13153 0x55c06386e8a0 LOG inceptionv3 gstinferencedebug.c:74:gst_inference_print_highest_probability:<net> Highest probability is label 1353 : (9.000000) 0:00:01.751385353 13153 0x55c06386e8a0 LOG inceptionv3 gstinceptionv3.c:186:gst_inceptionv3_postprocess_new:<net> Postprocess Meta 0:00:01.751511065 13153 0x55c06386e8a0 LOG inceptionv3 gstinferencedebug.c:111:gst_inference_print_predictions: { id : 16, enabled : True, bbox : { x : 0 y : 0 width : 299 height : 299 }, classes : [ { Id : 32 Class : 1353 Label : (null) Probability : 9.000000 Classes : 4004 }, ], predictions : [ ] }
Video file
- Get the graph used on this example from this link
- You will need a video file from one of ImageNet classes
- Pipeline
VIDEO_FILE='cat.mp4' MODEL_LOCATION='graph_inceptionv3_tensorflow.pb' INPUT_LAYER='input' OUTPUT_LAYER='InceptionV3/Predictions/Reshape_1 GST_DEBUG=inceptionv3:6 gst-launch-1.0 \ filesrc location=$VIDEO_FILE ! decodebin ! videoconvert ! videoscale ! queue ! net.sink_model \ inceptionv3 name=net model-location=$MODEL_LOCATION labels=$(cat $LABELS) backend=tensorflow backend::input-layer=$INPUT_LAYER backend::output-layer=$OUTPUT_LAYER
- Output
0:00:11.878158663 27048 0x1d49800 LOG inceptionv3 gstinceptionv3.c:199:gst_inceptionv3_preprocess:<net> Preprocess 0:00:13.006776924 27048 0x1d49800 LOG inceptionv3 gstinceptionv3.c:231:gst_inceptionv3_postprocess:<net> Postprocess 0:00:13.006847113 27048 0x1d49800 LOG inceptionv3 gstinceptionv3.c:252:gst_inceptionv3_postprocess:<net> Highest probability is label 282 : (0,594995) 0:00:13.006946305 27048 0x1d49800 LOG inceptionv3 gstinceptionv3.c:199:gst_inceptionv3_preprocess:<net> Preprocess 0:00:14.170203673 27048 0x1d49800 LOG inceptionv3 gstinceptionv3.c:231:gst_inceptionv3_postprocess:<net> Postprocess 0:00:14.170277808 27048 0x1d49800 LOG inceptionv3 gstinceptionv3.c:252:gst_inceptionv3_postprocess:<net> Highest probability is label 282 : (0,595920) 0:00:14.170384768 27048 0x1d49800 LOG inceptionv3 gstinceptionv3.c:199:gst_inceptionv3_preprocess:<net> Preprocess 0:00:15.285901546 27048 0x1d49800 LOG inceptionv3 gstinceptionv3.c:231:gst_inceptionv3_postprocess:<net> Postprocess 0:00:15.285964794 27048 0x1d49800 LOG inceptionv3 gstinceptionv3.c:252:gst_inceptionv3_postprocess:<net> Highest probability is label 282 : (0,593185)
Camera stream
- Get the graph used on this example from this link
- You will need a v4l2 compatible camera
- Pipeline
CAMERA='/dev/video0' MODEL_LOCATION='graph_inceptionv3_tensorflow.pb' INPUT_LAYER='input' OUTPUT_LAYER='InceptionV3/Predictions/Reshape_1' GST_DEBUG=inceptionv3:6 gst-launch-1.0 \ v4l2src device=$CAMERA ! videoconvert ! videoscale ! queue ! net.sink_model \ inceptionv3 name=net model-location=$MODEL_LOCATION labels=$(cat $LABELS) backend=tensorflow backend::input-layer=$INPUT_LAYER backend::output-layer=$OUTPUT_LAYER
- Output
0:00:14.614862363 27227 0x19cd4a0 LOG inceptionv3 gstinceptionv3.c:199:gst_inceptionv3_preprocess:<net> Preprocess 0:00:15.737842669 27227 0x19cd4a0 LOG inceptionv3 gstinceptionv3.c:231:gst_inceptionv3_postprocess:<net> Postprocess 0:00:15.737912053 27227 0x19cd4a0 LOG inceptionv3 gstinceptionv3.c:252:gst_inceptionv3_postprocess:<net> Highest probability is label 838 : (0,105199) 0:00:15.738007534 27227 0x19cd4a0 LOG inceptionv3 gstinceptionv3.c:199:gst_inceptionv3_preprocess:<net> Preprocess 0:00:16.855603761 27227 0x19cd4a0 LOG inceptionv3 gstinceptionv3.c:231:gst_inceptionv3_postprocess:<net> Postprocess 0:00:16.855673578 27227 0x19cd4a0 LOG inceptionv3 gstinceptionv3.c:252:gst_inceptionv3_postprocess:<net> Highest probability is label 838 : (0,093981) 0:00:16.855768558 27227 0x19cd4a0 LOG inceptionv3 gstinceptionv3.c:199:gst_inceptionv3_preprocess:<net> Preprocess 0:00:17.980784789 27227 0x19cd4a0 LOG inceptionv3 gstinceptionv3.c:231:gst_inceptionv3_postprocess:<net> Postprocess 0:00:17.980849612 27227 0x19cd4a0 LOG inceptionv3 gstinceptionv3.c:252:gst_inceptionv3_postprocess:<net> Highest probability is label 838 : (0,077824)
Visualization with inference overlay
- Get the graph used on this example from this link
- You will need a v4l2 compatible camera
- Pipeline
CAMERA='/dev/video0' MODEL_LOCATION='graph_inceptionv3_tensorflow.pb' INPUT_LAYER='input' OUTPUT_LAYER='InceptionV3/Predictions/Reshape_1' LABELS='imagenet_labels.txt' gst-launch-1.0 \ v4l2src device=$CAMERA ! "video/x-raw, width=1280, height=720" ! videoconvert ! tee name=t \ t. ! videoscale ! queue ! net.sink_model \ t. ! queue ! net.sink_bypass \ inceptionv3 name=net model-location=$MODEL_LOCATION backend=tensorflow labels=$(cat $LABELS) backend::input-layer=$INPUT_LAYER backend::output-layer=$OUTPUT_LAYER \ net.src_bypass ! inferenceoverlay ! videoconvert ! queue ! xvimagesink async=false sync=false qos=false
TinyYolov2
Image file
- Get the graph used on this example from this link
- You will need an image file from one of TinyYOLO classes
- Pipeline
CAMERA='/dev/video0' MODEL_LOCATION='graph_tinyyolov2_tensorflow.pb' INPUT_LAYER='input/Placeholder' OUTPUT_LAYER='add_8' LABELS=labels.txt
GST_DEBUG=tinyyolov2:6 gst-launch-1.0 \ multifilesrc location=$IMAGE_FILE start-index=0 stop-index=0 loop=true ! jpegparse ! jpegdec ! videoconvert ! videoscale ! videorate ! tee name=t t. ! queue ! videoconvert ! videoscale ! net.sink_model t. ! queue ! videoconvert ! video/x-raw,format=RGB ! net.sink_bypass tinyyolov2 new-meta=true name=net backend=tensorflow model-location=$MODEL_LOCATION labels=$(cat labels.txt) backend::input-layer=$INPUT_LAYER backend::output-layer=$OUTPUT_LAYER net.src_bypass ! inferenceoverlay ! videoconvert ! queue ! xvimagesink async=false sync=false qos=false </syntaxhighlight>
- Output
0:00:03.050336570 8194 0x55b131f7aad0 LOG tinyyolov2 gsttinyyolov2.c:286:gst_tinyyolov2_preprocess:<net> Preprocess 0:00:03.097045162 8194 0x55b131f7aad0 LOG tinyyolov2 gsttinyyolov2.c:325:gst_tinyyolov2_postprocess_old:<net> Postprocess 0:00:03.097080665 8194 0x55b131f7aad0 LOG tinyyolov2 gstinferencedebug.c:93:gst_inference_print_boxes:<net> Box: [class:7, x:87.942292, y:102.912900, width:244.945642, height:285.130143, prob:16.271288] 0:00:03.097087457 8194 0x55b131f7aad0 LOG tinyyolov2 gsttinyyolov2.c:359:gst_tinyyolov2_postprocess_new:<net> Postprocess Meta 0:00:03.097095173 8194 0x55b131f7aad0 LOG tinyyolov2 gsttinyyolov2.c:366:gst_tinyyolov2_postprocess_new:<net> Number of predictions: 1 0:00:03.097117947 8194 0x55b131f7aad0 LOG tinyyolov2 gstinferencedebug.c:111:gst_inference_print_predictions: { id : 346, enabled : True, bbox : { x : 0 y : 0 width : 416 height : 416 }, classes : [ ], predictions : [ { id : 347, enabled : True, bbox : { x : 87 y : 102 width : 244 height : 285 }, classes : [ { Id : 258 Class : 7 Label : cat Probability : 16.271288 Classes : 20 }, ], predictions : [ ] }, ] }
Video file
- Get the graph used on this example from this link
- You will need a video file from one of TinyYOLO classes
- Pipeline
VIDEO_FILE='cat.mp4' MODEL_LOCATION='graph_tinyyolov2_tensorflow.pb' INPUT_LAYER='input/Placeholder' OUTPUT_LAYER='add_8' LABELS=labels.txt GST_DEBUG=tinyyolov2:6 gst-launch-1.0 \ filesrc location=$VIDEO_FILE ! decodebin ! videoconvert ! videoscale ! queue ! tee name=t t. ! queue ! videoconvert ! videoscale ! net.sink_model t. ! queue ! videoconvert ! video/x-raw,format=RGB ! net.sink_bypass tinyyolov2 new-meta=true name=net backend=tensorflow model-location=$MODEL_LOCATION labels=$(cat $LABELS) backend::input-layer=$INPUT_LAYER backend::output-layer=$OUTPUT_LAYER net.src_bypass ! inferenceoverlay ! videoconvert ! queue ! xvimagesink async=false sync=false qos=false
- Output
0:00:02.992422192 8194 0x55b131f7aad0 LOG tinyyolov2 gsttinyyolov2.c:286:gst_tinyyolov2_preprocess:<net> Preprocess 0:00:03.048734915 8194 0x55b131f7aad0 LOG tinyyolov2 gsttinyyolov2.c:325:gst_tinyyolov2_postprocess_old:<net> Postprocess 0:00:03.048770315 8194 0x55b131f7aad0 LOG tinyyolov2 gstinferencedebug.c:93:gst_inference_print_boxes:<net> Box: [class:7, x:87.942292, y:102.912900, width:244.945642, height:285.130143, prob:16.271288] 0:00:03.048776786 8194 0x55b131f7aad0 LOG tinyyolov2 gsttinyyolov2.c:359:gst_tinyyolov2_postprocess_new:<net> Postprocess Meta 0:00:03.048784401 8194 0x55b131f7aad0 LOG tinyyolov2 gsttinyyolov2.c:366:gst_tinyyolov2_postprocess_new:<net> Number of predictions: 1 0:00:03.048805819 8194 0x55b131f7aad0 LOG tinyyolov2 gstinferencedebug.c:111:gst_inference_print_predictions: { id : 338, enabled : True, bbox : { x : 0 y : 0 width : 416 height : 416 }, classes : [ ], predictions : [ { id : 339, enabled : True, bbox : { x : 87 y : 102 width : 244 height : 285 }, classes : [ { Id : 252 Class : 7 Label : cat Probability : 16.271288 Classes : 20 }, ], predictions : [ ] }, ] }
Camera stream
- Get the graph used on this example from this link
- You will need a v4l2 compatible camera
- Pipeline
CAMERA='/dev/video0' MODEL_LOCATION='graph_tinyyolov2_tensorflow.pb' INPUT_LAYER='input/Placeholder' OUTPUT_LAYER='add_8' LABELS=labels.txt GST_DEBUG=tinyyolov2:6 gst-launch-1.0 \ v4l2src device=$CAMERA ! "video/x-raw" ! tee name=t t. ! queue ! videoconvert ! videoscale ! net.sink_model t. ! queue ! videoconvert ! video/x-raw,format=RGB ! net.sink_bypass tinyyolov2 new-meta=true name=net backend=tensorflow model-location=$MODEL_LOCATION labels=$(cat labels.txt) backend::input-layer=$INPUT_LAYER backend::output-layer=$OUTPUT_LAYER
- Output
0:00:02.493931842 8814 0x557dfec450f0 LOG tinyyolov2 gsttinyyolov2.c:286:gst_tinyyolov2_preprocess:<net> Preprocess ^Chandling interrupt. Interrupt: Stopping pipeline ... Execution ended after 0:00:01.951234668 Setting pipeline to PAUSED ... Setting pipeline to READY ... 0:00:02.541405794 8814 0x557dfec450f0 LOG tinyyolov2 gsttinyyolov2.c:325:gst_tinyyolov2_postprocess_old:<net> Postprocess 0:00:02.541440570 8814 0x557dfec450f0 LOG tinyyolov2 gstinferencedebug.c:93:gst_inference_print_boxes:<net> Box: [class:14, x:82.788036, y:126.779761, width:250.107193, height:300.441625, prob:12.457702] 0:00:02.541447102 8814 0x557dfec450f0 LOG tinyyolov2 gsttinyyolov2.c:359:gst_tinyyolov2_postprocess_new:<net> Postprocess Meta 0:00:02.541454350 8814 0x557dfec450f0 LOG tinyyolov2 gsttinyyolov2.c:366:gst_tinyyolov2_postprocess_new:<net> Number of predictions: 1 0:00:02.541476722 8814 0x557dfec450f0 LOG tinyyolov2 gstinferencedebug.c:111:gst_inference_print_predictions: { id : 177, enabled : True, bbox : { x : 0 y : 0 width : 416 height : 416 }, classes : [ ], predictions : [ { id : 178, enabled : True, bbox : { x : 82 y : 126 width : 250 height : 300 }, classes : [ { Id : 101 Class : 14 Label : person Probability : 12.457702 Classes : 20 }, ], predictions : [ ] }, ] }
Visualization with inference overlay
- Get the graph used on this example from this link
- You will need a v4l2 compatible camera
- Pipeline
CAMERA='/dev/video0' MODEL_LOCATION='graph_tinyyolov2_tensorflow.pb' INPUT_LAYER='input/Placeholder' OUTPUT_LAYER='add_8' LABELS='labels.txt' GST_DEBUG=tinyyolov2:6 gst-launch-1.0 \ v4l2src device=$CAMERA ! "video/x-raw" ! tee name=t t. ! queue ! videoconvert ! videoscale ! net.sink_model t. ! queue ! videoconvert ! video/x-raw,format=RGB ! net.sink_bypass tinyyolov2 new-meta=true name=net backend=tensorflow model-location=$MODEL_LOCATION labels=$(cat labels.txt) backend::input-layer=$INPUT_LAYER backend::output-layer=$OUTPUT_LAYER net.src_bypass ! inferenceoverlay ! videoconvert ! queue ! xvimagesink async=false sync=false qos=false
Using inference filter
- Get the graph used on this example from this link
- You will need a v4l2 compatible camera
- Pipeline
GST_DEBUG=2,*inferencedebug*:6 gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! tee name=t t. ! videoscale ! queue ! net.sink_model t. ! queue ! net.sink_bypass tinyyolov2 name=net model-location=$MODEL_LOCATION labels=$(cat $LABELS) backend=tensorflow backend::input-layer=$INPUT_LAYER backend::output-layer=$OUTPUT_LAYER net.src_model ! inferencefilter filter-class=8 ! inferencedebug ! fakesink <syntaxhighlight> * Output <syntaxhighlight lang=bash> 0:00:03.255231109 11277 0x55f5ce5cfde0 DEBUG inferencedebug gstinferencedebug.c:131:gst_inference_debug_transform_ip:<inferencedebug0> transform_ip 0:00:03.255268289 11277 0x55f5ce5cfde0 DEBUG inferencedebug gstinferencedebug.c:120:gst_inference_debug_print_predictions:<inferencedebug0> Prediction Tree: { id : 169, enabled : False, bbox : { x : 0 y : 0 width : 416 height : 416 }, classes : [ ], predictions : [ { id : 170, enabled : False, bbox : { x : 101 y : 96 width : 274 height : 346 }, classes : [ { Id : 81 Class : 14 Label : person Probability : 12.842868 Classes : 20 }, ], predictions : [ ] }, ] }
Visualization with detection crop
- Get the graph used on this example from this link
- You will need a v4l2 compatible camera
- Pipeline
Example with aspect-ratio property
CAMERA='/dev/video0' MODEL_LOCATION='graph_tinyyolov2_tensorflow.pb' INPUT_LAYER='input/Placeholder' OUTPUT_LAYER='add_8' LABELS='labels.txt' gst-launch-1.0 \ v4l2src device=$CAMERA ! "video/x-raw, width=1280, height=720" ! videoconvert ! tee name=t \ t. ! videoscale ! queue ! net.sink_model \ t. ! queue ! net.sink_bypass \ tinyyolov2 name=net model-location=$MODEL_LOCATION backend=tensorflow backend::input-layer=$INPUT_LAYER backend::output-layer=$OUTPUT_LAYER \ net.src_bypass ! detectioncrop aspect-ratio=1/1 ! videoscale ! ximagesink sync=false
Example with crop-index property
CAMERA='/dev/video0' MODEL_LOCATION='graph_tinyyolov2_tensorflow.pb' INPUT_LAYER='input/Placeholder' OUTPUT_LAYER='add_8' LABELS='labels.txt' gst-launch-1.0 \ v4l2src device=$CAMERA ! "video/x-raw, width=1280, height=720" ! videoconvert ! tee name=t \ t. ! videoscale ! queue ! net.sink_model \ t. ! queue ! net.sink_bypass \ tinyyolov2 name=net model-location=$MODEL_LOCATION backend=tensorflow backend::input-layer=$INPUT_LAYER backend::output-layer=$OUTPUT_LAYER \ net.src_bypass ! detectioncrop crop-index=1 ! videoscale ! ximagesink sync=false
Example with crop-class property
CAMERA='/dev/video0' MODEL_LOCATION='graph_tinyyolov2_tensorflow.pb' INPUT_LAYER='input/Placeholder' OUTPUT_LAYER='add_8' LABELS='labels.txt' gst-launch-1.0 \ v4l2src device=$CAMERA ! "video/x-raw, width=1280, height=720" ! videoconvert ! tee name=t \ t. ! videoscale ! queue ! net.sink_model \ t. ! queue ! net.sink_bypass \ tinyyolov2 name=net model-location=$MODEL_LOCATION backend=tensorflow backend::input-layer=$INPUT_LAYER backend::output-layer=$OUTPUT_LAYER \ net.src_bypass ! detectioncrop crop-class=4 ! videoscale ! ximagesink sync=false