Skip to content

when use_gpu=True, result is None #15033

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

Open
3 tasks done
akaihaoshuai opened this issue Apr 17, 2025 · 3 comments
Open
3 tasks done

when use_gpu=True, result is None #15033

akaihaoshuai opened this issue Apr 17, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@akaihaoshuai
Copy link

🔎 Search before asking

  • I have searched the PaddleOCR Docs and found no similar bug report.
  • I have searched the PaddleOCR Issues and found no similar bug report.
  • I have searched the PaddleOCR Discussions and found no similar bug report.

🐛 Bug (问题描述)

[2025/04/17 15:33:16] ppocr DEBUG: Namespace(help='==SUPPRESS==', use_gpu=True, use_xpu=False, use_npu=False, use_mlu=False, use_gcu=False, ir_optim=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='/home/test/.paddleocr/whl/det/en/en_PP-OCRv3_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_ratio=1.5, max_batch_size=10, use_dilation=False, det_db_score_mode='fast', det_east_score_thresh=0.8, det_east_cover_thresh=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_thresh=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_algorithm='SVTR_LCNet', rec_model_dir='/home/test/.paddleocr/whl/rec/en/en_PP-OCRv4_rec_infer', rec_image_inverse=True, rec_image_shape='3, 48, 320', rec_batch_num=6, max_text_length=25, rec_char_dict_path='/usr/local/lib/python3.9/dist-packages/paddleocr/ppocr/utils/en_dict.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_pgnet_score_thresh=0.5, e2e_char_dict_path='./ppocr/utils/ic15_dict.txt', e2e_pgnet_valid_set='totaltext', e2e_pgnet_mode='fast', use_angle_cls=True, cls_model_dir='/home/test/.paddleocr/whl/cls/ch_ppocr_mobile_v2.0_cls_infer', 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_num=1, process_id=0, benchmark=False, save_log_path='./log_output/', show_log=True, use_onnx=False, onnx_providers=False, onnx_sess_options=False, return_word_box=False, output='./output', table_max_len=488, table_algorithm='TableAttn', table_model_dir=None, merge_no_span_structure=True, table_char_dict_path=None, formula_algorithm='LaTeXOCR', formula_model_dir=None, formula_char_dict_path=None, formula_batch_num=1, layout_model_dir=None, layout_dict_path=None, layout_score_threshold=0.5, layout_nms_threshold=0.5, kie_algorithm='LayoutXLM', ser_model_dir=None, re_model_dir=None, use_visual_backbone=True, ser_dict_path='../train_data/XFUND/class_list_xfun.txt', ocr_order_method=None, mode='structure', image_orientation=False, layout=True, table=True, formula=False, ocr=True, recovery=False, recovery_to_markdown=False, use_pdf2docx_api=False, invert=False, binarize=False, alphacolor=(255, 255, 255), lang='en', det=True, rec=True, type='ocr', savefile=False, ocr_version='PP-OCRv4', structure_version='PP-StructureV2')

when use_gpu=False:
[[[[[82.0, 41.0], [165.0, 44.0], [164.0, 73.0], [81.0, 70.0]], ('ICBC', 0.9955618381500244)], [[[233.0, 45.0], [407.0, 45.0], [407.0, 74.0], [233.0, 74.0]], ('中国工商银行', 0.9983561635017395)], [[[485.0, 60.0], [522.0, 60.0], [522.0, 78.0], [485.0, 78.0]], ('通卡', 0.9954055547714233)], [[[464.0, 112.0], [536.0, 125.0], [531.0, 155.0], [459.0, 142.0]], ('Quick', 0.9935451745986938)], [[[446.0, 142.0], [530.0, 147.0], [528.0, 168.0], [445.0, 163.0]], ('闪付Pass', 0.9789013862609863)], [[[82.0, 193.0], [468.0, 188.0], [469.0, 218.0], [82.0, 223.0]], ('16212261609004117955', 0.9962806701660156)], [[[121.0, 235.0], [221.0, 232.0], [222.0, 257.0], [122.0, 261.0]], ('YAD03/25', 0.8181346654891968)], [[[438.0, 245.0], [528.0, 248.0], [528.0, 276.0], [437.0, 273.0]], ('UnionPay', 0.9894812107086182)], [[[470.0, 271.0], [518.0, 268.0], [520.0, 291.0], [471.0, 294.0]], ('银联', 0.9991128444671631)]]]

when use_gpu=True:
[None]

🏃‍♂️ Environment (运行环境)

onnxruntime 1.19.2
openai 1.45.0
opencv-contrib-python 4.11.0.86
opencv-python 4.6.0.66
opencv-python-headless 4.10.0.84
openocr-python 0.0.9
opt-einsum 3.3.0
torch 2.5.1
torchaudio 0.13.1
torchvision 0.20.1

🌰 Minimal Reproducible Example (最小可复现问题的Demo)

from paddleocr import PaddleOCR, draw_ocr

Paddleocr supports Chinese, English, French, German, Korean and Japanese

You can set the parameter lang as ch, en, french, german, korean, japan

to switch the language model in order

ocr = PaddleOCR(use_angle_cls=True, lang='en') # need to run only once to download and load model into memory
img_path = 'PaddleOCR/doc/imgs_en/img_12.jpg'
result = ocr.ocr(img_path, cls=True)
for idx in range(len(result)):
res = result[idx]
for line in res:
print(line)

@jingsongliujing
Copy link
Collaborator

Please check the version of CUDA. You can refer to this link for installation:https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/develop/install/pip/linux-pip.html

@dexforint
Copy link

Same problem, environment: Kaggle
Solution for me

!pip install paddlepaddle-gpu==3.0.0rc1 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/
!pip install paddleocr

@jingsongliujing jingsongliujing added the bug Something isn't working label Apr 19, 2025
@cuicheng01
Copy link
Collaborator

hi, Please ensure that your drivers can at least meet the CUDA version requirements corresponding to the version of Paddle you have downloaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants