Can not change background color of rect_params on Jetson Xavier Platform

• Hardware Platform Jetson Xavier
• DeepStream Version 5.0 Python bindings

Editing the deepstream-test1-app python, I want to change the background color to yellow:

while l_obj is not None:
            try:
                # Casting l_obj.data to pyds.NvDsObjectMeta
                #obj_meta=pyds.glist_get_nvds_object_meta(l_obj.data)
                obj_meta=pyds.NvDsObjectMeta.cast(l_obj.data)
            except StopIteration:
                break
            obj_counter[obj_meta.class_id] += 1
            obj_meta.rect_params.has_bg_color = 1
            obj_meta.rect_params.bg_color.set(1.0, 1.0, 0.0, 0.4)
            obj_meta.rect_params.border_color.set(1.0, 1.0, 0.0, 1.0)

            try: 
                l_obj=l_obj.next
            except StopIteration:
                break

but the result is

It’s seem the bg_color is always green even I change the any value of bg_color.
I tested with the same codes above on dGPU (1050). It’s work.
Bests,

Hi,
It looks specific to Jetson platforms. We will try to reproduce it.

hi,
We can reproduce it on Xavier/r32.4.2. Will investigate and update.

1 Like

Hi,
This will be fixed in next release.

Thank you, looking foward for next release.

Any update? When there will be the release with the fix?

Hi federico.frontali,

We will have the next in coming weeks, please wait for our announcement.

I have updated to DS5.0GA and I still cannot change the background color - no matter what settings its always green! Changing the border colors work fine.

I have just noticed that in 5.0GA you have made the OSD source available.

If I specifically override the default and set the process-mode for the OSD element to CPU then the background colors work.

If I leave the default, which is VIC for tegra - the background colours are always green regardless of what RGBA values are provided.

There is also a setting for hw-blend-color-attr. I don’t really understand what this is so some more information and an example would be really helpful.
It seems that when the process-mode is VIC that this property is read for background colours instead of the RGBA properties in rect_params.
The problem with hw-blend-color-attr is that its defined per class id which means it will show that background color whenever there is a detection no matter what. I lose the power of being able to control when to show the background color.

As an example - when an object is stationary I want to change the background color. This does not seem to be possible with the hw-blend-color-attr.

Hi,
We have verified in workng by setting osd property hw-blend-color-attr:

hw-blend-color-attr=0,1.0,1.0,0.0,0.3:1,0.0,1.0,1.0,0.3:2,0.0,0.0,1.0,0.3:3,0.0,1.0,0.0,0.3

Please give it a try.

Please explain how this property can be used to shade a box only on certain events from within a pad probe? It does not look like it can.

An example use case is this:

You have a region of interest and only want to shade bboxes that are inside the roi. I can do this via a pad probe and updating the values in rect_params - however it only works if process_mode is CPU.

Maybe the hw-blend-color-attr property should be added to NvOSD_RectParams so that it can be dynamically changed.

Hi,
If you would needs to update colors dynamically, CPU mode has to be used. VIC mode will require initialization of colors using the property(hw-blend-color-attr) at init time.

Hi,
On a Jetson Xavier AGX in test3

When i modify the rect_params in my osd_tiler_pad, the rectangles no longer render, but the black label does

    l_obj = frame_meta.obj_meta_list
    while l_obj is not None:
        # try:
        # Casting l_obj.data to pyds.NvDsObjectMeta
        # obj_meta = pyds.NvDsObjectMeta.cast(l_obj.data)
        try:
            obj_meta = pyds.NvDsObjectMeta.cast(l_obj.data)
            rect_params = obj_meta.rect_params  # NvOSD_RectParams *
            text_params = obj_meta.text_params  # NvOSD_TextParams *

            rect_params.has_bg_color = 1
            rect_params.bg_color.set(0.0, 1.0, 0.0, 1.0)
            rect_params.has_bg_color = 1
            rect_params.bg_color.set(1.0, 1.0, 0.0, 0.4)

even if i set:
nvosd.set_property(‘process-mode’,0)

regards Andrew

@DaneLLL

Is there an example in the samples to illustrate modifying rect_params, border_color, bg_color, especially with Jetson hardware. what configs need to be applied/modified .

Example imagedata-multistream has access to the buffers, and does rect drawing but this is on a np array and is not what I’m looking for.

There are plenty of examples where they access the text_params but from what ive seen I cant find examples for changing obj colours

regards Andrew

Hi @Andrew_Smith
Please make a new topic for your issue. This topic reports an issue and we have fixed in in DS5.0 GA. Your usecase might be a new issue and for clearness, we suggest start a new topic.

Is it really fixed? Just downloaded latest DeepStream SDK 5.0.1-1arm64 and there is still the same issue:

obj_meta.rect_params.has_bg_color = 1
obj_meta.rect_params.bg_color.set( 0.8, 0.0, 0.0, 0.2 )

causes green filling instead of red.

Hi,
It is suggested in this comment. Please set the property in nvdsosd:

  process-mode        : Rect and text draw process mode
                        flags: readable, writable, changeable only in NULL or READY state
                        Enum "GstNvDsOsdMode" Default: 2, "HW_MODE"
                           (0): CPU_MODE         - CPU_MODE
                           (1): GPU_MODE         - GPU_MODE, yet to be implemented for Tegra
                           (2): HW_MODE          - HW_MODE. Only for Tegra. For rectdraw only.
1 Like

@DaneLLL,

Thank you. I have tested, and CPU mode works for me as expected.
However I noticed one thing. I have H264 FullHD source stream at 25 fps rate. When I use VIC mode I get fps down to 22 (due to lack of some resources) in gstreamer pipeline, but when I change to CPU mode (and this is the only change), I get 25 fps, and no performance issues. Is this expected?

To be more accurate, I run ds inference on the stream, and modify meta in pad handler before nvosd item.