Gstreamer secondary model SIGSEGV fault

I am getting this SIGSEGV fault when I try to run a secondary model with nvinfer. I following a similar example to these slides: http://on-demand.gputechconf.com/gtc/2018/presentation/s81047-introduction-to-deep-stream-sdk.pdf

gst-launch-1.0 filesrc location=../../streams/sample_720p.mp4 ! decodebin ! nvinfer config-file-path=config_infer_resnet.txt ! queue ! nvtracker ! queue ! nvinfer config-file-path=sec_config_infer_resnet.txt ! nvvidconv ! "video/x-raw(memory:NVMM), format=(string)RGBA" ! queue ! nvosd ! nvvidconv ! "video/x-raw, format=(string)RGBA" ! videoconvert ! x264enc ! qtmux ! filesink location=out.mp4

Here is the file config_infer_resnet.txt which is exactly the same as the file in the sample

# Copyright (c) 2018 NVIDIA Corporation.  All rights reserved.
#
# NVIDIA Corporation and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto.  Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA Corporation is strictly prohibited.

[property]
gpu-id=0
net-scale-factor=0.0039215697906911373
model-file=../../models/Primary_Detector/resnet10.caffemodel
proto-file=../../models/Primary_Detector/resnet10.prototxt
model-cache=../../models/Primary_Detector/resnet10.caffemodel_b30_int8.cache
labelfile-path=../../models/Primary_Detector/labels.txt
int8-calib-file=../../models/Primary_Detector/cal_trt4.bin
#To use UFF models
#uff-file=<path to uff model>/<xyz>.uff
#input-dims=3;224;224;1 O=0(CHW) O=1(HWC)
net-stride=16
batch-size=30
## 0=FP32, 1=INT8, 2=FP16 mode
network-mode=1
num-classes=4
class-thresholds=0.2;0.2;0.2;0.2
class-eps=0.2;0.2;0.2;0.2
class-group-thresholds=1;1;1;1
roi-top-offset=0;0;0;0
roi-bottom-offset=0;0;0;0
detected-min-w=0;0;0;0
detected-min-h=0;0;0;0
detected-max-w=1280;1280;1280;1280
detected-max-h=720;720;720;720
interval=0
parser-bbox-norm=35.0;35.0
gie-unique-id=1
parse-func=4
output-bbox-name=conv2d_bbox
output-blob-names=conv2d_cov
#parse-bbox-func-name=parse_bbox_custom_resnet
#parse-bbox-lib-name=/path/to/this/directory/libnvparsebbox.so

Here is the file sec_config_infer_resnet.txt which is for the secondary model. I am using the sample models.

[property]
net-scale-factor=1
model-file=../../models/Secondary_VehicleTypes/resnet18.caffemodel
proto-file=../../models/Secondary_VehicleTypes/resnet18.prototxt
model-cache=../../models/Secondary_VehicleTypes/resnet18.caffemodel_b16_int8.cache
mean-file=../../models/Secondary_VehicleTypes/mean.ppm
labelfile-path=../../models/Secondary_VehicleTypes/labels.txt
int8-calib-file=../../models/Secondary_VehicleTypes/cal_trt4.bin
gpu-id=0
batch-size=16
num-classes=6
network-mode=1
detected-min-w=128
detected-min-h=128
detected-max-w=1280
detected-max-h=720
model-color-format=1
gie-unique-id=4
operate-on-gie-id=1
operate-on-class-ids=0;
is-classifier=1
output-blob-names=predictions/Softmax
classifier-async-mode=1
classifier-threshold=0.51

This is the error that happens.

Setting pipeline to PAUSED ...
>>> Using Cached GIE model /media/HD1/ryans_workspace/driving_sample_video/DeepStream_Release/samples/configs/deepstream-app/../../models/Secondary_VehicleTypes/resnet18.caffemodel_b16_int8.cache crypto flags(0)
>>> Using Cached GIE model /media/HD1/ryans_workspace/driving_sample_video/DeepStream_Release/samples/configs/deepstream-app/../../models/Primary_Detector/resnet10.caffemodel_b30_int8.cache crypto flags(0)
Pipeline is PREROLLING ...
Redistribute latency...
CUDA runtime error 77 cudaErrorIllegalAddress at line 116 in file cudaImage.cu
Caught SIGSEGV
CUDA runtime error 77 at line 800 in file gstnvvidconv.cpp

Is something wrong with my config file or is my gstreamer pipeline missing something?

Hi rymcclel,
Please refer to below sample:

DeepStreamSDK-2.0_EA_beta1.2\DeepStream_Release\sources\apps\deepstream-test2

I am still getting the SEGSEGV error when I use the dstest2_sgie3_config.txt in DeepStreamSDK-2.0_EA_beta1.2\DeepStream_Release\sources\apps\deepstream-test2

This is what I ran…

gst-launch-1.0 filesrc location=../../streams/sample_720p.mp4 ! decodebin ! nvinfer config-file-path=config_infer_resnet.txt ! queue ! nvtracker ! queue ! nvinfer config-file-path=dstest2_sgie3_config.txt ! nvvidconv ! "video/x-raw(memory:NVMM), format=(string)RGBA" ! queue ! nvosd ! nvvidconv ! "video/x-raw, format=(string)RGBA" ! videoconvert ! x264enc ! qtmux ! filesink location=out.mp4

Hi rymcclel,
In deepstream-test2, it links ‘sgie1 ! sgie2 ! sgie3’, do you see issue if you the three all together?

Hi rymcclel,
With below patch, deepstream-test2 runs well. For your reference.

diff --git a/apps/deepstream-test2/deepstream_test2_app.c b/apps/deepstream-test2/deepstream_test2_app.c
index aedca50..6884f06 100755
--- a/apps/deepstream-test2/deepstream_test2_app.c
+++ b/apps/deepstream-test2/deepstream_test2_app.c
@@ -242,7 +242,7 @@ main (int argc, char *argv[])
   GstElement *pipeline = NULL, *source = NULL, *h264parser = NULL,
       *decoder = NULL, *sink = NULL, *pgie = NULL, *nvvidconv = NULL,
       *nvosd = NULL, *filter1 = NULL, *filter2 = NULL,
-      *sgie1 = NULL, *sgie2 = NULL, *sgie3 = NULL, *nvtracker = NULL;
+      *sgie3 = NULL, *nvtracker = NULL;
   GstBus *bus = NULL;
   guint bus_watch_id = 0;
   GstCaps *caps1 = NULL, *caps2 = NULL;
@@ -283,10 +283,6 @@ main (int argc, char *argv[])
 
   /* We need three secondary gies so lets create 3 more instances of
      nvinfer */
-  sgie1 = gst_element_factory_make ("nvinfer", "secondary1-nvinference-engine");
-
-  sgie2 = gst_element_factory_make ("nvinfer", "secondary2-nvinference-engine");
-
   sgie3 = gst_element_factory_make ("nvinfer", "secondary3-nvinference-engine");
 
   /* Use convertor to convert from NV12 to RGBA as required by nvosd */
@@ -303,7 +299,7 @@ main (int argc, char *argv[])
   filter1 = gst_element_factory_make ("capsfilter", "filter1");
   filter2 = gst_element_factory_make ("capsfilter", "filter2");
   if (!pipeline || !source || !h264parser || !decoder || !pgie ||
-      !nvtracker || !sgie1 || !sgie2 || !sgie3 || !filter1 || !nvvidconv ||
+      !nvtracker || !sgie3 || !filter1 || !nvvidconv ||
       !filter2 || !nvosd || !sink) {
     g_printerr ("One element could not be created. Exiting.\n");
     return -1;
@@ -317,8 +313,6 @@ main (int argc, char *argv[])
   /* Set all the necessary properties of the nvinfer element,
    * the necessary ones are : */
   g_object_set (G_OBJECT (pgie), "config-file-path", PGIE_CONFIG_FILE, NULL);
-  g_object_set (G_OBJECT (sgie1), "config-file-path", SGIE1_CONFIG_FILE, NULL);
-  g_object_set (G_OBJECT (sgie2), "config-file-path", SGIE2_CONFIG_FILE, NULL);
   g_object_set (G_OBJECT (sgie3), "config-file-path", SGIE3_CONFIG_FILE, NULL);
 
   /* we add a message handler */
@@ -331,7 +325,7 @@ main (int argc, char *argv[])
   /* we add all elements into the pipeline */
   /* decoder | pgie1 | nvtracker | sgie1 | sgie2 | sgie3 | etc.. */
   gst_bin_add_many (GST_BIN (pipeline),
-      source, h264parser, decoder, pgie, nvtracker, sgie1, sgie2, sgie3,
+      source, h264parser, decoder, pgie, nvtracker, sgie3,
       filter1, nvvidconv, filter2, nvosd, sink, NULL);
   caps1 = gst_caps_from_string ("video/x-raw(memory:NVMM), format=NV12");
   g_object_set (G_OBJECT (filter1), "caps", caps1, NULL);
@@ -341,8 +335,8 @@ main (int argc, char *argv[])
   gst_caps_unref (caps2);
 
   /* Link the elements together */
-  gst_element_link_many (source, h264parser, decoder, pgie, nvtracker, sgie1,
-      sgie2, sgie3, filter1, nvvidconv, filter2, nvosd, sink, NULL);
+  gst_element_link_many (source, h264parser, decoder, pgie, nvtracker,
+      sgie3, filter1, nvvidconv, filter2, nvosd, sink, NULL);
 
 
   /* Lets add probe to get informed of the meta data generated, we add probe to