deep-text-recognition-benchmark
                                
                                 deep-text-recognition-benchmark copied to clipboard
                                
                                    deep-text-recognition-benchmark copied to clipboard
                            
                            
                            
                        Confidence score with 'CTC' prediction
Hi. Does anyone know how to extract the confidence score of the prediction in a model trained with the 'CTC' module? I only found the example with 'Attn' in this repo:
confidence_score_list = []
for gt, pred, pred_max_prob in zip(labels, preds_str, preds_max_prob):
    if 'Attn' in opt.Prediction:
        gt = gt[:gt.find('[s]')]
        pred_EOS = pred.find('[s]')
        pred = pred[:pred_EOS]  # prune after "end of sentence" token ([s])
        pred_max_prob = pred_max_prob[:pred_EOS]
 # calculate confidence score (= multiply of pred_max_prob)
try:
    confidence_score = pred_max_prob.cumprod(dim=0)[-1]
except:
    confidence_score = 0  # for empty pred case, when prune after "end of sentence" token ([s])
confidence_score_list.append(confidence_score)
Facing the same issue