deepstream_lpr_app icon indicating copy to clipboard operation
deepstream_lpr_app copied to clipboard

Fix wrong confidence values

Open aler9 opened this issue 2 years ago • 1 comments

Confidence is currently transferred from TensorRT network to Deepstream in a wrong way, resulting in random values.

The LPR network has two output layers:

1   OUTPUT kINT32 tf_op_layer_ArgMax 24              
2   OUTPUT kFLOAT tf_op_layer_Max 24              

The first is a 24x1 vector that contains detected characters, the second is a 24x1 vector that contains the confidence of each detected character.

At the moment, confidence of each detected character is extracted by using the detected character as key to the confidence vector.

int curr_data = outputStrBuffer[seq_id];
...
bank_softmax_max[valid_bank_count] = outputConfBuffer[curr_data];

i.e., if the 2nd element of the detection vector is character 'Z', that is the 34th character listed in the dict file, its confidence is assumed to be the 34th element of the confidence vector (that doesn't even exist), while it should be the one correspondent to the order in which the character was detected (in this case the 2nd element of the confidence vector).

This should be:

int curr_data = outputStrBuffer[seq_id];
...
bank_softmax_max[valid_bank_count] = outputConfBuffer[seq_id];

This patch fixes the issue.

aler9 avatar Apr 26 '22 13:04 aler9

+1. Not sure why this hasn't been merged yet. I'll post over in their developer forum to see if we can bring some attention to this.

Lexmark-chad avatar Aug 08 '22 14:08 Lexmark-chad

@Lexmark-chad Any updates? -- disregard

This PR seems like it can be closed without merge as the change has organically been introduced by the team https://github.com/NVIDIA-AI-IOT/deepstream_lpr_app/blob/master/nvinfer_custom_lpr_parser/nvinfer_custom_lpr_parser.cpp#L124

jeremy-london avatar Dec 23 '22 14:12 jeremy-london

:+1:

aler9 avatar Dec 23 '22 17:12 aler9