NVInfer -> NVDsOsd boundingBox info

Hi

By default, deepstream SDK suggest to use NvInfer as object detector/classifier and NvDsOds as for adding boundingBox/label information (before final render sink).
Pipeline: (some src) -> nvInfer -> nvdsOds -> (some sink) (i took out all video converters, queue etc just to avoid extra space usage, cause anyway question are not related to it)

For example, i need some bbox/object_class information not for visual presentation only. One of the option i found is to use buffer probe:

We just add some buffer probe to nvinfer “src” or nvdsosd “sink” pad and get required data from *Meta objects.

Here the source (from Deepstream-app):

GstPad * pOsdSinkPad = gst_element_get_static_pad(bin->nvosd, “sink”);
gst_pad_add_probe(pOsdSinkPad, GST_PAD_PROBE_TYPE_BUFFER, osd_buffer_probe, NULL, NULL);

And corresponsing function to get/parse meta data:

[i]static GstPadProbeReturn osd_buffer_probe(GstPad * pPad, GstPadProbeInfo * pInfo, gpointer pData) {

GstBuffer 		* pBuffer = (GstBuffer *)pInfo->data;
NvDsMetaList 		* pMetaList = NULL;
    NvDsBatchMeta 		* pBatchMeta = gst_buffer_get_nvds_batch_meta(pBuffer);
NvDsObjectMetaList      * pMetaObjList;
NvDsObjectMeta          * pMetaObj;

for (pMetaList = pBatchMeta->frame_meta_list; pMetaList != NULL ; pMetaList = pMetaList->next) {
	NvDsFrameMeta * pFrameMeta = (NvDsFrameMeta *) (pMetaList->data);

	for (pMetaObjList = pFrameMeta->obj_meta_list; pMetaObjList != NULL; pMetaObjList = pMetaObjList->next) {
		pMetaObj = (NvDsObjectMeta*)pMetaObjList;
		guint uClass 		= pMetaObj->class_id;
		guint uLeft  		= pMetaObj->rect_params.left;
		guint uTop   		= pMetaObj->rect_params.top;
		guint uWidth  	  	= pMetaObj->rect_params.width;
		guint uHeight	  	= pMetaObj->rect_params.height;

		g_print("Class: %d Rect: x:%u y:%u w:%u h:%u\n",
				uClass,
				uLeft,
				uTop,
				uWidth,
				uHeight);
	}
}

return GST_PAD_PROBE_OK;

}[/i]

Meta objects are available for frames with detected objects BUT all information i get is incorrect (x, y, width, height, class). Is there any example of meta object parsing (some logger, serialiser for meta objects f.e. to JSON or etc)? or maybe my approach is not correct? Tnx for any advice.

Hi,

Meta objects are available for frames with detected objects BUT all information i get is incorrect (x, y, width, height, class)

Can you specify what exactly is incorrect ? may be through a sample output you are seeing from the print statement ?

Could you also provide the config file for deepstream-app with which you observed this behavior ?

Hi,

Launch string:
./deepstream-app -c …/samples/configs/deepstream-app/source1_csi_dec_infer_resnet_int8.txt

Incorrect output example (value may be different, according datasheet all values except class are unsigned int)

Class: 1751330153 Rect: x:0 y:0 w:0 h:1970565217
Class: 0 Rect: x:0 y:0 w:0 h:0
Class: 85 Rect: x:0 y:0 w:0 h:0
Class: 85 Rect: x:0 y:0 w:0 h:0
Class: 0 Rect: x:2850936992 y:85 w:2850953984 h:85

Please note that this output shows up only when some objects detected (at least it looks like).
If any other information required please tell me.

PS deepstream-app source was modified due to add probe pad.

PS deepstream-app source was modified due to add probe pad

Can you specify how this is being done ?

You can read bounding box co-ordinates in test-1 / test-2 apps too. You can have a look at the “osd_sink_pad_buffer_probe” functions in these apps where the metadata is being parsed.

Hi,
Thanks for reply,
It was my stupid mistake
(NvDsObjectMeta*)pMetaObjList should be (NvDsObjectMeta*) (pMetaObjList->data);
Topic might be closed
Tnx