Skip to content

Commit

Permalink
fix(rapidocr_paddle): Fix issue #222
Browse files Browse the repository at this point in the history
  • Loading branch information
SWHL committed Sep 19, 2024
1 parent 1068e68 commit 64da0dd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/rapidocr_paddle/ch_ppocr_v3_rec/text_recognize.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@

from .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_PATH
self.postprocess_op = CTCLabelDecode(character_path=self.character_dict_path)

self.infer = PaddleInferSession(config, mode="rec")
Expand Down

0 comments on commit 64da0dd

Please sign in to comment.