diff --git a/paddleocr.py b/paddleocr.py index b5bb5d21c39d348b447f90c884bb3f5b7fc1a928..8e34c4fbc331f798618fc5f33bc00963a577e25a 100644 --- a/paddleocr.py +++ b/paddleocr.py @@ -287,7 +287,8 @@ MODEL_URLS = { }, 'layout': { 'ch': { - 'url': '', + 'url': + 'https://paddleocr.bj.bcebos.com/ppstructure/models/layout/picodet_lcnet_x1_0_layout_infer.tar', 'dict_path': 'ppocr/utils/dict/layout_publaynet_dict.txt' } } diff --git a/ppocr/utils/network.py b/ppocr/utils/network.py index 118d1be364925d9416134cffe21d636fcac753e9..080a5d160116cfdd3b255a883525281d97ee9cc9 100644 --- a/ppocr/utils/network.py +++ b/ppocr/utils/network.py @@ -41,9 +41,7 @@ def download_with_progressbar(url, save_path): def maybe_download(model_storage_directory, url): # using custom model - tar_file_name_list = [ - 'inference.pdiparams', 'inference.pdiparams.info', 'inference.pdmodel' - ] + tar_file_name_list = ['.pdiparams', '.pdiparams.info', '.pdmodel'] if not os.path.exists( os.path.join(model_storage_directory, 'inference.pdiparams') ) or not os.path.exists( @@ -57,8 +55,8 @@ def maybe_download(model_storage_directory, url): for member in tarObj.getmembers(): filename = None for tar_file_name in tar_file_name_list: - if tar_file_name in member.name: - filename = tar_file_name + if member.name.endswith(tar_file_name): + filename = 'inference' + tar_file_name if filename is None: continue file = tarObj.extractfile(member)