• Hardware Platform (Jetson / GPU) : NVIDIA Jetson AGX Orin
• DeepStream Version : 7.1
• JetPack Version (valid for Jetson only) : 6.1
• TensorRT Version : 8.6.2.3
• Issue Type( questions, new requirements, bugs) : question
Hello,
I am working with a DeepStream inference pipeline in Python with the following setup:
nvstreammux -> queue0 -> PGIE0 -> queue1 -> PGIE1 -> fakesink
Both PGIE0 and PGIE1 are segmentation models. I have attached a probe function to fakesink to process the inference results from both models. It looks like this:
pyds.nvds_acquire_meta_lock(batch_meta)
l_frame = batch_meta.frame_meta_list
while l_frame is not None:
try:
frame_meta = pyds.NvDsFrameMeta.cast(l_frame.data)
except StopIteration:
break
# Process all user metadata to collect masks
l_user = frame_meta.frame_user_meta_list
while l_user is not None:
try:
user_meta = pyds.NvDsUserMeta.cast(l_user.data)
except StopIteration:
break
if (
user_meta
and user_meta.base_meta.meta_type == pyds.NVDSINFER_SEGMENTATION_META
):
try:
segmeta = pyds.NvDsInferSegmentationMeta.cast(
user_meta.user_meta_data
)
except StopIteration:
break
# Retrieve mask data in the numpy format from segmeta
mask = np.array(
pyds.get_segmentation_masks(segmeta),
copy=True,
order="C",
dtype=np.float32,
)
unique_id = segmeta.unique_id
if unique_id == 0:
mask_edge = np.squeeze(mask)
elif unique_id == 1:
mask_line = np.squeeze(mask)
else:
logger.warning(f"Unknown unique_id")
try:
l_user = l_user.next
except StopIteration:
break
try:
l_frame = l_frame.next
except StopIteration:
break
pyds.nvds_release_meta_lock(batch_meta)
To differentiate between them, I attempted to use the unique_id
attribute in NvDsInferSegmentationMeta
. However, I encountered the following error:
AttributeError: 'pyds.NvDsInferSegmentationMeta' object has no attribute 'unique_id'
I found a related discussion on the NVIDIA forum, but it appears that the issue remains unresolved. Upon reviewing the DeepStream Python bindings source code on GitHub NvDsInferSegmentationMeta definition, I realized that NvDsInferSegmentationMeta
is missing the unique_id attribute, even though it is documented in the official DeepStream API reference DeepStream documentation. However in PyDs documentation unique_id property is not visible.
Is this a known issue, and is there a fix available? Would adding the following line in the Python bindings resolve the problem?
.def_readonly("unique_id", &NvDsInferSegmentationMeta::unique_id)
Is there any other way to determine from which segmentation model has user_meta came from?
Any insights or potential workarounds would be greatly appreciated.