Retrieve the vector from output_layer.buffer

I have a regression model that has one layer with output shape 1x11x20
so i use metaTensorData and this function here:

All is working well but i need to get the output vector itself from that one and only layer i have,
So how to retrieve the output_layer.buffer, i want something that replace the ```
pyds.get_detections(output_layer.buffer, 0)


For a suppport, here's the reproduce of the function that mentioned in the link for my model:
> 
> import sys
> import pyds
> 
> 
> def layer_finder(output_layer_info, name):
>     """ Return the layer contained in output_layer_info which corresponds
>         to the given name.
>     """
>     for layer in output_layer_info:
>         # dataType == 0 <=> dataType == FLOAT
>         if layer.dataType == 0 and layer.layerName == name:
>             return layer
>     return None
> 
> 
> def nvds_infer_parse_custom_crowd_count(output_layer_info):
>     output_layer = layer_finder(output_layer_info, "output")
> 
> 
>     print("output", output_layer)
> 
>     if not output_layer:
>         sys.stderr.write("ERROR: output layer is missing in output tensors\n")
>         return []
> 
>     num_detection = 0
>     print("output_layer.buffer", output_layer.buffer)
> 
>     if output_layer.buffer:
>         num_detection = int(pyds.get_detections(output_layer.buffer, 0))
>         print("num detection", num_detection)


**• Hardware Platform (GPU)**
**• DeepStream 5**
**• TensorRT 7.0.0**

@bcao
This is another dependent problem of this question , but it’s more specific xD

Hey, pyds.get_detections only get one element one time from the buffer, so you need to iterate on the buffer to get the whole 1x11x20 elements.

1 Like

found this solution,
and it worked for me

1 Like

Great work.

1 Like

Thank you very much for your help