From 604f531b9aa5904cf021591905d187da2664b942 Mon Sep 17 00:00:00 2001 From: WenmuZhou <572459439@qq.com> Date: Wed, 17 Aug 2022 04:40:07 +0000 Subject: [PATCH] add layout model --- paddleocr.py | 3 ++- ppocr/utils/network.py | 8 +++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/paddleocr.py b/paddleocr.py index b5bb5d21..8e34c4fb 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 118d1be3..080a5d16 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) -- GitLab