π Awesome OCR multiple programing languages toolkits based on ONNX Runtime, OpenVINO, MNN, PaddlePaddle, TensorRT and PyTorch.
fix(rapidocr_paddle): Fix issue #222
SWHL64da0dd4550a
diff --git a/python/rapidocr_paddle/ch_ppocr_v3_rec/text_recognize.py b/python/rapidocr_paddle/ch_ppocr_v3_rec/text_recognize.pyindex 4524988..d74dcfd 100644--- a/python/rapidocr_paddle/ch_ppocr_v3_rec/text_recognize.py+++ b/python/rapidocr_paddle/ch_ppocr_v3_rec/text_recognize.py@@ -24,14 +24,16 @@ from rapidocr_paddle.utils import PaddleInferSession, read_yamlfrom .utils import CTCLabelDecode+DEFAULT_DICT_PATH = str(Path(__file__).parent / "ppocr_keys_v1.txt")+class TextRecognizer:def __init__(self, config):self.rec_image_shape = config["rec_img_shape"]self.rec_batch_num = config["rec_batch_num"]- dict_path = str(Path(__file__).parent / "ppocr_keys_v1.txt")- self.character_dict_path = config.get("rec_keys_path", dict_path)+ dict_path = config.get("rec_keys_path", None)+ self.character_dict_path = dict_path if dict_path else DEFAULT_DICT_PATHself.postprocess_op = CTCLabelDecode(character_path=self.character_dict_path)self.infer = PaddleInferSession(config, mode="rec")