From 6b12c81a727d2a98f84f9887b9bad3fb68e5b140 Mon Sep 17 00:00:00 2001 From: WenmuZhou Date: Tue, 2 Mar 2021 19:15:55 +0800 Subject: [PATCH] fix bug of custom rec dict path --- paddleocr.py | 8 +++++--- setup.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/paddleocr.py b/paddleocr.py index 99cb369f..c3741b26 100644 --- a/paddleocr.py +++ b/paddleocr.py @@ -236,7 +236,9 @@ class PaddleOCR(predict_system.TextSystem): assert lang in model_urls[ 'rec'], 'param lang must in {}, but got {}'.format( model_urls['rec'].keys(), lang) + use_inner_dict = False if postprocess_params.rec_char_dict_path is None: + use_inner_dict = True postprocess_params.rec_char_dict_path = model_urls['rec'][lang][ 'dict_path'] @@ -263,9 +265,9 @@ class PaddleOCR(predict_system.TextSystem): if postprocess_params.rec_algorithm not in SUPPORT_REC_MODEL: logger.error('rec_algorithm must in {}'.format(SUPPORT_REC_MODEL)) sys.exit(0) - - postprocess_params.rec_char_dict_path = str( - Path(__file__).parent / postprocess_params.rec_char_dict_path) + if use_inner_dict: + postprocess_params.rec_char_dict_path = str( + Path(__file__).parent / postprocess_params.rec_char_dict_path) # init det_model and rec_model super().__init__(postprocess_params) diff --git a/setup.py b/setup.py index 58f6de48..70400df4 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ setup( package_dir={'paddleocr': ''}, include_package_data=True, entry_points={"console_scripts": ["paddleocr= paddleocr.paddleocr:main"]}, - version='2.0.2', + version='2.0.3', install_requires=requirements, license='Apache License 2.0', description='Awesome OCR toolkits based on PaddlePaddle (8.6M ultra-lightweight pre-trained model, support training and deployment among server, mobile, embeded and IoT devices', -- GitLab