赞
踩
需要把所有滑块图片的数据文字提取出来
mkdir paddle
cd paddle
docker run -itd --name ppocr -v $PWD:/paddle --network=host -it registry.baidubce.com/paddlepaddle/paddle:2.1.3-gpu-cuda10.2-cudnn7 /bin/bash
docker exec -it ppocr bash
#cpu
python3 -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
pip install "paddleocr>=2.0.1" -i https://mirror.baidu.com/pypi/simple # 推荐使用2.0.1+版本
paddleocr --image_dir ./imgs_words/ch/word_1.jpg --det false
from paddleocr import PaddleOCR, draw_ocr
import os
# 指定目录路径
directory = './test/'
ocr = PaddleOCR(det=False) # need to run only once to download and load model into memory
# 遍历目录下所有文件
for filename in os.listdir(directory):
# 检查文件是否以 .jpg 结尾
if filename.endswith('.jpg'):
# 获取完整的文件路径
img_path = os.path.join(directory, filename)
# 在此处添加处理图片的代码
print(img_path)
#img_path = f'{img_path}'
result = ocr.ocr(img_path, det=False)
for idx in range(len(result)):
res = result[idx]
print(res[0][0])
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。