Access tensor-meta of SGIE in deepstream Python

Hey,

I have two nvinfers in the pipelines. The primary one is the detector, for the second infer I am somehow not able to access the layer data using the following code.

         l_user = frame_meta.frame_user_meta_list
            while l_user is not None:
                try:
                    # Note that l_user.data needs a cast to pyds.NvDsUserMeta
                    # The casting also keeps ownership of the underlying memory
                    # in the C code, so the Python garbage collector will leave
                    # it alone.
                    user_meta = pyds.NvDsUserMeta.cast(l_user.data)
                except StopIteration:
                    break

                if (
                        user_meta.base_meta.meta_type
                        != pyds.NvDsMetaType.NVDSINFER_TENSOR_OUTPUT_META
                ):
                    continue

                tensor_meta = pyds.NvDsInferTensorMeta.cast(user_meta.user_meta_data)

                # if (
                #          int(tensor_meta.unique_id)
                #          == SGIE_ID
                #  ):
                print("Unique id: {}".format(tensor_meta.unique_id))

                # Boxes in the tensor meta should be in network resolution which is
                # found in tensor_meta.network_info. Use this info to scale boxes to
                # the input frame resolution.
                layers_info = []

                for i in range(tensor_meta.num_output_layers):
                    layer = pyds.get_nvds_LayerInfo(tensor_meta, i)
                    layers_info.append(layer)
                    print("layers name: {}".format(layer.layerName))

I have tried adding this to the SGIE probe, but I only get layer-names and id of PGIE and not SGIE.
Is there something I am missing out on?

Thanks

Hi,

Could you share the unique_id set for PGIE and SGIE with us?
As well as the unique_id value from NvDsInferTensorMeta data.

Thanks.

Hey @AastaLLL
Ya sure

for pgie in pgie_config_file
gie-unique-id=1

for sgie in sgie_config_file
gie-unique-id=2
operate-on-gie-id=1

the output of the PGIE probe
pgie Unique id: 1
pgie layers name: scores
pgie layers name: boxes

an Update - there is no output from the SGIE probe

I added the SGIE probe in the next plugin (tiler) here. I get the following output

sgie Unique id: 1
sgie layers name: scores
sgie layers name: boxes

Hi,

Have you enable output-tensor-meta in the SGIE configure?
You can find an example below:

Thanks.