Yolo for Jetson

A sample standalone app for running inference using yolo in jetson is now available here https://github.com/vat-nvidia/deepstream-plugins

Tegra users who are currently using DeepStream 1.5 can use this sample app as a reference and incorporate a similar pipeline in their inference plugins.

Nice! Thanks for sharing.

-albertr

While making it in Jetson TX2.
I am facing below error.

Can you point out what is the problem.

/home/nvidia/YOLOTEST/deepstream-plugins/sources/gst-yoloplugin/yoloplugin_lib

After make.

yolo.cpp:310:25: error: ‘class nvinfer1::IConcatenationLayer’ has no member named ‘setAxis’
concat->setAxis(0);

@prince15046 Which version of Jetpack are you currently using ?

Following the below thread now -

https://devtalk.nvidia.com/default/topic/1038913/deepstream-sdk-on-jetson/deepstream-plugins-make-failed/post/5281057/?offset=14#5281547

Can you help in building the TRT-yolo. Facing the following error.

../../gst-yoloplugin/yoloplugin_lib/build/yoloplugin_lib.o: In function `YoloPluginProcess':
yoloplugin_lib.cpp:(.text+0xf00): undefined reference to `cv::dnn::experimental_dnn_v3::blobFromImages(std::vector<cv::Mat, std::allocator<cv::Mat> > const&, double, cv::Size_<int>, cv::Scalar_<double> const&, bool, bool)'
collect2: error: ld returned 1 exit status
Makefile:49: recipe for target 'TRT-yolo-app' failed
make: *** [TRT-yolo-app] Error 1

Facing this error while compiling the libgstyolo in Jetson-TX1, with deep stream-2.0 for running the TRT-yolo app in the Jetson TX-1 device


/usr/bin/ld: skipping incompatible /usr/local/deepstream/libgstnvquery.so when searching for -lgstnvquery
/usr/bin/ld: cannot find -lgstnvquery
/usr/bin/ld: skipping incompatible /usr/local/deepstream/libgstnvdsmeta.so when searching for -lgstnvdsmeta
/usr/bin/ld: cannot find -lgstnvdsmeta
collect2: error: ld returned 1 exit status
Makefile:64: recipe for target ‘libgstnvyolo.so’ failed
make: *** [libgstnvyolo.so] Error 1

Hi NvCJR:

Sorry, I’m a bit confused about the environment where this new YOLO plugin can be used. The README file says it’s for Deepstream 2.0. Your post says that it’s for Jetson. However, Deepstream 2.0 is not yet available on the Jetson platform. hence my confusion.

Please clarify.

Thanks.

Another question:

In README.md:
Add absolute paths of images to be used for calibration in the calibration_images.txt file within the sources/gst-yoloplugin/yoloplugin_lib/data directory.

Could you elaborate on the required format of images for calibration? Sorry if this is a stupid question. Thanks.

Getting this error while compiling TRT-yolo app on Jetson-TX2

trt_utils.cpp: In function ‘nvinfer1::ILayer* netAddUpsample(int, std::map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >&, std::vector<float>&, int&, nvinfer1::ITensor*, nvinfer1::INetworkDefinition*)’:
trt_utils.cpp:584:5: error: ‘IConstantLayer’ is not a member of ‘nvinfer1’
     nvinfer1::IConstantLayer* preM = network->addConstant(preDims, pre);
     ^
trt_utils.cpp:584:31: error: ‘preM’ was not declared in this scope
     nvinfer1::IConstantLayer* preM = network->addConstant(preDims, pre);
                               ^
trt_utils.cpp:584:47: error: ‘class nvinfer1::INetworkDefinition’ has no member named ‘addConstant’
     nvinfer1::IConstantLayer* preM = network->addConstant(preDims, pre);
                                               ^
trt_utils.cpp:611:5: error: ‘IConstantLayer’ is not a member of ‘nvinfer1’
     nvinfer1::IConstantLayer* post_m = network->addConstant(postDims, post);
     ^
trt_utils.cpp:611:31: error: ‘post_m’ was not declared in this scope
     nvinfer1::IConstantLayer* post_m = network->addConstant(postDims, post);
                               ^
trt_utils.cpp:611:49: error: ‘class nvinfer1::INetworkDefinition’ has no member named ‘addConstant’
     nvinfer1::IConstantLayer* post_m = network->addConstant(postDims, post);
                                                 ^
trt_utils.cpp:616:5: error: ‘IMatrixMultiplyLayer’ is not a member of ‘nvinfer1’
     nvinfer1::IMatrixMultiplyLayer* mm1
     ^
trt_utils.cpp:616:37: error: ‘mm1’ was not declared in this scope
     nvinfer1::IMatrixMultiplyLayer* mm1
                                     ^
trt_utils.cpp:617:20: error: ‘class nvinfer1::INetworkDefinition’ has no member named ‘addMatrixMultiply’
         = network->addMatrixMultiply(*preM->getOutput(0), false, *input, false)
                    ^
trt_utils.cpp:621:5: error: ‘IMatrixMultiplyLayer’ is not a member of ‘nvinfer1’
     nvinfer1::IMatrixMultiplyLayer* mm2
     ^
trt_utils.cpp:621:37: error: ‘mm2’ was not declared in this scope
     nvinfer1::IMatrixMultiplyLayer* mm2
                                     ^
trt_utils.cpp:622:20: error: ‘class nvinfer1::INetworkDefinition’ has no member named ‘addMatrixMultiply’
         = network->addMatrixMultiply(*mm1->getOutput(0), false, *post_m->getOut
                    ^
Makefile:62: recipe for target 'build/trt_utils.o' failed
make[1]: *** [build/trt_utils.o] Error 1
make[1]: Leaving directory '/home/nvidia/Desktop/deepstream-plugins/sources/gst-yoloplugin/yoloplugin_lib'
Makefile:68: recipe for target 'yoloplugin_lib/libyoloplugin.a' failed
make: *** [yoloplugin_lib/libyoloplugin.a] Error 2

@subhasis.chakraborty Which jetpack are you using ?

@NvCJR

I ma using Jetpack 3.3

@subhasis.chakraborty TensorRT offcially supports constant and matrixmultiply layers since 4.0.1 release. Can you reinstall tensor RT using the latest package of Jetpack 3.3 and check if that resolves your issue? It’s available here - https://developer.nvidia.com/embedded/downloads#?search=jetpack%203.3

Hi NvCJR,

The plugin works really good.

Is there any plan to work on Python plugin for the same ?

@prince15046 we dont have a python version of the plugin but gstreamer offers python bindings which may be helpful to you. Reference - https://gstreamer.freedesktop.org/bindings/python.html

g++ -I"/include" -I"/usr/local/cuda-9.0/include" -I “/usr/local/include” -c -o build/trt_utils.o -O2 -std=c++11 -lstdc++fs -fPIC -Wall -Wunused-function -Wunused-variable pkg-config --cflags glib-2.0 trt_utils.cpp
trt_utils.cpp: In function ‘nvinfer1::ILayer* netAddUpsample(int, std::map<std::__cxx11::basic_string, std::__cxx11::basic_string >&, std::vector&, int&, nvinfer1::ITensor*, nvinfer1::INetworkDefinition*)’:
trt_utils.cpp:584:5: error: ‘IConstantLayer’ is not a member of ‘nvinfer1’
nvinfer1::IConstantLayer* preM = network->addConstant(preDims, pre);
^
trt_utils.cpp:584:31: error: ‘preM’ was not declared in this scope
nvinfer1::IConstantLayer* preM = network->addConstant(preDims, pre);
^
trt_utils.cpp:584:47: error: ‘class nvinfer1::INetworkDefinition’ has no member named ‘addConstant’
nvinfer1::IConstantLayer* preM = network->addConstant(preDims, pre);
^
trt_utils.cpp:611:5: error: ‘IConstantLayer’ is not a member of ‘nvinfer1’
nvinfer1::IConstantLayer* post_m = network->addConstant(postDims, post);
^
trt_utils.cpp:611:31: error: ‘post_m’ was not declared in this scope
nvinfer1::IConstantLayer* post_m = network->addConstant(postDims, post);
^
trt_utils.cpp:611:49: error: ‘class nvinfer1::INetworkDefinition’ has no member named ‘addConstant’
nvinfer1::IConstantLayer* post_m = network->addConstant(postDims, post);
^
trt_utils.cpp:616:5: error: ‘IMatrixMultiplyLayer’ is not a member of ‘nvinfer1’
nvinfer1::IMatrixMultiplyLayer* mm1
^
trt_utils.cpp:616:37: error: ‘mm1’ was not declared in this scope
nvinfer1::IMatrixMultiplyLayer* mm1
^
trt_utils.cpp:617:20: error: ‘class nvinfer1::INetworkDefinition’ has no member named ‘addMatrixMultiply’
= network->addMatrixMultiply(preM->getOutput(0), false, input, false);
^
trt_utils.cpp:621:5: error: ‘IMatrixMultiplyLayer’ is not a member of ‘nvinfer1’
nvinfer1::IMatrixMultiplyLayer
mm2
^
trt_utils.cpp:621:37: error: ‘mm2’ was not declared in this scope
nvinfer1::IMatrixMultiplyLayer
mm2
^
trt_utils.cpp:622:20: error: ‘class nvinfer1::INetworkDefinition’ has no member named ‘addMatrixMultiply’
= network->addMatrixMultiply(*mm1->getOutput(0), false, *post_m->getOutput(0), false);
^
Makefile:62: recipe for target ‘build/trt_utils.o’ failed
make: *** [build/trt_utils.o] Error 1

root@tx2:/usr/src/deepstream-plugins/sources/gst-yoloplugin/yoloplugin_lib# apt list --installed | grep -i tensor

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

nv-tensorrt-repo-ubuntu1604-ga-cuda9.0-trt3.0.4-20180208/now 1-1 arm64 [installed,local]
tensorrt/unknown,now 3.0.4-1+cuda9.0 arm64 [installed]
tensorrt-2.1.2/unknown,now 3.0.2-1+cuda8.0 arm64 [installed]

-albertr

grep NV_TENSORRT /usr/include/aarch64-linux-gnu/NvInfer.h | head -3
#define NV_TENSORRT_MAJOR 3 //!< TensorRT major version
#define NV_TENSORRT_MINOR 0 //!< TensorRT minor version
#define NV_TENSORRT_PATCH 4 //!< TensorRT patch version

Is TensorRT 4.x a requirement for this plugin?

-albertr

@albertr Yes. Please install TensorRT 4 using jetpack 3.3.
Link to download Jetpack 3.3 - https://developer.nvidia.com/embedded/downloads#?search=jetpack%203.3

@prashanth.bhat The repo has now been updated with support for running yoloplugin on tegra with Deepstream 1.5

Looks like this plugin wants source video in NV12 format?

root@tx2:/tmp/src/deepstream-plugins/sources/plugins/gst-yoloplugin-tegra# grep NV12 *
gstyoloplugin.cpp: GST_STATIC_CAPS(GST_VIDEO_CAPS_MAKE_WITH_FEATURES(GST_CAPS_FEATURE_MEMORY_NVMM, “{ NV12 }”)));
gstyoloplugin.cpp: GST_STATIC_CAPS(GST_VIDEO_CAPS_MAKE_WITH_FEATURES(GST_CAPS_FEATURE_MEMORY_NVMM, “{ NV12 }”)));

My USB camera supports I420, so it’s getting the following error:

------------> -----------------
** ERROR: <create_pipeline:1039>: Failed to link ‘multi_src_bin’ and ‘processing_bin_0’
** ERROR: <create_pipeline:1062>: create_pipeline failed
** ERROR: main:384: Failed to create pipeline
Quitting
App run failed

Is there an easy way to add format conversion to gstreamer pipeline used by nvgstiva-app, something like adding nvvidconv element?

-albertr