Please provide complete information as applicable to your setup.
• Hardware Platform (Jetson / GPU): RTX 2080
• DeepStream Version: 10.2
• JetPack Version (valid for Jetson only)
• TensorRT Version: 7.0
• NVIDIA GPU Driver Version (valid for GPU only):410.xx
I want to access the output segmentation mask using python API through probe function and save it to disk as image with Opencv and numpy array. As I read, the metadata belongs to NvDsUserMeta which can be achieved through frame_user_meta_list to get the NvDsInferSegmentationMeta. So the flow I understand is somehow like this:
def tiler_sink_pad_buffer_probe(pad,info,u_data): frame_number=0 num_rects=0 gst_buffer = info.get_buffer() if not gst_buffer: print("Unable to get GstBuffer ") return # Retrieve batch metadata from the gst_buffer # Note that pyds.gst_buffer_get_nvds_batch_meta() expects the # C address of gst_buffer as input, which is obtained with hash(gst_buffer) batch_meta = pyds.gst_buffer_get_nvds_batch_meta(hash(gst_buffer)) l_frame = batch_meta.frame_meta_list user_meta_list = l_frame.frame_user_meta_list while user_meta_list is not None: user_meta = pyds.NvDsUserMeta.cast(user_meta_list.data) mask = user_meta.user_meta_data.class_map
So the mask value here is currently the pointer to the map containing class type like 0 or 1 of the output segmentation mask. So I would really want to know how to get the data into numpy array from the pointer value. Or can you give me another proper approach to this. I follow the deepstream-imagemeta-multistream.py example but this only convert the original image from gst_buffer.