From e49459594579af68404236c572a3415d41f6ccd3 Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Mon, 3 Aug 2020 22:22:08 +0800 Subject: [PATCH] fix score is nan --- tools/infer/predict_rec.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/infer/predict_rec.py b/tools/infer/predict_rec.py index 578401fb..b51c49fc 100755 --- a/tools/infer/predict_rec.py +++ b/tools/infer/predict_rec.py @@ -122,9 +122,9 @@ class TextRecognizer(object): ind = np.argmax(probs, axis=1) blank = probs.shape[1] valid_ind = np.where(ind != (blank - 1))[0] - score = np.mean(probs[valid_ind, ind[valid_ind]]) if len(valid_ind) == 0: continue + score = np.mean(probs[valid_ind, ind[valid_ind]]) # rec_res.append([preds_text, score]) rec_res[indices[beg_img_no + rno]] = [preds_text, score] else: -- GitLab