当前位置:网站首页>Hands-on OCR (1)
Hands-on OCR (1)
2022-08-02 14:18:00 【weixin_50862344】
文本检测:DBNet
环境:paddle
import matplotlib
from Cython import inline
from paddleocr import PaddleOCR
ocr=PaddleOCR()
#修改图片路径
img_path='D:/computervision/ocr/ppocr_img/imgs/12.jpg'
result =ocr.ocr(img_path,rec=False)
print(f'the predict as follow')
print(result)
import numpy as np
import cv2
import matplotlib.pyplot as plt
image = cv2.imread(img_path)
#The following sentence seems optional and does not affect the structure
boxes=[line[0] for line in result]
for box in result:
box=np.reshape(np.array(box),[-1,1,2]).astype(np.int64)
image=cv2.polylines(np.array(image),[box],True,(255,0,0),2)
plt.figure(figsize=(10,10))
#The code has been modified here
plt.imshow(image)
plt.show()
paddle
- 核心代码
声明PaddleOCR类:
ocr=PaddleOCR()
- 执行预测:
result =ocr.ocr(img_path,rec=False)
- 运行结果

- Please explain other libraries
- reshape改变数组形状
- 参数
(1)传入数组
(2)排序方式
A shape dimension can be-1.在这种情况下,The value is inferred from the length and remaining dimensions of the array.
Example from withcsdnanother blogger
(3)order
‘C’ means C order, ‘F’ means Fortran order
orderIn fact, I don't really understand it to be honest,I'll add it when I figure it out
2)astype
强制转化数据类型
3)figure
figure(num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None, frameon=True)
- 作用:My understanding is kind of likejavafx的scence.
- 参数
num:图像编号或名称,数字为编号 ,字符串为名称
figsize:指定figure的宽和高,单位为英寸;
dpi参数:指定绘图对象的分辨率,即每英寸多少个像素,缺省值为80
facecolor:背景颜色
edgecolor:边框颜色
frameon:是否显示边框
DB文本检测模型
import paddle
import os
import sys
import importlib
# paddleocr_path='D:/computervision/ocr/PaddleOCR-release-2.5/PaddleOCR-release-2.5/ppocr'
# sys.path.append( paddleocr_path )
# os.chdir(paddleocr_path)
# print("当前工作目录"+os.getcwd())
#import into the path
from ppocr.modeling.backbones.det_mobilenet_v3 import MobileNetV3
fake_input=paddle.randn([1,3,640,640],dtype='float32')
model_backbone=MobileNetV3()
model_backbone.eval()
outs=model_backbone(fake_input)
print(model_backbone)
for idx,out in enumerate(outs):
print("the index",idx,"shape:",out.shape)
ppocrThe path is different from the current file working path and was not found at first,I tried many methods to no avail,used in the article第2种办法to read the file
边栏推荐
- 第二届中国Rust开发者大会(RustChinaConf 2021~2022)线上大会正式开启报名
- Flask框架的搭建及入门
- About the development forecast of the market outlook?2021-05-23
- MySQL数据库设计规范
- Data Organization---Chapter 6 Diagram---Graph Traversal---Multiple Choice Questions
- Tornado框架路由系统介绍及(IOloop.current().start())启动源码分析
- drf路由组件Routers
- mysql的case when如何用
- Raft协议图解,缺陷以及优化
- Object detection scene SSD-Mobilenetv1-FPN
猜你喜欢

logback源码阅读(一)获取ILoggerFactory、Logger
ROS通信 —— 节点,Nodes & Master](/img/f5/c541259b69a0db3dc15a61e87f0415.png)
[ROS](05)ROS通信 —— 节点,Nodes & Master

mysql的case when如何用

瑞吉外卖笔记——第08讲读写分离

What are the file encryption software?Keep your files safe

Supervision strikes again, what about the market outlook?2021-05-22

deal!It's July 30th!

RKMPP 在FFmpeg上实现硬编解码

How does Apache, the world's largest open source foundation, work?

Raft协议图解,缺陷以及优化
随机推荐
What are the file encryption software?Keep your files safe
How does Apache, the world's largest open source foundation, work?
Sentinel源码(二)入口方法分析
期货具体是如何开户的?
MobileNet ShuffleNet & yolov5替换backbone
文件加密软件有哪些?保障你的文件安全
xshell连接虚拟机步骤_建立主机与vm虚拟机的网络连接
drf源码分析与全局捕获异常
chapter6可视化(不想看版)
Mysql's case the when you how to use
Geoffery Hinton:深度学习的下一个大事件
第十二单元 关联序列化处理
编程规范——LiteOS
【ROS】编译软件包packages遇到进度缓慢或卡死,使用swap
Sentinel源码(六)ParamFlowSlot热点参数限流
Shell脚本完成pxe装机配置
Supervision strikes again, what about the market outlook?2021-05-22
[ROS]ROS常用工具介绍(待续)
Flask框架深入一
数据机构---第六章图---图的遍历---选择题