Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
079cdf98
P
PaddleOCR
项目概览
PaddlePaddle
/
PaddleOCR
大约 1 年 前同步成功
通知
1528
Star
32962
Fork
6643
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
108
列表
看板
标记
里程碑
合并请求
7
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
108
Issue
108
列表
看板
标记
里程碑
合并请求
7
合并请求
7
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
079cdf98
编写于
6月 27, 2022
作者:
Z
zhoujun
提交者:
GitHub
6月 27, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update save model func (#6693)
* save latest metric * save latest metric * add boader judge * add boader judge
上级
59d854c6
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
9 deletion
+16
-9
PPOCRLabel/libs/shape.py
PPOCRLabel/libs/shape.py
+1
-0
applications/轻量级车牌识别.md
applications/轻量级车牌识别.md
+6
-5
ppocr/data/imaug/fce_targets.py
ppocr/data/imaug/fce_targets.py
+7
-2
ppocr/utils/save_load.py
ppocr/utils/save_load.py
+2
-2
未找到文件。
PPOCRLabel/libs/shape.py
浏览文件 @
079cdf98
...
@@ -48,6 +48,7 @@ class Shape(object):
...
@@ -48,6 +48,7 @@ class Shape(object):
def
__init__
(
self
,
label
=
None
,
line_color
=
None
,
difficult
=
False
,
key_cls
=
"None"
,
paintLabel
=
False
):
def
__init__
(
self
,
label
=
None
,
line_color
=
None
,
difficult
=
False
,
key_cls
=
"None"
,
paintLabel
=
False
):
self
.
label
=
label
self
.
label
=
label
self
.
idx
=
0
self
.
points
=
[]
self
.
points
=
[]
self
.
fill
=
False
self
.
fill
=
False
self
.
selected
=
False
self
.
selected
=
False
...
...
applications/轻量级车牌识别.md
浏览文件 @
079cdf98
...
@@ -311,7 +311,6 @@ python tools/train.py -c configs/det/ch_PP-OCRv3/ch_PP-OCRv3_det_student.yml -o
...
@@ -311,7 +311,6 @@ python tools/train.py -c configs/det/ch_PP-OCRv3/ch_PP-OCRv3_det_student.yml -o
在上述命令中,通过
`-o`
的方式修改了配置文件中的参数。
在上述命令中,通过
`-o`
的方式修改了配置文件中的参数。
训练好的模型地址为:
[
det_ppocr_v3_finetune.tar
](
https://paddleocr.bj.bcebos.com/fanliku/license_plate_recognition/det_ppocr_v3_finetune.tar
)
**评估**
**评估**
...
@@ -354,8 +353,6 @@ python3.7 deploy/slim/quantization/quant.py -c configs/det/ch_PP-OCRv3/ch_PP-OCR
...
@@ -354,8 +353,6 @@ python3.7 deploy/slim/quantization/quant.py -c configs/det/ch_PP-OCRv3/ch_PP-OCR
Eval.dataset.label_file_list
=[
/home/aistudio/data/CCPD2020/PPOCR/test/det.txt]
Eval.dataset.label_file_list
=[
/home/aistudio/data/CCPD2020/PPOCR/test/det.txt]
```
```
训练好的模型地址为:
[
det_ppocr_v3_quant.tar
](
https://paddleocr.bj.bcebos.com/fanliku/license_plate_recognition/det_ppocr_v3_quant.tar
)
量化后指标对比如下
量化后指标对比如下
|方案|hmeans| 模型大小 | 预测速度(lite) |
|方案|hmeans| 模型大小 | 预测速度(lite) |
...
@@ -436,6 +433,12 @@ python tools/eval.py -c configs/rec/PP-OCRv3/ch_PP-OCRv3_rec.yml -o \
...
@@ -436,6 +433,12 @@ python tools/eval.py -c configs/rec/PP-OCRv3/ch_PP-OCRv3_rec.yml -o \
Eval.dataset.label_file_list
=[
/home/aistudio/data/CCPD2020/PPOCR/test/rec.txt]
Eval.dataset.label_file_list
=[
/home/aistudio/data/CCPD2020/PPOCR/test/rec.txt]
```
```
如需获取已训练模型,请扫码填写问卷,加入PaddleOCR官方交流群获取全部OCR垂类模型下载链接、《动手学OCR》电子书等全套OCR学习资料🎁
<div
align=
"left"
>
<img
src=
"https://ai-studio-static-online.cdn.bcebos.com/dd721099bd50478f9d5fb13d8dd00fad69c22d6848244fd3a1d3980d7fefc63e"
width =
"150"
height =
"150"
/>
</div>
评估部分日志如下:
评估部分日志如下:
```
bash
```
bash
[
2022/05/12 19:52:02] ppocr INFO: load pretrain successful from models/ch_PP-OCRv3_rec_train/best_accuracy
[
2022/05/12 19:52:02] ppocr INFO: load pretrain successful from models/ch_PP-OCRv3_rec_train/best_accuracy
...
@@ -528,7 +531,6 @@ python tools/train.py -c configs/rec/PP-OCRv3/ch_PP-OCRv3_rec.yml -o \
...
@@ -528,7 +531,6 @@ python tools/train.py -c configs/rec/PP-OCRv3/ch_PP-OCRv3_rec.yml -o \
Eval.dataset.data_dir
=
/home/aistudio/data/CCPD2020/PPOCR
\
Eval.dataset.data_dir
=
/home/aistudio/data/CCPD2020/PPOCR
\
Eval.dataset.label_file_list
=[
/home/aistudio/data/CCPD2020/PPOCR/test/rec.txt]
Eval.dataset.label_file_list
=[
/home/aistudio/data/CCPD2020/PPOCR/test/rec.txt]
```
```
训练好的模型地址为:
[
rec_ppocr_v3_finetune.tar
](
https://paddleocr.bj.bcebos.com/fanliku/license_plate_recognition/rec_ppocr_v3_finetune.tar
)
**评估**
**评估**
...
@@ -570,7 +572,6 @@ python3.7 deploy/slim/quantization/quant.py -c configs/rec/PP-OCRv3/ch_PP-OCRv3_
...
@@ -570,7 +572,6 @@ python3.7 deploy/slim/quantization/quant.py -c configs/rec/PP-OCRv3/ch_PP-OCRv3_
Eval.dataset.data_dir
=
/home/aistudio/data/CCPD2020/PPOCR
\
Eval.dataset.data_dir
=
/home/aistudio/data/CCPD2020/PPOCR
\
Eval.dataset.label_file_list
=[
/home/aistudio/data/CCPD2020/PPOCR/test/rec.txt]
Eval.dataset.label_file_list
=[
/home/aistudio/data/CCPD2020/PPOCR/test/rec.txt]
```
```
训练好的模型地址为:
[
rec_ppocr_v3_quant.tar
](
https://paddleocr.bj.bcebos.com/fanliku/license_plate_recognition/rec_ppocr_v3_quant.tar
)
量化后指标对比如下
量化后指标对比如下
...
...
ppocr/data/imaug/fce_targets.py
浏览文件 @
079cdf98
...
@@ -107,17 +107,20 @@ class FCENetTargets:
...
@@ -107,17 +107,20 @@ class FCENetTargets:
for
i
in
range
(
1
,
n
):
for
i
in
range
(
1
,
n
):
current_line_len
=
i
*
delta_length
current_line_len
=
i
*
delta_length
while
current_line_len
>=
length_cumsum
[
current_edge_ind
+
1
]:
while
current_
edge_ind
+
1
<
len
(
length_cumsum
)
and
current_
line_len
>=
length_cumsum
[
current_edge_ind
+
1
]:
current_edge_ind
+=
1
current_edge_ind
+=
1
current_edge_end_shift
=
current_line_len
-
length_cumsum
[
current_edge_end_shift
=
current_line_len
-
length_cumsum
[
current_edge_ind
]
current_edge_ind
]
if
current_edge_ind
>=
len
(
length_list
):
break
end_shift_ratio
=
current_edge_end_shift
/
length_list
[
end_shift_ratio
=
current_edge_end_shift
/
length_list
[
current_edge_ind
]
current_edge_ind
]
current_point
=
line
[
current_edge_ind
]
+
(
line
[
current_edge_ind
+
1
]
current_point
=
line
[
current_edge_ind
]
+
(
line
[
current_edge_ind
+
1
]
-
line
[
current_edge_ind
]
-
line
[
current_edge_ind
]
)
*
end_shift_ratio
)
*
end_shift_ratio
resampled_line
.
append
(
current_point
)
resampled_line
.
append
(
current_point
)
resampled_line
.
append
(
line
[
-
1
])
resampled_line
.
append
(
line
[
-
1
])
resampled_line
=
np
.
array
(
resampled_line
)
resampled_line
=
np
.
array
(
resampled_line
)
...
@@ -328,6 +331,8 @@ class FCENetTargets:
...
@@ -328,6 +331,8 @@ class FCENetTargets:
resampled_top_line
,
resampled_bot_line
=
self
.
resample_sidelines
(
resampled_top_line
,
resampled_bot_line
=
self
.
resample_sidelines
(
top_line
,
bot_line
,
self
.
resample_step
)
top_line
,
bot_line
,
self
.
resample_step
)
resampled_bot_line
=
resampled_bot_line
[::
-
1
]
resampled_bot_line
=
resampled_bot_line
[::
-
1
]
if
len
(
resampled_top_line
)
!=
len
(
resampled_bot_line
):
continue
center_line
=
(
resampled_top_line
+
resampled_bot_line
)
/
2
center_line
=
(
resampled_top_line
+
resampled_bot_line
)
/
2
line_head_shrink_len
=
norm
(
resampled_top_line
[
0
]
-
line_head_shrink_len
=
norm
(
resampled_top_line
[
0
]
-
...
...
ppocr/utils/save_load.py
浏览文件 @
079cdf98
...
@@ -177,9 +177,9 @@ def save_model(model,
...
@@ -177,9 +177,9 @@ def save_model(model,
model
.
backbone
.
model
.
save_pretrained
(
model_prefix
)
model
.
backbone
.
model
.
save_pretrained
(
model_prefix
)
metric_prefix
=
os
.
path
.
join
(
model_prefix
,
'metric'
)
metric_prefix
=
os
.
path
.
join
(
model_prefix
,
'metric'
)
# save metric and config
# save metric and config
with
open
(
metric_prefix
+
'.states'
,
'wb'
)
as
f
:
pickle
.
dump
(
kwargs
,
f
,
protocol
=
2
)
if
is_best
:
if
is_best
:
with
open
(
metric_prefix
+
'.states'
,
'wb'
)
as
f
:
pickle
.
dump
(
kwargs
,
f
,
protocol
=
2
)
logger
.
info
(
'save best model is to {}'
.
format
(
model_prefix
))
logger
.
info
(
'save best model is to {}'
.
format
(
model_prefix
))
else
:
else
:
logger
.
info
(
"save model in {}"
.
format
(
model_prefix
))
logger
.
info
(
"save model in {}"
.
format
(
model_prefix
))
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录