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?
Hi.
Please read the function - NvDsInferParseCustomYoloV3Tiny() in /opt/nvidia/deepstream/deepstream-5.0/sources/objectDetector_Yolo/nvdsinfer_custom_impl_Yolo/nvdsparsebbox_Yolo.cpp
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
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 .
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 imagedataexample.py source1 source2
I know that to add a probe or to make any changes I can edit the “imagedataexample.py”
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;
}
int
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");
else
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);
return GST_PAD_PROBE_OK;
}