Please provide complete information as applicable to your setup.
• Hardware Platform (Jetson / GPU)
• DeepStream Version
• JetPack Version (valid for Jetson only)
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs)
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)
Hi! I am having problem to access the source_id of my batch_user_meta_list.
In my pipeline I have streammux → preprocess → pgie1 → pgie2 -->tracker → tiler → nvvidconv → nvvidconv_postosd → caps → encoder → rtppay → sink
I have a prob function at the src pad of pgie1.
I have 6 no. of source but my preprocess element works on 3 of them. Then my pgie1 outputs the tensor meta for these 3 sources roi.
My probe function is defined as:
def tiler_sink_pad_buffer_probe_v2(pad,info, u_data):
frame_number=0
gst_buffer = info.get_buffer()
if not gst_buffer:
print("Unable to get GstBuffer ")
return
batch_meta = pyds.gst_buffer_get_nvds_batch_meta(hash(gst_buffer))
l_frame = batch_meta.frame_meta_list
l_user = batch_meta.batch_user_meta_list
source_idx = [] # To store the source id in order as they appear in each batch
array1 = [] # To store the source id that is in preprocess config file as they appear in meta
while l_frame is not None:
try:
frame_meta = pyds.NvDsFrameMeta.cast(l_frame.data)
except StopIteration:
break
# Get the source id for this batch
source_id = frame_meta.source_id
frame_number = frame_meta.frame_num
source_idx.append(source_id)
# This code will be executed when all the frames in batch is processed and we get the source id in order
if len(source_idx) == 6:
print("---------------------------------------------------")
print("Frame NO:{}".format(frame_number))
print(source_idx)
print("---------------------------------------------------")
for i in source_idx:
if i in hardcoded_source_ids: # hardcoded_source_ids represents the sources that will go under preprocess element
array1.append(i)
if len(array1) == len(hardcoded_source_ids):
print(array1)
j = 0
while l_user is not None:
user_meta= pyds.NvDsUserMeta.cast(l_user.data)
# print(dir(user_meta))
# print(dir(user_meta.base_meta))
# print(user_meta.user_meta_data)
if user_meta and user_meta.base_meta.meta_type == pyds.NVDSINFER_TENSOR_OUTPUT_META:
try:
tensor_meta = pyds.NvDsInferTensorMeta.cast(user_meta.user_meta_data)
#print(dir(tensor_meta))
#print(tensor_meta.network_info)
#print(tensor_meta.num_output_layers)
#print(tensor_meta.output_layers_info)
except StopIteration:
break
layer = pyds.get_nvds_LayerInfo(tensor_meta, 0)
ptr = ctypes.cast(pyds.get_ptr(layer.buffer), ctypes.POINTER(ctypes.c_float))
features = np.ctypeslib.as_array(ptr, shape=(4,))
labels = ['green', 'none', 'red', 'yellow']
max_index = np.argmax(features)
#print(len(array1))
print("Source = {} Frame Number = {} label = {}".format(array1[j], frame_number, labels[max_index]))
j +=1
l_user=l_user.next
try:
l_frame = l_frame.next
except StopIteration:
break
return Gst.PadProbeReturn.OK
So the problem i am facing is that my source_id for the label doesn’t match with their actual source id.
I tried to see all the objects in the batch_user_meta_list but i didn’t find the source_id associated with that meta anywhere.
So how can i get the correct label for the correct source_id???
Your idea and help will be very crucial. Thank you in advance!