Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
ocr = hub.Module(name="chinese_ocr_db_crnn_mobile", enable_mkldnn=False) # mkldnn加速仅在CPU下有效
for x in test_img_path:
result = ocr.recognize_text(images=[cv2.imread(x)])
print(result)
- 完整报错/Complete Error Message:
$ python testId.py
/Users/51pwn/anaconda3/envs/paddle_env/lib/python3.8/site-packages/_distutils_hack/init.py:33: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")
Traceback (most recent call last):
File "testId.py", line 27, in
result = ocr.recognize_text(images=[cv2.imread(x)])
File "/Users/51pwn/anaconda3/envs/paddle_env/lib/python3.8/site-packages/paddlehub/compat/paddle_utils.py", line 221, in runner
return func(*args, **kwargs)
File "/Users/51pwn/.paddlehub/modules/chinese_ocr_db_crnn_mobile/module.py", line 265, in recognize_text
'text_box_position': boxes[index].astype(np.int).tolist()
File "/Users/51pwn/anaconda3/envs/paddle_env/lib/python3.8/site-packages/numpy/init.py", line 305, in getattr
raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'int'.
np.int was a deprecated alias for the builtin int. To avoid this error in existing code, use int by itself. Doing this will not modify any behavior and is safe. When replacing np.int, you may wish to use e.g. np.int64 or np.int32 to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem
系统环境/System Environment: conda create --name paddle_env -y python=3.8 --channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
版本号/Version:Paddle: PaddleOCR: 问题相关组件/Related components:
运行指令/Command Code:
ocr = hub.Module(name="chinese_text_detection_db_mobile")
待预测图片
test_img_path = ["xxx.jpg"]
展示其中广告信息图片
ocr = hub.Module(name="chinese_ocr_db_crnn_mobile", enable_mkldnn=False) # mkldnn加速仅在CPU下有效 for x in test_img_path: result = ocr.recognize_text(images=[cv2.imread(x)]) print(result)
$ python testId.py /Users/51pwn/anaconda3/envs/paddle_env/lib/python3.8/site-packages/_distutils_hack/init.py:33: UserWarning: Setuptools is replacing distutils. warnings.warn("Setuptools is replacing distutils.") Traceback (most recent call last): File "testId.py", line 27, in
result = ocr.recognize_text(images=[cv2.imread(x)])
File "/Users/51pwn/anaconda3/envs/paddle_env/lib/python3.8/site-packages/paddlehub/compat/paddle_utils.py", line 221, in runner
return func(*args, **kwargs)
File "/Users/51pwn/.paddlehub/modules/chinese_ocr_db_crnn_mobile/module.py", line 265, in recognize_text
'text_box_position': boxes[index].astype(np.int).tolist()
File "/Users/51pwn/anaconda3/envs/paddle_env/lib/python3.8/site-packages/numpy/init.py", line 305, in getattr
raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'int'.
np.int
was a deprecated alias for the builtinint
. To avoid this error in existing code, useint
by itself. Doing this will not modify any behavior and is safe. When replacingnp.int
, you may wish to use e.g.np.int64
ornp.int32
to specify the precision. If you wish to review your current use, check the release note link for additional information. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations