当前位置:网站首页>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!!!
边栏推荐
猜你喜欢
动态刷新日志级别
paddleocr window10初体验
数据机构---第六章图---图的遍历---选择题
动手学ocr(一)
About the development forecast of the market outlook?2021-05-23
深度学习框架pytorch快速开发与实战chapter3
Shell脚本完成pxe装机配置
史上最全!47个“数字化转型”常见术语合集,看完秒懂~
深度学习框架pytorch快速开发与实战chapter4
The bad policy has no long-term impact on the market, and the bull market will continue 2021-05-19
随机推荐
深度学习框架pytorch快速开发与实战chapter3
Flask框架
网络安全第一次作业
What is the difference between web testing and app testing?
Configure zabbix auto-discovery and auto-registration.
Linux:CentOS 7 安装MySQL5.7
WeChat Mini Program-Recent Dynamic Scrolling Implementation
The bad policy has no long-term impact on the market, and the bull market will continue 2021-05-19
网络安全第二次作业
如何解决mysql服务无法启动1069
一维卷积神经网络_卷积神经网络的基础知识「建议收藏」
[ROS](06)ROS通信 —— 话题(Topic)通信
php开源的客服系统_在线客服源码php
replay视频播放器_怎么让手机音乐跟视频一起放
2022-08-02日报:2022年7月最热的10篇AI论文
文件加密软件有哪些?保障你的文件安全
第二讲 软件生命周期
政策利空对行情没有长期影响,牛市仍将继续 2021-05-19
第六单元 初识ORM
动手学ocr(一)