(DS 4.0/Nano) nvinfer with VGG_VOC0712_SSD_300x300_iter_120000.caffemodel

The TensorRT sample “sampleSSD.cpp” uses “VGG_VOC0712_SSD_300x300_iter_120000.caffemodel”

When I tried it with nvinfer, I get:

Warning: Flatten layer ignored. TensorRT implicitly flattens input to FullyConnected layers, but in other circumstances this will result in undefined behavior.
0:00:01.579468812 15831 0x559fe5ed60 ERROR nvinfer gstnvinfer.cpp:511:gst_nvinfer_logger: NvDsInferContext[UID 1]:log(): mbox_loc: all concat input tensors must have the same dimensions except on the concatenation axis
0:00:01.579541626 15831 0x559fe5ed60 ERROR nvinfer gstnvinfer.cpp:511:gst_nvinfer_logger: NvDsInferContext[UID 1]:log(): mbox_conf: all concat input tensors must have the same dimensions except on the concatenation axis
Caffe Parser: Invalid axis in softmax layer - Cannot perform softmax along batch size dimension and expects NCHW input. Negative axis is not supported in TensorRT, please use positive axis indexing
error parsing layer type Softmax index 98
0:00:01.579635274 15831 0x559fe5ed60 ERROR nvinfer gstnvinfer.cpp:511:gst_nvinfer_logger: NvDsInferContext[UID 1]:generateTRTModel(): Failed while parsing network
0:00:01.592129319 15831 0x559fe5ed60 ERROR nvinfer gstnvinfer.cpp:511:gst_nvinfer_logger: NvDsInferContext[UID 1]:initialize(): Failed to create engine from model files

What else do I have to do to get VGG_VOC0712_SSD_300x300_iter_120000.caffemodel working with nvinfer?

After changing the prototxt Flatten entries to Reshape, I get

0:00:07.543060526 17643 0x557260c360 INFO nvinfer gstnvinfer.cpp:519:gst_nvinfer_logger: NvDsInferContext[UID 1]:initialize(): Trying to create engine from model files
Plugin layer output count is not equal to caffe output count
0:00:08.317032754 17643 0x557260c360 ERROR nvinfer gstnvinfer.cpp:511:gst_nvinfer_logger: NvDsInferContext[UID 1]:generateTRTModel(): Failed while parsing network
0:00:08.330098895 17643 0x557260c360 ERROR nvinfer gstnvinfer.cpp:511:gst_nvinfer_logger: NvDsInferContext[UID 1]:initialize(): Failed to create engine from model files
0:00:08.330279576 17643 0x557260c360 WARN nvinfer gstnvinfer.cpp:692:gst_nvinfer_start: error: Failed to create NvDsInferContext instance
0:00:08.330336192 17643 0x557260c360 WARN nvinfer gstnvinfer.cpp:692:gst_nvinfer_start: error: Config file path: /opt/nvidia/deepstream/deepstream-4.0/samples/configs/deepstream-app/config_infer_primary_try.txt, NvDsInfer Error: NVDSINFER_TENSORRT_ERROR

This is documented as part of “sampleSSD.cpp”:

The network is defined in a prototxt file which is shipped with the sample and located in the `data/ssd` directory. The original prototxt file provided by the authors is modified and included in the TensorRT in-built plugin layers in the prototxt file.

The built-in plugin layers used in sampleSSD are Normalize, PriorBox, and DetectionOutput. The corresponding registered plugins for these layers are Normalize_TRT, PriorBox_TRT and NMS_TRT.

To initialize and register these TensorRT plugins to the plugin registry, the initLibNvInferPlugins method is used. After registering the plugins and while parsing the prototxt file, the NvCaffeParser creates plugins for the layers based on the parameters that were provided in the prototxt file automatically. The details about each parameter is provided in the README.md and can be modified similar to the Caffe Layer parameter.

How do I do the equivalent for the DS 4.0 nvinfer plugin?

Strangely, in “sampleSSD.cpp” itself, we see

initLibNvInferPlugins(&gLogger.getTRTLogger(), “”);

I don’t see Normalize_TRT, PriorBox_TRT and NMS_TRT anywhere in the code.

OK, found the problem

Needed to add this to prototxt

top: “keep_count”

Finally getting this:

0:07:27.530413386 18543 0x558c8a1230 ERROR nvinfer gstnvinfer.cpp:511:gst_nvinfer_logger: NvDsInferContext[UID 1]:parseBoundingBox(): Could not find output coverage layer for parsing objects
0:07:27.530479846 18543 0x558c8a1230 ERROR nvinfer gstnvinfer.cpp:511:gst_nvinfer_logger: NvDsInferContext[UID 1]:fillDetectionOutput(): Failed to parse bboxes

Is this something that can be fixed by
“parse-bbox-func-name”?

Hi,

Suppose yes.
The application complains it cannot find the output layer whose name is coverage.

0:07:27.530413386 18543 0x558c8a1230 ERROR nvinfer gstnvinfer.cpp:511:gst_nvinfer_logger:<nvinfer0> NvDsInferContext[UID 1]:parseBoundingBox(): Could not find output coverage layer for parsing objects

Thanks.

Hi @AastaLLL, @AakankshaS,
How to solve this.?

Hi @AakankshaS,
I have solved the parsing by sustituting NMS1 and NMS layers to detection_out and keep_count in opt/nvidia/deepstream/deepstream-5.0/sources/objectDetector_SSD/nvdsinfer_custom_impl_ssd/nvdsparsebbox_ssd.cpp . But output video has no bounding box.
Kindly do help Please …its a little urgent.