Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CUDA 11.6 + CUDNN 8.4 运行OCR 返回的Result为None,另外一台纯CPU模式同一张图是可以的 #11289

Open
shaoerkuai opened this issue Nov 22, 2023 · 4 comments
Assignees
Labels

Comments

@shaoerkuai
Copy link

shaoerkuai commented Nov 22, 2023

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

  • 系统环境/System Environment:
  • Windows 11
  • 版本号/Version:Paddle: PaddleOCR: 问题相关组件/Related components:
  • 运行指令/Command Code:
    参考的是官方的Python代码

ocr = PaddleOCR(use_angle_cls=True, lang="ch") # need to run only once to download and load model into memory
img_path = "D:\img\20231122140525.jpg"
t1 = time.time()
print("21321")
result = ocr.ocr(img_path, det=True, cls=True) # 这里Result就是None了
for idx in range(len(result)):
res = result[idx]
for line in res:
print(line)

  • 完整报错/Complete Error Message:
[2023/11/22 17:06:25] ppocr DEBUG: Namespace(help='==SUPPRESS==', use_gpu=True, use_xpu=False, use_npu=False, ir_opti
m=True, use_tensorrt=False, min_subgraph_size=15, precision='fp32', gpu_mem=500, gpu_id=0, image_dir=None, page_num=0
, det_algorithm='DB', det_model_dir='C:\\Users\\XXXXX/.paddleocr/whl\\det\\ch\\ch_PP-OCRv4_det_infer', det_limit_
side_len=960, det_limit_type='max', det_box_type='quad', det_db_thresh=0.3, det_db_box_thresh=0.6, det_db_unclip_rati
o=1.5, max_batch_size=10, use_dilation=False, det_db_score_mode='fast', det_east_score_thresh=0.8, det_east_cover_thr
esh=0.1, det_east_nms_thresh=0.2, det_sast_score_thresh=0.5, det_sast_nms_thresh=0.2, det_pse_thresh=0, det_pse_box_t
hresh=0.85, det_pse_min_area=16, det_pse_scale=1, scales=[8, 16, 32], alpha=1.0, beta=1.0, fourier_degree=5, rec_algo
rithm='SVTR_LCNet', rec_model_dir='C:\\Users\\XXX/.paddleocr/whl\\rec\\ch\\ch_PP-OCRv4_rec_infer', rec_image_in
verse=True, rec_image_shape='3, 48, 320', rec_batch_num=6, max_text_length=25, rec_char_dict_path='D:\\Python310\\lib
\\site-packages\\paddleocr\\ppocr\\utils\\ppocr_keys_v1.txt', use_space_char=True, vis_font_path='./doc/fonts/simfang
.ttf', drop_score=0.5, e2e_algorithm='PGNet', e2e_model_dir=None, e2e_limit_side_len=768, e2e_limit_type='max', e2e_p
gnet_score_thresh=0.5, e2e_char_dict_path='./ppocr/utils/ic15_dict.txt', e2e_pgnet_valid_set='totaltext', e2e_pgnet_m
ode='fast', use_angle_cls=True, cls_model_dir='C:\\Users\\XXX/.paddleocr/whl\\cls\\ch_ppocr_mobile_v2.0_cls_inf
er', cls_image_shape='3, 48, 192', label_list=['0', '180'], cls_batch_num=6, cls_thresh=0.9, enable_mkldnn=False, cpu
_threads=10, use_pdserving=False, warmup=False, sr_model_dir=None, sr_image_shape='3, 32, 128', sr_batch_num=1, draw_
img_save_dir='./inference_results', save_crop_res=False, crop_res_save_dir='./output', use_mp=False, total_process_nu
m=1, process_id=0, benchmark=False, save_log_path='./log_output/', show_log=True, use_onnx=False, output='./output',
table_max_len=488, table_algorithm='TableAttn', table_model_dir=None, merge_no_span_structure=True, table_char_dict_p
ath=None, layout_model_dir=None, layout_dict_path=None, layout_score_threshold=0.5, layout_nms_threshold=0.5, kie_alg
orithm='LayoutXLM', ser_model_dir=None, re_model_dir=None, use_visual_backbone=True, ser_dict_path='../train_data/XFU
ND/class_list_xfun.txt', ocr_order_method=None, mode='structure', image_orientation=False, layout=True, table=True, o
cr=True, recovery=False, use_pdf2docx_api=False, invert=False, binarize=False, alphacolor=(255, 255, 255), lang='ch',
 det=True, rec=True, type='ocr', ocr_version='PP-OCRv4', structure_version='PP-StructureV2')
21321
[2023/11/22 17:06:34] ppocr DEBUG: dt_boxes num : 0, elapsed : 1.3370857238769531
[2023/11/22 17:06:34] ppocr DEBUG: cls num  : 0, elapsed : 0
[2023/11/22 17:06:34] ppocr DEBUG: rec_res num  : 0, elapsed : 0.0
Traceback (most recent call last):
  File "E:\XXX\paddletest\a.py", line 25, in <module>
    for line in res:
TypeError: 'NoneType' object is not iterable

我们提供了AceIssueSolver来帮助你解答问题,你是否想要它来解答(请填写yes/no)?/We provide AceIssueSolver to solve issues, do you want it? (Please write yes/no):

no

请尽量不要包含图片在问题中/Please try to not include the image in the issue.

@shaoerkuai
Copy link
Author

shaoerkuai commented Nov 22, 2023

当前版本:
paddleocr 2.7.0.3
paddlepaddle-gpu 2.5.2.post116
cudnn 8.4.0.27_cuda11.6
cuda_11.6.1_511.65
驱动支持的CUDA 11.6.127
设置gpu = false 也是可以正常识别的,开启GPU后就不支持。

@shaoerkuai
Copy link
Author

shaoerkuai commented Nov 22, 2023

试下paddle 的检查:
The GPU architecture in your current machine is Maxwell, which is not compatible with Paddle installation with arch: 70 75 80 86 , it is recommended to install the corresponding wheel package according to the installation information on the official Paddle website.

应该是Maxwell架构不支持,更换了老版本后,出现如下情况:
[[[984.0, 738.0], [1006.0, 738.0], [1006.0, 752.0], [984.0, 752.0]], ('茂团瞬潜阅予彭任授仲z充鸟驱俗J’潜俗劣士号画
乡傻翼√机谁筋′灭驾j妥剩_腰显', 0.997814953327179)]
[[[1132.0, 736.0], [1154.0, 736.0], [1154.0, 752.0], [1132.0, 752.0]], ('乱丫傅丫管富管丫字富管叫喘l锦胃丫μ胃隐', 0
.803952693939209)]
[[[1234.0, 736.0], [1274.0, 736.0], [1274.0, 750.0], [1234.0, 750.0]], ('婚亏丑痧授充妇东於团逾仁钜搁佛圳>遵劵滚旅坠
識.皆?临話蜂错仁圣措充μ遒丶应租', 0.9999554753303528)]
[[[1866.0, 738.0], [1876.0, 738.0], [1876.0, 750.0], [1866.0, 750.0]], ("衍j—奢录承剩吉满陆w吉呈‘谁仁磊号仁归响歡滚
虽允喷越贷幽'惟贷遵眼损展°团饿", 0.9942718148231506)]
[[[1877.0, 733.0], [1879.0, 753.0], [1888.0, 744.0], [1879.0, 753.0]], ('诺丫傅丫管富管丫字富管叫喘l锦胃丫μ胃隐', 0
.8039463758468628)]
[[[32.0, 761.0], [32.0, 781.0], [42.0, 771.0], [32.0, 781.0]], ('方含洗埔²净才晟冶何什豫²介何爷丫胖丫什丫董丫币爷還■
繁', 0.8569181561470032)]
[[[40.0, 763.0], [74.0, 763.0], [74.0, 777.0], [40.0, 777.0]], ('茂团瞬潜阅予彭任
授仲z充鸟驱俗J’潜俗劣士号画乡傻翼
√机谁筋′灭驾j妥剩_腰显', 0.997814953327179)]
[[[44.0, 757.0], [54.0, 748.0], [64.0, 757.0], [54.0, 767.0]], ('婚亏丑痧授充妇东於团逾仁钜搁佛圳>遵劵滚旅坠識.皆?临
話蜂错仁圣措充μ遒丶应租', 0.9999554753303528)]

全是乱识别的乱码...

@shaoerkuai
Copy link
Author

解决方案:
GTX 9系列使用以下CUDA版本正常,希望能够解决,当前可以通过降低CUDA版本解决,不过后续升级WIN11,CUDA 10.2就用不了了。当前WIN10还能正常使用。
驱动不需要降级,只需要卸载重新安装对应版本的CUDA即可。
CUDA v10.2
CUDNN v7.6.5.32

Copy link
Contributor

This issue is stale because it has been open for 90 days with no activity.

@github-actions github-actions bot added the stale label Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants