Get class_probabilities_map of NvDsInferSegmentationMeta using pyds

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) dGPU
• DeepStream Version 6.2
• 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)

hello
Deepstream app is being developed using the pyds library provided at GitHub - NVIDIA-AI-IOT/deepstream_python_apps: DeepStream SDK Python bindings and sample applications

By the way, NvDsInferSegmentationMeta The class_map information of segmeta, which can be known through the above, can be obtained because the API (pyds.get_segmentation_masks(segmeta)) is supported, class_probabilities_map is not supported.

So, I wrote it as below, but it is not parsed well (only one value is called), so can the gloat* type be called as an API type only supported by pybind? Or can you call me if there is a code fix?

width, height, num_classes are printed well

def get_class_probabilities_map(meta):
    width = meta.width
    height = meta.height
    num_classes = meta.classes
    probabilities_ptr = meta.class_probabilities_map

    probabilities = np.ctypeslib.as_array(probabilities_ptr, shape=(num_classes, height, width))

    return probabilities

...

probabilities = get_class_probabilities_map(segmeta)
probabilities = np.array(probabilities, copy=True, order='C')

binding code is opensource. please refer to this code get_segmentation_masks

Ah yes, I think I can do it with pybind11, but is there any other way to import the gfloat* array directly from python native?

please refer to this code: get_mask_array, it tries to convert float data.

Yes, what you showed is pybind after all, so what I want to do is only possible with pybind? named get_class_probabilities_map

yes. as you know, deepstream sdk is a C lib, python uses deepstream sdk by python binding.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.