Deepstream-test3 osd not work

Please provide complete information as applicable to your setup.

**• Hardware Platform (Jetson / GPU)**Jetson
• DeepStream Version5.1
• JetPack Version (valid for Jetson only)
• TensorRT Version7.1
• NVIDIA GPU Driver Version (valid for GPU only)
**• Issue Type( questions, new requirements, bugs)**bugs
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

I just modify below code,but the text not show in the screen.

/* By default, OSD process-mode is set to CPU_MODE. To change mode, set as:

  • 1: GPU mode (for Tesla only)
  • 2: HW mode (For Jetson only)
    */
    #define OSD_PROCESS_MODE 2

/* By default, OSD will not display text. To display text, change this to 1 */
#define OSD_DISPLAY_TEXT 1

static GstPadProbeReturn
tiler_src_pad_buffer_probe (GstPad * pad, GstPadProbeInfo * info,
gpointer u_data)
{
GstBuffer *buf = (GstBuffer *) info->data;
guint num_rects = 0;
NvDsObjectMeta *obj_meta = NULL;
guint vehicle_count = 0;
guint person_count = 0;
NvDsMetaList * l_frame = NULL;
NvDsMetaList * l_obj = NULL;
NvDsDisplayMeta *display_meta = NULL;

NvDsBatchMeta *batch_meta = gst_buffer_get_nvds_batch_meta (buf);

for (l_frame = batch_meta->frame_meta_list; l_frame != NULL;
  l_frame = l_frame->next) {
    NvDsFrameMeta *frame_meta = (NvDsFrameMeta *) (l_frame->data);
    int offset = 0;
    for (l_obj = frame_meta->obj_meta_list; l_obj != NULL;
            l_obj = l_obj->next) {
        obj_meta = (NvDsObjectMeta *) (l_obj->data);
        if (obj_meta->class_id == PGIE_CLASS_ID_VEHICLE) {
            vehicle_count++;
            num_rects++;
        }
        if (obj_meta->class_id == PGIE_CLASS_ID_PERSON) {
            person_count++;
            num_rects++;
        }
    }
      g_print ("Frame Number = %d Number of objects = %d "
        "Vehicle Count = %d Person Count = %d\n",
        frame_meta->frame_num, num_rects, vehicle_count, person_count);

#if 1
display_meta = nvds_acquire_display_meta_from_pool(batch_meta);
NvOSD_TextParams *txt_params = &display_meta->text_params[0];
txt_params->display_text = g_malloc0 (MAX_DISPLAY_LEN);
offset = snprintf(txt_params->display_text, MAX_DISPLAY_LEN, "Person = %d ", person_count);
offset = snprintf(txt_params->display_text + offset , MAX_DISPLAY_LEN, "Vehicle = %d ", vehicle_count);

    /* Now set the offsets where the string should appear */
    txt_params->x_offset = 10;
    txt_params->y_offset = 12;

    /* Font , font-color and font-size */
    txt_params->font_params.font_name = "Serif";
    txt_params->font_params.font_size = 10;
    txt_params->font_params.font_color.red = 1.0;
    txt_params->font_params.font_color.green = 1.0;
    txt_params->font_params.font_color.blue = 1.0;
    txt_params->font_params.font_color.alpha = 1.0;

    /* Text background color */
    txt_params->set_bg_clr = 1;
    txt_params->text_bg_clr.red = 0.0;
    txt_params->text_bg_clr.green = 0.0;
    txt_params->text_bg_clr.blue = 0.0;
    txt_params->text_bg_clr.alpha = 1.0;

    nvds_add_display_meta_to_frame(frame_meta, display_meta);

#endif

}
return GST_PAD_PROBE_OK;

}

Hey customre, Can you share your code as the markdown format or just upload the diff file with us, so it will be more easy to read what you change.

Thanks.

46c46
< #define OSD_PROCESS_MODE 2
---
> #define OSD_PROCESS_MODE 0
49c49
< #define OSD_DISPLAY_TEXT 1
---
> #define OSD_DISPLAY_TEXT 0
84d83
< //    todo osd not work
92c91
<     NvDsDisplayMeta *display_meta = NULL;
---
>     //NvDsDisplayMeta *display_meta = NULL;
99c98
<         int offset = 0;
---
>         //int offset = 0;
115c114
< #if 1
---
> #if 0
117c116
<         NvOSD_TextParams *txt_params  = &display_meta->text_params[0];
---
>         NvOSD_TextParams *txt_params  = &display_meta->text_params;
136c135
<         txt_params->text_bg_clr.red = 255.0;
---
>         txt_params->text_bg_clr.red = 0.0;
466,471c465,466
< //  tiler_src_pad = gst_element_get_static_pad (pgie, "src");
<     tiler_src_pad =gst_element_get_static_pad (nvosd, "sink");
< 
< 
< 
<     if (!tiler_src_pad)
---
>   tiler_src_pad = gst_element_get_static_pad (pgie, "src");
>   if (!tiler_src_pad)

So the text disappear when you apply the change?

It just show object box,but don’t show the text.

have you set the correct label for the detector?
In additon, does it work when you input only one stream?

yeah,I have set it.this label is work,but this function(nvds_add_display_meta_to_frame) not work.

There is no update from you for a period, assuming this is not an issue any more.
Hence we are closing this topic. If need further support, please open a new one.
Thanks

Hey @1022556987, have you solved the problem?