PaddlePaddle / PaddleOCR

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)
https://paddlepaddle.github.io/PaddleOCR/
Apache License 2.0
42.7k stars 7.68k forks source link

PaddleOCR使用CPU版本能识别图片中文字,但是GPU版本却无法识别 #11471

Open philosophy912 opened 8 months ago

philosophy912 commented 8 months ago

paddle版本信息如下: paddleclas 2.5.1 paddleocr 2.7.0.3 paddlepaddle-gpu 2.6.0.post120 CUDA信息如下: nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2023 NVIDIA Corporation Built on Wed_Nov_22_10:30:42_Pacific_Standard_Time_2023 Cuda compilation tools, release 12.3, V12.3.107 Build cuda_12.3.r12.3/compiler.33567101_0 显卡信息如下 nvidia-smi Sat Jan 6 22:18:21 2024 +---------------------------------------------------------------------------------------+ | NVIDIA-SMI 546.33 Driver Version: 546.33 CUDA Version: 12.3 | |-----------------------------------------+----------------------+----------------------+ | GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+======================+======================| | 0 NVIDIA GeForce GTX 1060 6GB WDDM | 00000000:10:00.0 On | N/A | | 38% 24C P8 8W / 130W | 825MiB / 6144MiB | 6% Default | | | | N/A | +-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=======================================================================================| | 0 N/A N/A 976 C+G ...wekyb3d8bbwe\XboxGameBarWidgets.exe N/A | | 0 N/A N/A 4480 C+G ...harm Professional\bin\pycharm64.exe N/A | | 0 N/A N/A 5892 C+G ...ic\QQMusic1945.17.32.33\QQMusic.exe N/A | | 0 N/A N/A 8772 C+G ...CBS_cw5n1h2txyewy\TextInputHost.exe N/A | | 0 N/A N/A 8984 C+G ...ekyb3d8bbwe\PhoneExperienceHost.exe N/A | | 0 N/A N/A 9560 C+G C:\Program Files\mRay\mRay.exe N/A | | 0 N/A N/A 9564 C+G ...tionsPlus\logioptionsplus_agent.exe N/A | | 0 N/A N/A 10808 C+G ...voice\logioptionsplus_logivoice.exe N/A | | 0 N/A N/A 11568 C+G C:\Windows\explorer.exe N/A | | 0 N/A N/A 11848 C+G ...ogram Files (x86)\ToDesk\ToDesk.exe N/A | | 0 N/A N/A 11884 C+G ...crosoft\Edge\Application\msedge.exe N/A | | 0 N/A N/A 12664 C+G ...nt.CBS_cw5n1h2txyewy\SearchHost.exe N/A | | 0 N/A N/A 12688 C+G ...2txyewy\StartMenuExperienceHost.exe N/A | | 0 N/A N/A 13800 C+G ...t.LockApp_cw5n1h2txyewy\LockApp.exe N/A | | 0 N/A N/A 14264 C+G ...GeForce Experience\NVIDIA Share.exe N/A | | 0 N/A N/A 14616 C+G ...__8wekyb3d8bbwe\WindowsTerminal.exe N/A | | 0 N/A N/A 15696 C+G ...eskGo\3.3.1461.127\DesktopMgr64.exe N/A | | 0 N/A N/A 16268 C+G ...5n1h2txyewy\ShellExperienceHost.exe N/A | | 0 N/A N/A 17280 C+G ...o\3.3.1461.127\Win11ContextMenu.exe N/A | | 0 N/A N/A 17608 C+G ...les\Microsoft OneDrive\OneDrive.exe N/A | | 0 N/A N/A 18928 C+G ...m Files\TencentDocs\TencentDocs.exe N/A | +---------------------------------------------------------------------------------------+

python代码如下: from paddleocr import PaddleOCR img_path = r'D:\Temp\code\images\2024-01-06_204353.jpg' ocr = PaddleOCR(use_angle_cls=True, lang="ch", use_gpu=True, ocr_version="PP-OCRv3") result = ocr.ocr(img_path, cls=True) print(result) 2024-01-06_222246

CPU识别内容正常(即use_gpu=False) GPU识别内容不正常(即use_gpu=True)

环境部署没有问题 使用代码 import paddle paddle.utils.run_check() 获取结果如下: Running verify PaddlePaddle program ... I0106 22:20:43.668989 4580 program_interpreter.cc:212] New Executor is Running. W0106 22:20:43.668989 4580 gpu_resources.cc:96] The GPU architecture in your current machine is Pascal, which is not compatible with Paddle installation with arch: 70 75 80 86 90 , it is recommended to install the corresponding wheel package according to the installation information on the official Paddle website. W0106 22:20:43.668989 4580 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 6.1, Driver API Version: 12.3, Runtime API Version: 12.0 W0106 22:20:43.676575 4580 gpu_resources.cc:164] device: 0, cuDNN Version: 8.9. I0106 22:20:43.980501 4580 interpreter_util.cc:624] Standalone Executor is Used. PaddlePaddle works well on 1 GPU. PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now. 2024-01-06_222332

寻求协助看看是什么地方除了问题导致了CPU识别正常而GPU识别不正常的情况。

alanxinn commented 8 months ago

我的机器版本 win10 专业版 22H2 paddlepaddle-gpu==2.3.2 cuda==10.1 cudnn==7.6.5 paddleocr==2.6.0 成功推理,不出现乱码

DonGL111 commented 8 months ago

我这里也出现了使用GPU无法正常识别的问题: 当我使用use_gpu=False时,能够正常显示结果 WXWorkLocal_20240109114105 但是当我使用gpu时use_gpu=True时,出现以下的结果 2

我的代码是这样写的 3

安装PaddleOCR时使用下面的命令行: conda install paddlepaddle-gpu==2.5.2 cudatoolkit=10.2 --channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/Paddle/

环境部署使用代码测试 import paddle paddle.utils.run_check() 获取结果也正常 PaddlePaddle works well on 8 GPUs. PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.

不明白为什么会出现这种情况

alanxinn commented 8 months ago

我这里也出现了使用GPU无法正常识别的问题: 当我使用use_gpu=False时,能够正常显示结果 WXWorkLocal_20240109114105 但是当我使用gpu时use_gpu=True时,出现以下的结果 2

我的代码是这样写的 3

安装PaddleOCR时使用下面的命令行: conda install paddlepaddle-gpu==2.5.2 cudatoolkit=10.2 --channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/Paddle/

环境部署使用代码测试 import paddle paddle.utils.run_check() 获取结果也正常 PaddlePaddle works well on 8 GPUs. PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.

不明白为什么会出现这种情况

我是conda创建环境后使用pip安装paddlepaddle,没有试过conda安装

haonit commented 5 months ago

我是某些图片,使用cpu可以识别,使用gpu不能识别。大部分图片使用gpu还是可以识别的

kesshei commented 4 months ago

我这边也出现了这个问题,运行在docker 里,cpu 可以,gpu 就不可以。

代码如下:

from paddleocr import PaddleOCR

# Paddleocr目前支持的多语言语种可以通过修改lang参数进行切换
ocr = PaddleOCR(use_angle_cls=True, lang="ch",use_gpu=True)  # need to run only once to download and load model into memory
img_path = '123.png'
result = ocr.ocr(img_path, cls=True)
print(result)

# Paddleocr目前支持的多语言语种可以通过修改lang参数进行切换
ocr = PaddleOCR(use_angle_cls=True, lang="ch",use_gpu=False)  # need to run only once to download and load model into memory
img_path = '123.png'
result = ocr.ocr(img_path, cls=True)
print(result)

这代码就是官方示例代码,我不知道还需要改什么才可以识别。