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

paddleocr命令是否可以指定输出保存 #10533

Closed
cole-dda opened this issue Aug 2, 2023 · 5 comments
Closed

paddleocr命令是否可以指定输出保存 #10533

cole-dda opened this issue Aug 2, 2023 · 5 comments
Assignees
Labels
Code PR is needed This issue could inspire a code PR stale status/close

Comments

@cole-dda
Copy link

cole-dda commented Aug 2, 2023

安装后,提供的paddleocr命令,在ocr识别的时候,无法保存结果而总是输出到日志

是否可以提供一个参数指定

目前还需要手动去写代码来解决,而无法开箱即用。

@ToddBear ToddBear added the Code PR is needed This issue could inspire a code PR label Aug 3, 2023
@raoyutian
Copy link
Contributor

下面是python代码,可以参考
`from datetime import datetime
import io
import os
import paddleocr
import numpy as np
from PIL import Image
def main():
ppocr=paddleocr.PaddleOCR(ocr_version='PP-OCRv3',use_cls=False,use_det=True,use_gpu=False,enable_mkldnn=True,max_side_len=960,cpu_math_library_num_threads=24);
imagepath=os.path.abspath('.')+"\image\"
imagefiles=os.listdir(imagepath)
total=[]
for image in imagefiles:
imagefile=imagepath+image

   temp= Image.open(imagefile)
   img=np.array(temp)[:,:,:3]
   t1= datetime.utcnow()
   info=ppocr.ocr(img)
   t2=datetime.utcnow()
   c=t2-t1
   total.append(c)
   print("time:",c);
   result=""
   for textblocks in info:
        result= result+textblocks[1][0]
   print(result)
print("平均时间:",   np.mean(total));

if name=="main":
main()
input()
`

@ToddBear
Copy link
Collaborator

提问者应该是想要新增一个args,使得可以在命令行处控制OCR结果的存储

上述代码好像不能回答这个问题,希望您能够提供新的解决方案 : )

@WilliamQf-AI
Copy link
Contributor

WilliamQf-AI commented Aug 10, 2023

已提交pr,效果如图所示:
image

@ToddBear
Copy link
Collaborator

@cole-dda 请问 @WilliamQf-AI 实现的功能是你想要的吗?

shiyutang pushed a commit that referenced this issue Aug 21, 2023
…es: (#10628)

* 实现功能:当--savefile为true时,在--output下以当前图片名称后接“.txt”为文件名保存ocr推理结果,解决了issues:
#10533

* 删除了乱码字符

* 1.删除了乱码字符

* 1.删除了乱码字符
Copy link
Contributor

github-actions bot commented Jan 3, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code PR is needed This issue could inspire a code PR stale status/close
Projects
None yet
Development

No branches or pull requests

5 participants