Deepstream_mrcnn_test could not output mask

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) Jetson Xavier AGX
• DeepStream Version 5.1.0
• JetPack Version (valid for Jetson only) 4.5-b129
• TensorRT Version 7.1.3-1
• Issue Type( questions, new requirements, bugs) bugs

I trained a Maskrcnn model with my own data on TLT and deployed it on deepstream. My requirement is to get a output video or image sequences with the inference masks on it, no bounding boxs or other information. Also I need to change the color and opacity of the masks to sth like white.

From this post, I was recommanded to refer to c/c++ sample /opt/nvidia/deepstream/deepstream-5.1/sources/apps/sample_apps/deepstream-mrcnn-app

I tried the sample deepstream_mrcnn_test, there’s no masks output on the video, only bbox and its label. How could I make this sample work? And how could change the mask color and opacity? Thanks

Hi,

Please use the configure file located at the below folder:

/opt/nvidia/deepstream/deepstream-5.1/samples/configs/tlt_pretrained_models/deepstream_app_source1_mrcnn.txt
/opt/nvidia/deepstream/deepstream-5.1/samples/configs/tlt_pretrained_models/config_infer_primary_mrcnn.txt

For example, you can run it with deepstream-app -c deepstream_app_source1_mrcnn.txt.
Below is our output for your reference:

The main difference is that you will need to add the mask-related configure to the OSD component as below:

[osd]
enable=1
gpu-id=0
border-width=3
text-size=15
text-color=1;1;1;1;
text-bg-color=0.3;0.3;0.3;1
font=Serif
display-mask=1                  # enable mask
display-bbox=0
display-text=0

Thanks.

I’m good at using deepstream-app -c deepstream_app_source1_mrcnn.txt for outputing the mask just as you did. But I need to change the color of the mask to be the same, and also change the mask opacity. So I take the /opt/nvidia/deepstream/deepstream/sources/apps/sample_apps/deepstream-mrcnn-test/deepstream_mrcnn_test.cpp for reference.

Actually I’ve already added [osd] mask-related configure in /opt/nvidia/deepstream/deepstream/sources/apps/sample_apps/deepstream-mrcnn-test/dsmrcnn_pgie_config.txt.
I also tried /opt/nvidia/deepstream/deepstream-5.1/samples/configs/config_infer_primary_mrcnn.txt with the deepstream-mrcnn-test sample.
But both has no masks shown.

Please see my previous post.

BTW, is there any way else I could change the mask color and opacity? like some configuration?

Hi,

The opacity is fixed to 127, so it cannot be changed.
This feature has been discussed internally and added to our roadmap.

Changing color is much easier by updating the configure file.
For example, changing the color for car (#1) from 0;1;1;1(cray) to 1;1;0;1 (yellow).

[primary-gie]
...
bbox-border-color1=1;1;0;1
...

Thanks.

Thanks. The bbox-border-color1 works.
Is there any way to seperately output the masks of the maskrcnn model?

Hi,

Please check if nvsegvisual component can meet your requirement:

Thanks.

I failed to compile the deepstream-segmentation-analytics by getting the error as below:
What’s problem it would be?

g++ -c -o deepstream_segmentation_app.o  -DPLATFORM_TEGRA -I../../apps-common/includes -I./includes -I../../../includes -I../deepstream-app/ -DDS_VERSION_MINOR=0 -DDS_VERSION_MAJOR=5 -I `pkg-config --cflags gstreamer-1.0 gstreamer-video-1.0 x11 json-glib-1.0` deepstream_segmentation_app.c
g++ -o deepstream-segmentation-analytics deepstream_segmentation_app.o -L/opt/nvidia/deepstream/deepstream-5.0/lib/ -lnvdsgst_meta -lnvds_meta -lnvdsgst_helper -lnvdsgst_smartrecord -lnvds_utils -lnvds_msgbroker -lm -lgstrtspserver-1.0 -ldl -Wl,-rpath,/opt/nvidia/deepstream/deepstream-5.0/lib/ `pkg-config --libs gstreamer-1.0 gstreamer-video-1.0 x11 json-glib-1.0`
/usr/bin/ld: cannot find -lnvdsgst_meta
/usr/bin/ld: cannot find -lnvds_meta
/usr/bin/ld: cannot find -lnvdsgst_helper
/usr/bin/ld: cannot find -lnvdsgst_smartrecord
/usr/bin/ld: cannot find -lnvds_utils
/usr/bin/ld: cannot find -lnvds_msgbroker
/usr/bin/ld: cannot find -lgstrtspserver-1.0
collect2: error: ld returned 1 exit status
Makefile:64: recipe for target 'deepstream-segmentation-analytics' failed
make: *** [deepstream-segmentation-analytics] Error 1

Hi,

Since the sample is built with Deepstream 5.0, please update the Makefile to be compatible for version 5.1.

diff --git a/Makefile b/Makefile
index d3d6385..5570d28 100644
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,7 @@ CC:=g++
 
 TARGET_DEVICE = $(shell gcc -dumpmachine | cut -f1 -d -)
 
-NVDS_VERSION:=5.0
+NVDS_VERSION:=5.1
 
 LIB_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/lib/
 APP_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/bin/

Thanks.