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

怎么利用寒武纪mlu卡进行paddleocr检测和识别 #1314

Open
wujf147 opened this issue Jun 25, 2024 · 10 comments
Open

怎么利用寒武纪mlu卡进行paddleocr检测和识别 #1314

wujf147 opened this issue Jun 25, 2024 · 10 comments
Assignees

Comments

@wujf147
Copy link

wujf147 commented Jun 25, 2024

各位老师好,我已按照官网流程进行paddle安装和编译,利用test_lenet_minst.py测试也没有问题;后续我安装了paddleocr想进行检测和识别,但是显示只能使用cpu版本的进行推理,请问怎么使用寒武纪的显卡进行检测和识别呢,需要修改哪些东西?另外在使用docker run时如果使用gpu可以指定--gpus all,类似的在寒武纪mlu可以指定显卡设备吗?paddleocr推理如下所示:
git_issue1

@YanhuiDua
Copy link
Collaborator

你好,建议把你运行的命令也贴出来

PaddleOCR中指定使用mlu进行计算的方式为:使用“--use_mlu=True”,代码见https://github.com/PaddlePaddle/PaddleOCR/blob/433677182f108c1be413ee8a92815bc13b205737/tools/infer/utility.py#L45

@wujf147
Copy link
Author

wujf147 commented Jun 25, 2024

你好,建议把你运行的命令也贴出来

PaddleOCR中指定使用mlu进行计算的方式为:使用“--use_mlu=True”,代码见https://github.com/PaddlePaddle/PaddleOCR/blob/433677182f108c1be413ee8a92815bc13b205737/tools/infer/utility.py#L45

我使用的命令是paddleocr --image_dir /app/idcard1.jpg --use_angle_cls true --lang ch --use_mlu true进行推理,已在utility.py中加入参数,请问在哪里修改use_mlu的实现呢

@YanhuiDua
Copy link
Collaborator

加了 --use_mlu true后,有跑在mlu上吗?

@wujf147
Copy link
Author

wujf147 commented Jun 26, 2024

加了 --use_mlu true后,有跑在mlu上吗?

老师您好,我目前是在utility.py的参数中加上了--ues_mlu true,但是应该还需要在paddleocr进行预测的时候修改代码?具体是在哪个地方修改呢

@wujf147
Copy link
Author

wujf147 commented Jun 26, 2024

加了 --use_mlu true后,有跑在mlu上吗?

老师您好,我之前是在以前拉的paddleocr2.5的代码上添加的--use_mlu,版本和您发的版本不一样,所以理解需要补充代码,如果用您这个版本的应该可以直接运行。另外还有个问题,比如我在寒武纪服务器上运行docker时,想启用寒武纪显卡进行docker run,应该怎么设置参数或者补充代码呢,类似nvidia的显卡可以使用docker run -e CUDA_VISIBLE_DEVICES=0这种?

@YanhuiDua
Copy link
Collaborator

你好,设置可以用的设备 MLU_VISIBLE_DEVICES 来选择设备;ppocr的运行命令我再确认下哈

@YanhuiDua
Copy link
Collaborator

ppocr运行在mlu上需要修改PaddleOCR的代码,代码修改后我会把PR发在这里

@wujf147
Copy link
Author

wujf147 commented Jun 26, 2024

ppocr运行在mlu上需要修改PaddleOCR的代码,代码修改后我会把PR发在这里

好的,谢谢老师

@YanhuiDua
Copy link
Collaborator

@YanhuiDua
Copy link
Collaborator

你好,运行还有其他问题吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants