PaddlePaddle / PaddleHub

Awesome pre-trained models toolkit based on PaddlePaddle. (400+ models including Image, Text, Audio, Video and Cross-Modal with Easy Inference & Serving)【安全加固,暂停交互,请耐心等待】
https://www.paddlepaddle.org.cn/hub
Apache License 2.0
12.75k stars 2.07k forks source link

paddlehub使用问题 #2227

Closed Matiz7 closed 1 year ago

Matiz7 commented 1 year ago

环境 Python3.6 paddlepaddle==2.1.0 paddlehub==2.1.0 paddlenlp==2.0.3

ocr = hub.Module(name="chinese_ocr_db_crnn") 之前我单机代码这么写的没有问题,模型自动下载到用户默认路径下 ~/.paddlehub 现在要部署到镜像里,只能指定路径,

ocr = hub.Module(directory="/usr/src/app/paddlehub_bak/modules/chinese_ocr_db_crnn") 按指定目录初始化 但执行recognize_text时报错 paddlehub.module.manager.HubModuleNotFoundError: No HubModule named chinese_text_detection_db was found paddlehub_bak/modules/下目录文件都有,chinese_text_detection_db 要怎么指定 ? drwxr-xr-x. 6 root root 175 Mar 21 10:12 chinese_ocr_db_crnn drwxr-xr-x. 5 root root 151 Mar 21 10:12 chinese_ocr_db_crnn_server drwxr-xr-x. 4 root root 119 Mar 21 10:12 chinese_text_detection_db drwxr-xr-x. 4 root root 121 Mar 21 10:12 chinese_text_detection_db_server

报错信息 2023-03-21 17:25:00 results = ocr_c.recognize_text(paths=[f1], visualization=False) 2023-03-21 17:25:00 File "/usr/local/lib/python3.6/site-packages/paddlehub/compat/paddle_utils.py", line 220, in runner 2023-03-21 17:25:00 return func(*args, *kwargs) 2023-03-21 17:25:00 File "/usr/local/lib/python3.6/site-packages/paddlehub/module/module.py", line 63, in _wrapper 2023-03-21 17:25:00 return func(args, kwargs) 2023-03-21 17:25:00 File "/usr/src/app/paddlehub_bak/modules/chinese_ocr_db_crnn/module.py", line 195, in recognize_text 2023-03-21 17:25:00 detection_results = self.text_detector_module.detect_text( 2023-03-21 17:25:00 File "/usr/local/lib/python3.6/site-packages/paddlehub/module/module.py", line 90, in getattribute 2023-03-21 17:25:00 _attr = object.getattribute(self, attr) 2023-03-21 17:25:00 File "/usr/src/app/paddlehub_bak/modules/chinese_ocr_db_crnn/module.py", line 95, in text_detector_module 2023-03-21 17:25:00 name='chinese_text_detection_db') 2023-03-21 17:25:00 File "/usr/local/lib/python3.6/site-packages/paddlehub/module/module.py", line 395, in new 2023-03-21 17:25:00 kwargs) 2023-03-21 17:25:00 File "/usr/local/lib/python3.6/site-packages/paddlehub/module/module.py", line 493, in init_with_name 2023-03-21 17:25:00 ignore_env_mismatch=ignore_env_mismatch) 2023-03-21 17:25:00 File "/usr/local/lib/python3.6/site-packages/paddlehub/module/manager.py", line 190, in install 2023-03-21 17:25:00 return self._install_from_name(name, version, ignore_env_mismatch) 2023-03-21 17:25:00 File "/usr/local/lib/python3.6/site-packages/paddlehub/module/manager.py", line 270, in _install_from_name 2023-03-21 17:25:00 raise HubModuleNotFoundError(name=name, version=version) 2023-03-21 17:25:00paddlehub.module.manager.HubModuleNotFoundError: No HubModule named chinese_text_detection_db was found

Matiz7 commented 1 year ago

File "/usr/src/app/paddlehub_bak/modules/chinese_ocr_db_crnn/module.py", line 95,

self._text_detector_module = hub.Module(name='chinese_text_detection_db') 是要自己修改这个文件 ?