当前位置:网站首页>paddleocr window10 first experience
paddleocr window10 first experience
2022-08-02 14:18:00 【weixin_50862344】
paddle环境安装
- 由于cMy plate is fullcondaThe whole movedd盘
在cmd中的代码
conda create --prefix==D:\... python
使用–prefix==指定了位置
The corresponding activation also uses a specific path
activate D:\conda\envs\paddle_env
- Then follow it honestly官网进行下载
- 有多个python.exe文件
这里最好指定python进行,Sometimes it is okay not to specify,Occasionally report an error
Python 3.8.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:18:16) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import paddle
>>> print(paddle.utils.run_check())
Running verify PaddlePaddle program ...
W0719 02:01:59.063643 16104 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 6.1, Driver API Version: 10.2, Runtime API Version: 10.2
W0719 02:01:59.066314 16104 dynamic_loader.cc:276] Note: [Recommend] copy cudnn into CUDA installation directory.
For instance, download cudnn-10.0-windows10-x64-v7.6.5.32.zip from NVIDIA's official website,
then, unzip it and copy it into C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0
You should do this according to your CUDA installation directory and CUDNN version.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
测试代码:
import paddle
paddle.utils.run_check()
My words are directly specified in the environment just createdpython(这部分是在cmdinside)
在pycharmThe command line doesn't seem to respondwhere python,但是使用pythonBetter to specify!!!
paddle 安装
- 根据gitee官方介绍Basically a perfect configuration can be achieved
- 注意一些小细节
我是直接在pycharmIt directly opens a virtual environment for configuration,Click on the far right belowterminal直接进入终端
在配置环境中 直接python(如下图)
其次就是GitHubThe code above will report some inexplicable errors
Check the installation package
pip list
使用
(1)命令行使用
cd 图片文件夹路径
cd /path/to/ppocr_img
paddleocr --image_dir ./imgs/11.jpg --use_angle_cls true --use_gpu false
–use_angle_cls Set whether to use orientation classifier recognition180度旋转文字
–use_gpu false设置是否使用GPU
单独使用检测:设置–rec为false
given at this time坐标位置单独使用识别:设置–det为false
The identified is given at this timecontent and confidencedue to environment configuration,我使用的是cpu
Therefore, an additional sentence is added to the two codes on the official website**–use_gpu false**
单独使用:
paddleocr --image_dir ./imgs/11.jpg --rec false --use_gpu false
单独使用识别:
paddleocr --image_dir ./imgs_words/ch/word_1.jpg --det false --use_gpu false
Below is the code from the official website(cpufriends, press the change above,gpu按下面的)
不然会报错(如下面代码)!!!!!paddle默认是开gpu的
RuntimeError: (PreconditionNotMet) The third-party dynamic library (cudnn64_7.dll) that Paddle depends on is not configured correctly. (error code is 126)
Suggestions:
1. Check if the third-party dynamic library (e.g. CUDA, CUDNN) is installed correctly and its version is matched with paddlepaddle you installed.
2. Configure third-party dynamic library environment variables as follows:
- Linux: set LD_LIBRARY_PATH by `export LD_LIBRARY_PATH=...`
- Windows: set PATH by `set PATH=XXX; (at ..\paddle\phi\backends\dynload\dynamic_loader.cc:303)
(2)python脚本使用
1)常用语句
- 导入常用包
from paddleocr import PaddleOCR, draw_ocr
- 实例化ocr
ocr = PaddleOCR(use_angle_cls=True, lang="ch")
#中文识别
- 调用ocr接口
result = ocr.ocr(img_path, cls=True)
2)报错
OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
我是直接将paddle环境中的libiomp5md.dll删除
2.我是使用cpu在跑
ocr = PaddleOCR(use_angle_cls=True, lang="ch",use_gpu=False)
#加上use_gpu=False
Attached is my modification官网的完整代码
from paddleocr import PaddleOCR, draw_ocr
# Paddleocr目前支持的多语言语种可以通过修改lang参数进行切换
# 例如`ch`, `en`, `fr`, `german`, `korean`, `japan`
ocr = PaddleOCR(use_angle_cls=True, lang="ch",use_gpu=False)#加上use_gpu=False
# need to run only once to download and load model into memory
img_path = 'D:/computervision/ocr/ppocr_img/imgs/11.jpg'#改成自己的路径
result = ocr.ocr(img_path, cls=True)
for line in result:
print(line)
# 显示结果
from PIL import Image
image = Image.open(img_path).convert('RGB')
boxes = [line[0] for line in result]
txts = [line[1][0] for line in result]
scores = [line[1][1] for line in result]
im_show = draw_ocr(image, boxes, txts, scores, font_path='./fonts/simfang.ttf')
im_show = Image.fromarray(im_show)
im_show.save('result.jpg')
There might be a problem with the visualization!!!If you see something wrong, let me know!!!
边栏推荐
猜你喜欢
随机推荐
无序数组排序并得到最大间隔
Break the limit of file locks and use storage power to help enterprises grow new momentum
理解TCP长连接(Keepalive)
【ONE·Data || Getting Started with Sorting】
云片网案例
Sentinel源码(五)FlowSlot以及限流控制器源码分析
idea社区版下载安装教程_安装天然气管道的流程
Audio processing: floating point data stream to PCM file
第十单元 前后连调
php开源的客服系统_在线客服源码php
Sentinel源码(四)(滑动窗口流量统计)
What are the file encryption software?Keep your files safe
drf序列化器-Serializer
How to solve mysql service cannot start 1069
瑞吉外卖笔记——第08讲读写分离
网络安全第五次作业
线代:已知一个特征向量快速求另外两个与之正交的特征向量
不精确微分/不完全微分(Inexact differential/Imperfect differential)
Linux:CentOS 7 安装MySQL5.7
跑yolov5又出啥问题了(1)p,r,map全部为0