GstInference/Example pipelines/NANO

From RidgeRun Developer Wiki
Revision as of 14:04, 26 August 2019 by Aarias (talk | contribs) (Add main pipelines examples for the nano)


Tensorflow

Inception

  • Get the graph used on this example from this link.
  • You will need an image file from one of ImageNet classes.
  • Use the following pipelines as examples for different scenarios.

Image

IMAGE_FILE='cat.jpg'
MODEL_LOCATION='graphs/InceptionV4_TensorFlow/graph_inceptionv4_tensorflow.pb'
INPUT_LAYER='input'
OUTPUT_LAYER='InceptionV4/Logits/Predictions'
GST_DEBUG=inceptionv4:6 gst-launch-1.0 \
multifilesrc location=$IMAGE_FILE ! jpegparse ! nvjpegdec ! 'video/x-raw' ! nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12' ! nvvidconv ! queue ! net.sink_model \
inceptionv4 name=net model-location=$MODEL_LOCATION backend=tensorflow backend::input-layer=$INPUT_LAYER  backend::output-layer=$OUTPUT_LAYER
  • Output
0:00:41.102961125  9500   0x55cd3e54a0 LOG              inceptionv4 gstinferencedebug.c:73:gst_inference_print_highest_probability:<net> Highest probability is label 282 : (0,651213)
0:00:41.103261600  9500   0x55cd3e54a0 LOG              inceptionv4 gstinceptionv4.c:208:gst_inceptionv4_preprocess:<net> Preprocess
0:00:41.414504525  9500   0x55cd3e54a0 LOG              inceptionv4 gstinceptionv4.c:219:gst_inceptionv4_postprocess:<net> Postprocess
0:00:41.415032923  9500   0x55cd3e54a0 LOG              inceptionv4 gstinferencedebug.c:73:gst_inference_print_highest_probability:<net> Highest probability is label 282 : (0,651213)
0:00:41.415468297  9500   0x55cd3e54a0 LOG              inceptionv4 gstinceptionv4.c:208:gst_inceptionv4_preprocess:<net> Preprocess
0:00:41.726504445  9500   0x55cd3e54a0 LOG              inceptionv4 gstinceptionv4.c:219:gst_inceptionv4_postprocess:<net> Postprocess

Video

VIDEO_FILE='cat.mp4'
MODEL_LOCATION='graphs/InceptionV4_TensorFlow/graph_inceptionv4_tensorflow.pb'
INPUT_LAYER='input'
OUTPUT_LAYER='InceptionV4/Logits/Predictions'
GST_DEBUG=inceptionv4:6 gst-launch-1.0 \
filesrc location=$VIDEO_FILE ! qtdemux name=demux ! h264parse ! omxh264dec ! nvvidconv ! queue ! net.sink_model \
inceptionv4 name=net model-location=$MODEL_LOCATION backend=tensorflow backend::input-layer=$INPUT_LAYER  backend::output-layer=$OUTPUT_LAYER
  • Output
0:00:43.428868204  9619   0x55b19b6b70 LOG              inceptionv4 gstinceptionv4.c:219:gst_inceptionv4_postprocess:<net> Postprocess
0:00:43.436573728  9619   0x55b19b6b70 LOG              inceptionv4 gstinferencedebug.c:73:gst_inference_print_highest_probability:<net> Highest probability is label 282 : (0,875079)
0:00:43.473135944  9619   0x55b19b6b70 LOG              inceptionv4 gstinceptionv4.c:208:gst_inceptionv4_preprocess:<net> Preprocess
0:00:43.861247785  9619   0x55b19b6b70 LOG              inceptionv4 gstinceptionv4.c:219:gst_inceptionv4_postprocess:<net> Postprocess
0:00:43.861550447  9619   0x55b19b6b70 LOG              inceptionv4 gstinferencedebug.c:73:gst_inference_print_highest_probability:<net> Highest probability is label 282 : (0,872448)

videocamera

CAMERA='/dev/video0'
MODEL_LOCATION='graphs/InceptionV4_TensorFlow/graph_inceptionv4_tensorflow.pb'
INPUT_LAYER='input'
OUTPUT_LAYER='InceptionV4/Logits/Predictions'
GST_DEBUG=inceptionv4:6 gst-launch-1.0 \
v4l2src device=$CAMERA ! videoconvert ! videoscale ! queue ! net.sink_model \
inceptionv4 name=net model-location=$MODEL_LOCATION backend=tensorflow backend::input-layer=$INPUT_LAYER  backend::output-layer=$OUTPUT_LAYER
  • Output
0:00:47.149540519  9748   0x5592110b20 LOG              inceptionv4 gstinceptionv4.c:219:gst_inceptionv4_postprocess:<net> Postprocess
0:00:47.149877140  9748   0x5592110b20 LOG              inceptionv4 gstinferencedebug.c:73:gst_inference_print_highest_probability:<net> Highest probability is label 283 : (0,702133)
0:00:47.150562517  9748   0x5592110b20 LOG              inceptionv4 gstinceptionv4.c:208:gst_inceptionv4_preprocess:<net> Preprocess
0:00:47.460348086  9748   0x5592110b20 LOG              inceptionv4 gstinceptionv4.c:219:gst_inceptionv4_postprocess:<net> Postprocess
0:00:47.460709916  9748   0x5592110b20 LOG              inceptionv4 gstinferencedebug.c:73:gst_inference_print_highest_probability:<net> Highest probability is label 283 : (0,705862)

TinyYOLOV2

Image

IMAGE_FILE='cat.jpg'
MODEL_LOCATION='graphs/TinyYoloV2_TensorFlow/graph_tinyyolov2_tensorflow.pb'
INPUT_LAYER='input/Placeholder'
OUTPUT_LAYER='add_8'
GST_DEBUG=tinyyolov2:6 gst-launch-1.0 \
multifilesrc location=$IMAGE_FILE ! jpegparse ! nvjpegdec ! 'video/x-raw' ! nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12' ! nvvidconv ! queue ! net.sink_model \
tinyyolov2 name=net model-location=$MODEL_LOCATION backend=tensorflow backend::input-layer=$INPUT_LAYER  backend::output-layer=$OUTPUT_LAYER
  • Output
0:00:24.558985002  9909   0x557d3278a0 LOG               tinyyolov2 gsttinyyolov2.c:288:gst_tinyyolov2_postprocess:<net> Postprocess
0:00:24.576012429  9909   0x557d3278a0 LOG               tinyyolov2 gstinferencedebug.c:92:gst_inference_print_boxes:<net> Box: [class:7, x:5,710080, y:115,575158, width:345,341579, height:304,490976, prob:14,346013]

Video

VIDEO_FILE='cat.mp4'
MODEL_LOCATION='graphs/TinyYoloV2_TensorFlow/graph_tinyyolov2_tensorflow.pb'
INPUT_LAYER='input/Placeholder'
OUTPUT_LAYER='add_8'
GST_DEBUG=tinyyolov2:6 gst-launch-1.0 \
filesrc location=$VIDEO_FILE ! qtdemux name=demux ! h264parse ! omxh264dec ! nvvidconv ! queue ! net.sink_model \
tinyyolov2 name=net model-location=$MODEL_LOCATION backend=tensorflow backend::input-layer=$INPUT_LAYER  backend::output-layer=$OUTPUT_LAYER
  • Output
0:00:07.245722660 30545       0x5ad000 LOG               tinyyolov2 gsttinyyolov2.c:479:gst_tinyyolov2_preprocess:<net> Preprocess
0:00:07.360377432 30545       0x5ad000 LOG               tinyyolov2 gsttinyyolov2.c:501:gst_tinyyolov2_postprocess:<net> Postprocess
0:00:07.360586455 30545       0x5ad000 LOG               tinyyolov2 gsttinyyolov2.c:384:print_top_predictions:<net> Box: [class:7, x:-46.105452, y:-9.139365, width:445.139551, height:487.967720, prob:14.592537]

videocamera

CAMERA='/dev/video0'
MODEL_LOCATION='graphs/TinyYoloV2_TensorFlow/graph_tinyyolov2_tensorflow.pb'
INPUT_LAYER='input/Placeholder'
OUTPUT_LAYER='add_8'
GST_DEBUG=tinyyolov2:6 gst-launch-1.0 \
v4l2src device=$CAMERA ! videoconvert ! videoscale ! queue ! net.sink_model \
tinyyolov2 name=net model-location=$MODEL_LOCATION backend=tensorflow backend::input-layer=$INPUT_LAYER  backend::output-layer=$OUTPUT_LAYER
  • Output
0:00:39.754924355  5030      0x10ee590 LOG               tinyyolov2 gsttinyyolov2.c:479:gst_tinyyolov2_preprocess:<net> Preprocess
0:00:39.876816786  5030      0x10ee590 LOG               tinyyolov2 gsttinyyolov2.c:501:gst_tinyyolov2_postprocess:<net> Postprocess
0:00:39.876914225  5030      0x10ee590 LOG               tinyyolov2 gsttinyyolov2.c:384:print_top_predictions:<net> Box: [class:4, x:147.260736, y:116.184709, width:134.389472, height:245.113627, prob:8.375733]