How to get meta data from deepstream app yolo example

Hello, I a, using deepstream 5.0 yolo example

deepstream-app -c deepstream_app_config_yoloV3_tiny.txt

my question is I want to know the detection box co-ordinates, objectid, frame in which object is detected. which file shall i edit to add a probe? and can someone share example probe?

device Jetson Nano


Please read the function - NvDsInferParseCustomYoloV3Tiny() in /opt/nvidia/deepstream/deepstream-5.0/sources/objectDetector_Yolo/nvdsinfer_custom_impl_Yolo/nvdsparsebbox_Yolo.cpp

1 Like

okay I’ll check it.

What shall i edit in this function? i can’t find any metadata variables.

extern “C” bool NvDsInferParseCustomYoloV3Tiny(
std::vector const& outputLayersInfo,
NvDsInferNetworkInfo const& networkInfo,
NvDsInferParseDetectionParams const& detectionParams,
std::vector& objectList)
static const std::vector kANCHORS = {
10, 14, 23, 27, 37, 58, 81, 82, 135, 169, 344, 319};
static const std::vector<std::vector> kMASKS = {
{3, 4, 5},
//{0, 1, 2}}; // as per output result, select {1,2,3}
{1, 2, 3}};

return NvDsInferParseYoloV3 (
outputLayersInfo, networkInfo, detectionParams, objectList,

You didn’t mentione you want to access them via metadata.
please check metadata sample - /opt/nvidia/deepstream/deepstream-5.0/sources/apps/sample_apps/deepstream-user-metadata-test

Ain’t I suppose to modify this function to obtain metadata?

Where do you want to access the meta ?

yes, I don’t know that. which program file shall I edit to add a probe to get the metadata

Since you didn’t provide why & where you want to access the meta, you could firtsly read sample /opt/nvidia/deepstream/deepstream-5.0/sources/apps/sample_apps/deepstream-user-metadata-test .

1 Like

I am using a custom yolov3 tiny model with this command

deepstream-app -c deepstream_app_config_yoloV3_tiny.txt

I want to access the detection box coordinates and the frame in which detection happened to crop the detected object and save it in a directory. from the above command I cannot understand which file shall I edit to get this information. in case of

python3 source1 source2

I know that to add a probe or to make any changes I can edit the “”

you need to add a probe function on the source pad of the primary gie.

Reference Code#1:
File :/opt/nvidia/deepstream/deepstream-5.0/sources/apps/sample_apps/deepstream-gst-metadata-test/deepstream_gst_metadata.c

static GstPadProbeReturn
nvinfer_src_pad_buffer_probe (GstPad * pad, GstPadProbeInfo * info,
    gpointer u_data)
  GstBuffer *buf = (GstBuffer *) info->data;
  NvDsMetaList * l_frame = NULL;
   ....   // get the meta data, meta data include the BBOX info
    return GST_PAD_PROBE_OK;

main (int argc, char *argv[])
  GMainLoop *loop = NULL;
  infer_src_pad = gst_element_get_static_pad (pgie, "src");
  if (!infer_src_pad)
    g_print ("Unable to get source pad\n");
    gst_pad_add_probe (infer_src_pad, GST_PAD_PROBE_TYPE_BUFFER,
        nvinfer_src_pad_buffer_probe, NULL, NULL);
  gst_object_unref (infer_src_pad);

Reference Code#2:
File : /opt/nvidia/deepstream/deepstream/sources/apps/sample_apps/deepstream-app/deepstream_app.c
Buffer probe function to get the results of primary infer.
Here it demonstrates the use by dumping bounding box coordinates in
kitti format.
static GstPadProbeReturn
gie_primary_processing_done_buf_prob (GstPad * pad, GstPadProbeInfo * info,
gpointer u_data)
GstBuffer *buf = (GstBuffer *) info->data;
AppCtx *appCtx = (AppCtx *) u_data;
NvDsBatchMeta *batch_meta = gst_buffer_get_nvds_batch_meta (buf);
if (!batch_meta) {
NVGSTDS_WARN_MSG_V (“Batch meta not found for buffer %p”, buf);

write_kitti_output (appCtx, batch_meta);


1 Like

Thanks I’ll see