Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleOCR
提交
f7e1ba1d
P
PaddleOCR
项目概览
s920243400
/
PaddleOCR
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleOCR
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
f7e1ba1d
编写于
5月 02, 2022
作者:
S
Shuangchi He
提交者:
GitHub
5月 02, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix some typos for Jetson, metrics and result. (#6118)
上级
37e3bc16
变更
12
显示空白变更内容
内联
并排
Showing
12 changed file
with
25 addition
and
25 deletion
+25
-25
doc/doc_ch/add_new_algorithm.md
doc/doc_ch/add_new_algorithm.md
+1
-1
doc/doc_en/add_new_algorithm_en.md
doc/doc_en/add_new_algorithm_en.md
+1
-1
ppocr/metrics/det_metric.py
ppocr/metrics/det_metric.py
+2
-2
ppocr/metrics/e2e_metric.py
ppocr/metrics/e2e_metric.py
+2
-2
ppocr/metrics/kie_metric.py
ppocr/metrics/kie_metric.py
+2
-2
ppstructure/vqa/infer_ser_e2e.py
ppstructure/vqa/infer_ser_e2e.py
+1
-1
ppstructure/vqa/train_re.py
ppstructure/vqa/train_re.py
+5
-5
test_tipc/docs/jeston_test_train_inference_python.md
test_tipc/docs/jeston_test_train_inference_python.md
+4
-4
tools/infer/predict_system.py
tools/infer/predict_system.py
+3
-3
tools/infer/utility.py
tools/infer/utility.py
+1
-1
tools/infer_cls.py
tools/infer_cls.py
+2
-2
tools/infer_e2e.py
tools/infer_e2e.py
+1
-1
未找到文件。
doc/doc_ch/add_new_algorithm.md
浏览文件 @
f7e1ba1d
...
@@ -246,7 +246,7 @@ class MyMetric(object):
...
@@ -246,7 +246,7 @@ class MyMetric(object):
def
get_metric
(
self
):
def
get_metric
(
self
):
"""
"""
return met
ir
cs {
return met
ri
cs {
'acc': 0,
'acc': 0,
'norm_edit_dis': 0,
'norm_edit_dis': 0,
}
}
...
...
doc/doc_en/add_new_algorithm_en.md
浏览文件 @
f7e1ba1d
...
@@ -237,7 +237,7 @@ class MyMetric(object):
...
@@ -237,7 +237,7 @@ class MyMetric(object):
def
get_metric
(
self
):
def
get_metric
(
self
):
"""
"""
return met
ir
cs {
return met
ri
cs {
'acc': 0,
'acc': 0,
'norm_edit_dis': 0,
'norm_edit_dis': 0,
}
}
...
...
ppocr/metrics/det_metric.py
浏览文件 @
f7e1ba1d
...
@@ -65,9 +65,9 @@ class DetMetric(object):
...
@@ -65,9 +65,9 @@ class DetMetric(object):
}
}
"""
"""
met
ir
cs
=
self
.
evaluator
.
combine_results
(
self
.
results
)
met
ri
cs
=
self
.
evaluator
.
combine_results
(
self
.
results
)
self
.
reset
()
self
.
reset
()
return
met
ir
cs
return
met
ri
cs
def
reset
(
self
):
def
reset
(
self
):
self
.
results
=
[]
# clear results
self
.
results
=
[]
# clear results
ppocr/metrics/e2e_metric.py
浏览文件 @
f7e1ba1d
...
@@ -78,9 +78,9 @@ class E2EMetric(object):
...
@@ -78,9 +78,9 @@ class E2EMetric(object):
self
.
results
.
append
(
result
)
self
.
results
.
append
(
result
)
def
get_metric
(
self
):
def
get_metric
(
self
):
met
ir
cs
=
combine_results
(
self
.
results
)
met
ri
cs
=
combine_results
(
self
.
results
)
self
.
reset
()
self
.
reset
()
return
met
ir
cs
return
met
ri
cs
def
reset
(
self
):
def
reset
(
self
):
self
.
results
=
[]
# clear results
self
.
results
=
[]
# clear results
ppocr/metrics/kie_metric.py
浏览文件 @
f7e1ba1d
...
@@ -59,9 +59,9 @@ class KIEMetric(object):
...
@@ -59,9 +59,9 @@ class KIEMetric(object):
def
get_metric
(
self
):
def
get_metric
(
self
):
met
ir
cs
=
self
.
combine_results
(
self
.
results
)
met
ri
cs
=
self
.
combine_results
(
self
.
results
)
self
.
reset
()
self
.
reset
()
return
met
ir
cs
return
met
ri
cs
def
reset
(
self
):
def
reset
(
self
):
self
.
results
=
[]
# clear results
self
.
results
=
[]
# clear results
...
...
ppstructure/vqa/infer_ser_e2e.py
浏览文件 @
f7e1ba1d
...
@@ -149,7 +149,7 @@ if __name__ == "__main__":
...
@@ -149,7 +149,7 @@ if __name__ == "__main__":
result
,
_
=
ser_engine
(
img
)
result
,
_
=
ser_engine
(
img
)
fout
.
write
(
img_path
+
"
\t
"
+
json
.
dumps
(
fout
.
write
(
img_path
+
"
\t
"
+
json
.
dumps
(
{
{
"ser_resul
e
"
:
result
,
"ser_resul
t
"
:
result
,
},
ensure_ascii
=
False
)
+
"
\n
"
)
},
ensure_ascii
=
False
)
+
"
\n
"
)
img_res
=
draw_ser_results
(
img
,
result
)
img_res
=
draw_ser_results
(
img
,
result
)
...
...
ppstructure/vqa/train_re.py
浏览文件 @
f7e1ba1d
...
@@ -145,7 +145,7 @@ def train(args):
...
@@ -145,7 +145,7 @@ def train(args):
global_step
=
0
global_step
=
0
model
.
clear_gradients
()
model
.
clear_gradients
()
train_dataloader_len
=
len
(
train_dataloader
)
train_dataloader_len
=
len
(
train_dataloader
)
best_met
ir
c
=
{
'f1'
:
0
}
best_met
ri
c
=
{
'f1'
:
0
}
model
.
train
()
model
.
train
()
train_reader_cost
=
0.0
train_reader_cost
=
0.0
...
@@ -192,8 +192,8 @@ def train(args):
...
@@ -192,8 +192,8 @@ def train(args):
# Log metrics
# Log metrics
# Only evaluate when single GPU otherwise metrics may not average well
# Only evaluate when single GPU otherwise metrics may not average well
results
=
evaluate
(
model
,
eval_dataloader
,
logger
)
results
=
evaluate
(
model
,
eval_dataloader
,
logger
)
if
results
[
'f1'
]
>=
best_met
ir
c
[
'f1'
]:
if
results
[
'f1'
]
>=
best_met
ri
c
[
'f1'
]:
best_met
ir
c
=
results
best_met
ri
c
=
results
output_dir
=
os
.
path
.
join
(
args
.
output_dir
,
"best_model"
)
output_dir
=
os
.
path
.
join
(
args
.
output_dir
,
"best_model"
)
os
.
makedirs
(
output_dir
,
exist_ok
=
True
)
os
.
makedirs
(
output_dir
,
exist_ok
=
True
)
if
distributed
:
if
distributed
:
...
@@ -206,7 +206,7 @@ def train(args):
...
@@ -206,7 +206,7 @@ def train(args):
logger
.
info
(
"Saving model checkpoint to {}"
.
format
(
logger
.
info
(
"Saving model checkpoint to {}"
.
format
(
output_dir
))
output_dir
))
logger
.
info
(
"eval results: {}"
.
format
(
results
))
logger
.
info
(
"eval results: {}"
.
format
(
results
))
logger
.
info
(
"best_met
irc: {}"
.
format
(
best_metir
c
))
logger
.
info
(
"best_met
ric: {}"
.
format
(
best_metri
c
))
reader_start
=
time
.
time
()
reader_start
=
time
.
time
()
if
rank
==
0
:
if
rank
==
0
:
...
@@ -220,7 +220,7 @@ def train(args):
...
@@ -220,7 +220,7 @@ def train(args):
tokenizer
.
save_pretrained
(
output_dir
)
tokenizer
.
save_pretrained
(
output_dir
)
paddle
.
save
(
args
,
os
.
path
.
join
(
output_dir
,
"training_args.bin"
))
paddle
.
save
(
args
,
os
.
path
.
join
(
output_dir
,
"training_args.bin"
))
logger
.
info
(
"Saving model checkpoint to {}"
.
format
(
output_dir
))
logger
.
info
(
"Saving model checkpoint to {}"
.
format
(
output_dir
))
logger
.
info
(
"best_met
irc: {}"
.
format
(
best_metir
c
))
logger
.
info
(
"best_met
ric: {}"
.
format
(
best_metri
c
))
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
test_tipc/docs/jeston_test_train_inference_python.md
浏览文件 @
f7e1ba1d
# Je
st
on端基础训练预测功能测试
# Je
ts
on端基础训练预测功能测试
Je
ston端基础训练预测功能测试的主程序为
`test_inference_inference.sh`
,由于Jeston端CPU较差,Jest
on只需要测试TIPC关于GPU和TensorRT预测推理的部分即可。
Je
tson端基础训练预测功能测试的主程序为
`test_inference_inference.sh`
,由于Jetson端CPU较差,Jets
on只需要测试TIPC关于GPU和TensorRT预测推理的部分即可。
## 1. 测试结论汇总
## 1. 测试结论汇总
...
@@ -42,7 +42,7 @@ Jeston端基础训练预测功能测试的主程序为`test_inference_inference.
...
@@ -42,7 +42,7 @@ Jeston端基础训练预测功能测试的主程序为`test_inference_inference.
先运行
`prepare.sh`
准备数据和模型,然后运行
`test_inference_inference.sh`
进行测试,最终在
```test_tipc/output```
目录下生成
`python_infer_*.log`
格式的日志文件。
先运行
`prepare.sh`
准备数据和模型,然后运行
`test_inference_inference.sh`
进行测试,最终在
```test_tipc/output```
目录下生成
`python_infer_*.log`
格式的日志文件。
`test_inference_inference.sh`
仅有一个模式
`whole_infer`
,在Je
st
on端,仅需要测试预测推理的模式即可:
`test_inference_inference.sh`
仅有一个模式
`whole_infer`
,在Je
ts
on端,仅需要测试预测推理的模式即可:
```
```
- 模式3:whole_infer,不训练,全量数据预测,走通开源模型评估、动转静,检查inference model预测时间和精度;
- 模式3:whole_infer,不训练,全量数据预测,走通开源模型评估、动转静,检查inference model预测时间和精度;
...
@@ -51,7 +51,7 @@ bash test_tipc/prepare.sh ./test_tipc/configs/ch_ppocr_mobile_v2.0_det/model_lin
...
@@ -51,7 +51,7 @@ bash test_tipc/prepare.sh ./test_tipc/configs/ch_ppocr_mobile_v2.0_det/model_lin
# 用法1:
# 用法1:
bash test_tipc/test_inference_inference.sh ./test_tipc/configs/ch_ppocr_mobile_v2.0_det/model_linux_gpu_normal_normal_infer_python_jetson.txt 'whole_infer'
bash test_tipc/test_inference_inference.sh ./test_tipc/configs/ch_ppocr_mobile_v2.0_det/model_linux_gpu_normal_normal_infer_python_jetson.txt 'whole_infer'
# 用法2: 指定GPU卡预测,第三个传入参数为GPU卡号
# 用法2: 指定GPU卡预测,第三个传入参数为GPU卡号
bash test_tipc/test_inference_je
st
on.sh ./test_tipc/configs/ch_ppocr_mobile_v2.0_det/model_linux_gpu_normal_normal_infer_python_jetson.txt 'whole_infer' '1'
bash test_tipc/test_inference_je
ts
on.sh ./test_tipc/configs/ch_ppocr_mobile_v2.0_det/model_linux_gpu_normal_normal_infer_python_jetson.txt 'whole_infer' '1'
```
```
运行相应指令后,在`test_tipc/output`文件夹下自动会保存运行日志。如`whole_infer`模式下,会运行训练+inference的链条,因此,在`test_tipc/output`文件夹有以下文件:
运行相应指令后,在`test_tipc/output`文件夹下自动会保存运行日志。如`whole_infer`模式下,会运行训练+inference的链条,因此,在`test_tipc/output`文件夹有以下文件:
...
...
tools/infer/predict_system.py
浏览文件 @
f7e1ba1d
...
@@ -93,11 +93,11 @@ class TextSystem(object):
...
@@ -93,11 +93,11 @@ class TextSystem(object):
self
.
draw_crop_rec_res
(
self
.
args
.
crop_res_save_dir
,
img_crop_list
,
self
.
draw_crop_rec_res
(
self
.
args
.
crop_res_save_dir
,
img_crop_list
,
rec_res
)
rec_res
)
filter_boxes
,
filter_rec_res
=
[],
[]
filter_boxes
,
filter_rec_res
=
[],
[]
for
box
,
rec_re
us
lt
in
zip
(
dt_boxes
,
rec_res
):
for
box
,
rec_re
su
lt
in
zip
(
dt_boxes
,
rec_res
):
text
,
score
=
rec_re
us
lt
text
,
score
=
rec_re
su
lt
if
score
>=
self
.
drop_score
:
if
score
>=
self
.
drop_score
:
filter_boxes
.
append
(
box
)
filter_boxes
.
append
(
box
)
filter_rec_res
.
append
(
rec_re
us
lt
)
filter_rec_res
.
append
(
rec_re
su
lt
)
return
filter_boxes
,
filter_rec_res
return
filter_boxes
,
filter_rec_res
...
...
tools/infer/utility.py
浏览文件 @
f7e1ba1d
...
@@ -187,7 +187,7 @@ def create_predictor(args, mode, logger):
...
@@ -187,7 +187,7 @@ def create_predictor(args, mode, logger):
gpu_id
=
get_infer_gpuid
()
gpu_id
=
get_infer_gpuid
()
if
gpu_id
is
None
:
if
gpu_id
is
None
:
logger
.
warning
(
logger
.
warning
(
"GPU is not found in current device by nvidia-smi. Please check your device or ignore it if run on je
st
on."
"GPU is not found in current device by nvidia-smi. Please check your device or ignore it if run on je
ts
on."
)
)
config
.
enable_use_gpu
(
args
.
gpu_mem
,
0
)
config
.
enable_use_gpu
(
args
.
gpu_mem
,
0
)
if
args
.
use_tensorrt
:
if
args
.
use_tensorrt
:
...
...
tools/infer_cls.py
浏览文件 @
f7e1ba1d
...
@@ -73,8 +73,8 @@ def main():
...
@@ -73,8 +73,8 @@ def main():
images
=
paddle
.
to_tensor
(
images
)
images
=
paddle
.
to_tensor
(
images
)
preds
=
model
(
images
)
preds
=
model
(
images
)
post_result
=
post_process_class
(
preds
)
post_result
=
post_process_class
(
preds
)
for
rec_re
us
lt
in
post_result
:
for
rec_re
su
lt
in
post_result
:
logger
.
info
(
'
\t
result: {}'
.
format
(
rec_re
us
lt
))
logger
.
info
(
'
\t
result: {}'
.
format
(
rec_re
su
lt
))
logger
.
info
(
"success!"
)
logger
.
info
(
"success!"
)
...
...
tools/infer_e2e.py
浏览文件 @
f7e1ba1d
...
@@ -104,7 +104,7 @@ def main():
...
@@ -104,7 +104,7 @@ def main():
preds
=
model
(
images
)
preds
=
model
(
images
)
post_result
=
post_process_class
(
preds
,
shape_list
)
post_result
=
post_process_class
(
preds
,
shape_list
)
points
,
strs
=
post_result
[
'points'
],
post_result
[
'texts'
]
points
,
strs
=
post_result
[
'points'
],
post_result
[
'texts'
]
# write resul
e
# write resul
t
dt_boxes_json
=
[]
dt_boxes_json
=
[]
for
poly
,
str
in
zip
(
points
,
strs
):
for
poly
,
str
in
zip
(
points
,
strs
):
tmp_json
=
{
"transcription"
:
str
}
tmp_json
=
{
"transcription"
:
str
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录