Awesome pre-trained models toolkit based on PaddlePaddle. (400+ models including Image, Text, Audio, Video and Cross-Modal with Easy Inference & Serving)【安全加固,暂停交互,请耐心等待】
1,运行模型目录~/.paddlehub/modules/ch_pp_ocrv3下的test.py识别结果失败
python test.py
失败信息如下 : results的data为[]
FFFF..[2023-07-05 12:18:27,939] [ INFO] - Paddle Inference model saved in inference/model/_text_detector_module.
[2023-07-05 12:18:28,305] [ INFO] - Paddle Inference model saved in ./inference/model.
.E
ERROR: tearDownClass (main.TestHubModule)
Traceback (most recent call last):
File "test.py", line 30, in tearDownClass
shutil.rmtree('ocr_result')
File "/data/conda/paddlehub/lib/python3.8/shutil.py", line 709, in rmtree
onerror(os.lstat, path, sys.exc_info())
File "/data/conda/paddlehub/lib/python3.8/shutil.py", line 707, in rmtree
orig_st = os.lstat(path)
FileNotFoundError: [Errno 2] No such file or directory: 'ocr_result'
Second list contains 2 additional elements.
First extra element 0:
{'text': 'GIVE.', 'confidence': 0.9509768486022949, 'text_box_position': [[283, 162], [352, 162], [352, 202], [283, 202]]}
Second list contains 2 additional elements.
First extra element 0:
{'text': 'GIVE.', 'confidence': 0.9509768486022949, 'text_box_position': [[283, 162], [352, 162], [352, 202], [283, 202]]}
Second list contains 2 additional elements.
First extra element 0:
{'text': 'GIVE.', 'confidence': 0.9509768486022949, 'text_box_position': [[283, 162], [352, 162], [352, 202], [283, 202]]}
Second list contains 2 additional elements.
First extra element 0:
{'text': 'GIVE.', 'confidence': 0.9509768486022949, 'text_box_position': [[283, 162], [352, 162], [352, 202], [283, 202]]}
2,换成本地图片也是识别不到文字,results.data 还是为[]
import paddlehub as hub
import cv2
ocr = hub.Module(name="ch_pp-ocrv3")
result = ocr.recognize_text(images=[cv2.imread("/home/robert/test.jpg")])
print(result)
[{'save_path': '', 'data': []}]
hub run ch_pp-ocrv3 --input_path "/home/robert/test.jpg" ,data为[]
/data/conda/paddlehub/lib/python3.8/site-packages/pkg_resources/init.py:121: DeprecationWarning: pkg_resources is deprecated as an API
warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)
/data/conda/paddlehub/lib/python3.8/site-packages/pkg_resources/init.py:2870: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('mpl_toolkits').
Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(pkg)
/data/conda/paddlehub/lib/python3.8/site-packages/pkg_resources/init.py:2870: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('google').
Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(pkg)
/data/conda/paddlehub/lib/python3.8/site-packages/pkg_resources/init.py:2870: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('sphinxcontrib').
Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(pkg)
/data/conda/paddlehub/lib/python3.8/site-packages/pkg_resources/init.py:2870: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('zope').
Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(pkg)
/data/conda/paddlehub/lib/python3.8/site-packages/_distutils_hack/init.py:33: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")
[{'save_path': '', 'data': []}]
欢迎您反馈PaddleHub使用问题,非常感谢您对PaddleHub的贡献! 在留下您的问题时,辛苦您同步提供如下信息:
使用如下测试图片:
1,运行模型目录~/.paddlehub/modules/ch_pp_ocrv3下的test.py识别结果失败 python test.py 失败信息如下 : results的data为[] FFFF..[2023-07-05 12:18:27,939] [ INFO] - Paddle Inference model saved in inference/model/_text_detector_module. [2023-07-05 12:18:28,305] [ INFO] - Paddle Inference model saved in ./inference/model. .E
ERROR: tearDownClass (main.TestHubModule)
Traceback (most recent call last): File "test.py", line 30, in tearDownClass shutil.rmtree('ocr_result') File "/data/conda/paddlehub/lib/python3.8/shutil.py", line 709, in rmtree onerror(os.lstat, path, sys.exc_info()) File "/data/conda/paddlehub/lib/python3.8/shutil.py", line 707, in rmtree orig_st = os.lstat(path) FileNotFoundError: [Errno 2] No such file or directory: 'ocr_result'
====================================================================== FAIL: test_recognize_text1 (main.TestHubModule)
Traceback (most recent call last): File "test.py", line 38, in test_recognize_text1 self.assertEqual(results[0]['data'], [{ AssertionError: Lists differ: [] != [{'text': 'GIVE.', 'confidence': 0.9509768[202 chars]9]]}]
Second list contains 2 additional elements. First extra element 0: {'text': 'GIVE.', 'confidence': 0.9509768486022949, 'text_box_position': [[283, 162], [352, 162], [352, 202], [283, 202]]}
====================================================================== FAIL: test_recognize_text2 (main.TestHubModule)
Traceback (most recent call last): File "test.py", line 54, in test_recognize_text2 self.assertEqual(results[0]['data'], [{ AssertionError: Lists differ: [] != [{'text': 'GIVE.', 'confidence': 0.9509768[202 chars]9]]}]
Second list contains 2 additional elements. First extra element 0: {'text': 'GIVE.', 'confidence': 0.9509768486022949, 'text_box_position': [[283, 162], [352, 162], [352, 202], [283, 202]]}
====================================================================== FAIL: test_recognize_text3 (main.TestHubModule)
Traceback (most recent call last): File "test.py", line 70, in test_recognize_text3 self.assertEqual(results[0]['data'], [{ AssertionError: Lists differ: [] != [{'text': 'GIVE.', 'confidence': 0.9509768[202 chars]9]]}]
Second list contains 2 additional elements. First extra element 0: {'text': 'GIVE.', 'confidence': 0.9509768486022949, 'text_box_position': [[283, 162], [352, 162], [352, 202], [283, 202]]}
====================================================================== FAIL: test_recognize_text4 (main.TestHubModule)
Traceback (most recent call last): File "test.py", line 86, in test_recognize_text4 self.assertEqual(results[0]['data'], [{ AssertionError: Lists differ: [] != [{'text': 'GIVE.', 'confidence': 0.9509768[202 chars]9]]}]
Second list contains 2 additional elements. First extra element 0: {'text': 'GIVE.', 'confidence': 0.9509768486022949, 'text_box_position': [[283, 162], [352, 162], [352, 202], [283, 202]]}
Ran 7 tests in 6.740s
FAILED (failures=4, errors=1)
2,换成本地图片也是识别不到文字,results.data 还是为[] import paddlehub as hub import cv2 ocr = hub.Module(name="ch_pp-ocrv3")
result = ocr.recognize_text(images=[cv2.imread("/home/robert/test.jpg")]) print(result)
[{'save_path': '', 'data': []}]
/data/conda/paddlehub/lib/python3.8/site-packages/pkg_resources/init.py:121: DeprecationWarning: pkg_resources is deprecated as an API warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning) /data/conda/paddlehub/lib/python3.8/site-packages/pkg_resources/init.py:2870: DeprecationWarning: Deprecated call to
pkg_resources.declare_namespace('mpl_toolkits')
. Implementing implicit namespace packages (as specified in PEP 420) is preferred topkg_resources.declare_namespace
. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages declare_namespace(pkg) /data/conda/paddlehub/lib/python3.8/site-packages/pkg_resources/init.py:2870: DeprecationWarning: Deprecated call topkg_resources.declare_namespace('google')
. Implementing implicit namespace packages (as specified in PEP 420) is preferred topkg_resources.declare_namespace
. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages declare_namespace(pkg) /data/conda/paddlehub/lib/python3.8/site-packages/pkg_resources/init.py:2870: DeprecationWarning: Deprecated call topkg_resources.declare_namespace('sphinxcontrib')
. Implementing implicit namespace packages (as specified in PEP 420) is preferred topkg_resources.declare_namespace
. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages declare_namespace(pkg) /data/conda/paddlehub/lib/python3.8/site-packages/pkg_resources/init.py:2870: DeprecationWarning: Deprecated call topkg_resources.declare_namespace('zope')
. Implementing implicit namespace packages (as specified in PEP 420) is preferred topkg_resources.declare_namespace
. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages declare_namespace(pkg) /data/conda/paddlehub/lib/python3.8/site-packages/_distutils_hack/init.py:33: UserWarning: Setuptools is replacing distutils. warnings.warn("Setuptools is replacing distutils.") [{'save_path': '', 'data': []}]