I am trying to get the nvinfer meta data but gst_buffer_get_nvds_batch_meta always returns null;
Here is my pipeline uridecodebin → nvinfer → nvvideoconvert → appsink
What I tried.
NvDsBatchMeta *batch_meta = gst_buffer_get_nvds_batch_meta (buf);
if (!batch_meta) {
// this is always true
}
But this always returns null.
Also tried
for (l_frame = batch_meta->frame_meta_list; l_frame != NULL;
l_frame = l_frame->next) {
// this gives segfault, because batch_meta is null
}
I just want to get the metadata that nvinfer added i.e bounding boxes, classes etc.
Background.
I am trying to separate the pipeline (reason being the user will choose which plugins to run) . So I will have something like:
decode stream uridecodebin → appsink // then pass frame data to next pipeline
run inference appsrc-> nvinfer → appsink then pass frame data to another application
Below is the config file used:
[property]
gpu-id=0
net-scale-factor=0.0039215697906911373
model-file=…/…/…/…/samples/models/Primary_Detector/resnet10.caffemodel
proto-file=…/…/…/…/samples/models/Primary_Detector/resnet10.prototxt
labelfile-path=…/…/…/…/samples/models/Primary_Detector/labels.txt
int8-calib-file=…/…/…/…/samples/models/Primary_Detector/cal_trt.bin
batch-size=1
network-mode=1
num-detected-classes=4
interval=0
gie-unique-id=1
output-blob-names=conv2d_bbox;conv2d_cov/Sigmoid
I hit a similar problem. In my case, I was not using appsink, but rather a custom element downsteam of nvvideoconvert, and there was still some meta, but seems the nvvideoconvert was stripping the tensors that I needed.
Anyway, try a probe function that’s upstream of nvvideoconvert.
In my case, it was removing the tensors, because those were in GPU memory and my element (at the time) didn’t have the (memory:NVMM) feature on its upstream caps. However, there was still NvDsBatchMeta. So, it’s not exactly your case.
Anyway, did you try adding nvstreammux? I had that, and the docs say that what initially creates the NvDsBatchMeta.
It says: “The basic metadata structure NvDsBatchMeta starts with batch level metadata, created inside the Gst-nvstreammux plugin. Subsidiary metadata structures hold frame, object, classifier, and label data.”