Nv_osd box background color and bounding box problem

DeepStream 5.1, Nano Jetson Dev Kit

I’m trying to draw a “fence” to the nv_osd using python. Let’s consider I’m at this line:

I’m now going to add this code after Line 116 (after the print):

        pv_nosd_rect_params = display_meta.rect_params[0]
        pv_nosd_rect_params.left = 200
        pv_nosd_rect_params.top = 0
        pv_nosd_rect_params.width = 100 
        pv_nosd_rect_params.height = 480
        pv_nosd_rect_params.border_width = 2
        pv_nosd_rect_params.border_color.red = 0.0
        pv_nosd_rect_params.border_color.green = 1.0
        pv_nosd_rect_params.border_color.blue = 0.0
        pv_nosd_rect_params.border_color.alpha = 1.0

        pv_nosd_rect_params.has_bg_color = 1
        pv_nosd_rect_params.bg_color.red = 0.0
        pv_nosd_rect_params.bg_color.green = 0.0
        pv_nosd_rect_params.bg_color.blue = 1.0
        pv_nosd_rect_params.bg_color.alpha = 0.5

        display_meta.num_rects = 1

The display shown is like so, which is good, except that the background color of the box is green (alpha change is recognised):

Things are getting completely weird, if I change the width parameter to 10:

Now it seems, that the background is not recognising the width of the bounding box and applies an (estimated) width of 20 px in addition to the wrong color.

Any idea?

Common guys, this is not really a big thing, but no answer at all?..

Sorry for the late.
We are checking it and will update you ASAP. Can you also share the whole repro with us so we can save time to move on?

Sure.

Do you need more instructions?

Thanks, I’m trying to repro locally.

I tried same code on a DS 5.1 docker on DGPU since I don’t have a handy Jetson Nano device and it can work well, I will find a Jetson device to see if can repro the issue.
image

Yes, this looks fine. Would you mind to share the docker container ID and what is a DPGU?

https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_docker_containers.html#a-docker-container-for-dgpu
docker pull nvcr.io/nvidia/deepstream:5.1-21.02-devel

Any update here?

The issue did exist in Jetson platform, we are checking internally.

I went for an alternative. Not of interest anymore. Your time constants are too high for my speed :)

sorry for the delay, also give a solution for this issue in case others met the same, this issue caused by the VIC limitation and OSD default process-mode is VIC mode, however the mode is GPU mode for dgpu, that’s why the issue cannot repro on my T4. So currently we can set the process-mode of nvdsosd to GPU mode to bypass the issue.

 nvosd.set_property('process-mode', 1);

Thanks. Could you please tell me more about the difference of process-mode 2 and 1? I’m currently setting process-mode to 2 in my code, if not working completely headless:

        if not self.headless:
            nvosd = Gst.ElementFactory.make("nvdsosd", "onscreendisplay")
            nvosd.set_property('process-mode', 2)   # Hardware
            nvosd.set_property('display-text', 1)   # Enabled
        else:
            nvosd = Gst.ElementFactory.make("fakesink", "onscreendisplay")

Hey, please refer Gst-nvdsosd — DeepStream 6.1.1 Release documentation for more details.

Hehe… I know that… But what does it mean :)?

OSD use VIC low level API to draw the bbox if you set the mode=2, and it will use cuda kernel if mode=1.

Ok, what is “better” w.r.t. performance?

I think that should depend on your use case. e.g. in your pipeline, there are some CNN models which consume more GPU, then better to use VIC mode. otherwise, you can choose GPU mode if you really need to draw the lillte bboxes width or height < 16