I have a SGIE classifier of which I’d like to obtain the embedding from the last layer using the Python API of Deepstream 5.0.1. I run TensorRT 7.2.1, by requirement for this model.
Inside my application (where I already get the correct bbox from my TensorRT detector, the raw frames, etc), I execute
It appears to me that my model executes correctly and I can’t think of any way of checking that it writes to this field.
I remember with the beta version that some structures that weren’t implemented would return None, is this what’s happening here, or is it my model that is wrong?
I also tried the out_buf_ptrs_host property of pyds.NvDsInferTensorMeta with the same result.
tensor_meta = pyds.NvDsInferTensorMeta.cast(user_meta.user_meta_data)
# 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)
Thanks, I hadn’t seen that there was a Python example for this.
Using the pyds.get_nvds_LayerInfo function I could get it.
It looks like I’ve been able to access the value then like this:
output_layers_info = pyds.get_nvds_LayerInfo(user_meta_data, 0)
for i in range(embedding_size):
print(pyds.get_detections(output_layers_info.buffer, i)
In order to access the whole embedding I had to get the pointer for output_layers_info.buffer and do np.ctypeslib.as_array(ptr, shape=(embedding_size,)) but it would be ideal if there was a pyds method for this?