How to get the results of classification of sgie with deepstream4.x using c++ sdk

we set the plugin “nvdsosd”
gst_pad_add_probe(osd_sink_pad, GST_PAD_PROBE_TYPE_BUFFER, callback_osd, data, NULL), where the “osd_sink_pad” is the sink pad of plugin “nvdsosd”, and we want to get the results of classification of sgie in the function callback_osd.

Could you share your setup?

Thanks for your reply!

I just used the deestream 4.0 example “deepstream_sdk_v4.0.1_x86_64/sources/apps/sample_apps/deepstream-test2”,

in the probe function
“static GstPadProbeReturn osd_sink_pad_buffer_probe (GstPad * pad, GstPadProbeInfo * info, gpointer u_data)”,
i added the following code to show the classification result of sgie:

for (l = obj_meta->classifier_meta_list; l != NULL; l = l->next) {
NvDsClassifierMeta* classifierMeta = (NvDsClassifierMeta*) (l->data);
for (n = classifierMeta->label_info_list; n != NULL; n = n->next) {
NvDsLabelInfo* labelInfo = (NvDsLabelInfo*) (n->data);
std::cout << result_label << ": " << result_prob << std::endl;
}
}

however, there was nothing printed with car object detected.

Hi,
We can see result_label printed after applying the patch:

diff --git a/apps/deepstream/sample_apps/deepstream-test2/deepstream_test2_app.c b/apps/deepstream/sample_apps/deepstream-test2/deepstream_test2_app.c
index 5c16dca..79c3e0c 100644
--- a/apps/deepstream/sample_apps/deepstream-test2/deepstream_test2_app.c
+++ b/apps/deepstream/sample_apps/deepstream-test2/deepstream_test2_app.c
@@ -109,6 +109,18 @@ osd_sink_pad_buffer_probe (GstPad * pad, GstPadProbeInfo * info,
             if (obj_meta->class_id == PGIE_CLASS_ID_VEHICLE) {
                 vehicle_count++;
                 num_rects++;
+
+                NvDsMetaList * l = NULL;
+                NvDsMetaList * n = NULL;
+                for (l = obj_meta->classifier_meta_list; l != NULL; l = l->next)
+                {
+                    NvDsClassifierMeta* classifierMeta = (NvDsClassifierMeta*) (l->data);
+                    for (n = classifierMeta->label_info_list; n != NULL; n = n->next)
+                    {
+                        NvDsLabelInfo* labelInfo = (NvDsLabelInfo*) (n->data);
+                        g_print("[%d] label: %s \n ", vehicle_count, &labelInfo->result_label[0]);
+                    }
+                }
             }
             if (obj_meta->class_id == PGIE_CLASS_ID_PERSON) {
                 person_count++;

FYR.

Hi, DaneLLL, thanks for your reply!

We did what you showed in the osd_sink_pad_buffer_probe, and when the sgie of single label classifier used, everything work fine, however the sgie in our procedure is a multi label classifier, the head node of classifierMeta->label_info_list is always null.
we showed the config file of the sgie in this topic:

could you give me some advices, thank you!

Hi,
For clearness, please continue in the new created topic: