The previous topic is general. This one is specific on one method of getting the output vector.
Could you help me with this issue: How to read the buffer data from NvDsInferLayerInfo in Python?
In C, it is done like this to get the different probabilities for every class (from the example deepstream_infer_tensor_meta_test.cpp) :
float *outputCoverageBuffer = (float *) meta->output_layers_info[0].buffer;
float maxProbability = 0;
bool attrFound = false;
NvDsInferAttribute attr;
/* Iterate through all the probabilities that the object belongs to
* each class. Find the maximum probability and the corresponding class
* which meets the minimum threshold. */
for (unsigned int c = 0; c < numClasses; c++) {
float probability = outputCoverageBuffer[c];
if (probability > 0.51 && probability > maxProbability) {
maxProbability = probability;
attrFound = true;
attr.attributeIndex = 0;
attr.attributeValue = c;
attr.attributeConfidence = probability;
}
}
In Python, the buffer is of type PyCapsule. tried to read it using the instruction:
jetson.utils.cudaToNumpy(layers_info[0].buffer)
but got this error:
Exception: jetson.utils – cudaToNumpy() failed to get input CUDA pointer from first arg (should be cudaImage or cudaMemory)