未验证 提交 274f4bce 编写于 作者: S Steffy-zxf 提交者: GitHub

Fix ocr (#806)

上级 be334f2b
......@@ -25,7 +25,7 @@ from chinese_ocr_db_crnn_mobile.utils import base64_to_cv2, draw_ocr, get_image_
@moduleinfo(
name="chinese_ocr_db_crnn_mobile",
version="1.0.2",
version="1.0.3",
summary=
"The module can recognize the chinese texts in an image. Firstly, it will detect the text box positions based on the differentiable_binarization_chn module. Then it recognizes the chinese texts. ",
author="paddle-dev",
......@@ -308,6 +308,8 @@ class ChineseOCRDBCRNN(hub.Module):
ind = np.argmax(probs, axis=1)
blank = probs.shape[1]
valid_ind = np.where(ind != (blank - 1))[0]
if len(valid_ind) == 0:
continue
score = np.mean(probs[valid_ind, ind[valid_ind]])
rec_res.append([preds_text, score])
......
......@@ -25,7 +25,7 @@ from chinese_ocr_db_crnn_server.utils import base64_to_cv2, draw_ocr, get_image_
@moduleinfo(
name="chinese_ocr_db_crnn_server",
version="1.0.1",
version="1.0.2",
summary=
"The module can recognize the chinese texts in an image. Firstly, it will detect the text box positions based on the differentiable_binarization_chn module. Then it recognizes the chinese texts. ",
author="paddle-dev",
......@@ -308,6 +308,8 @@ class ChineseOCRDBCRNNServer(hub.Module):
ind = np.argmax(probs, axis=1)
blank = probs.shape[1]
valid_ind = np.where(ind != (blank - 1))[0]
if len(valid_ind) == 0:
continue
score = np.mean(probs[valid_ind, ind[valid_ind]])
rec_res.append([preds_text, score])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册