Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleOCR
提交
425e343b
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看板
提交
425e343b
编写于
7月 14, 2021
作者:
L
LDOUBLEV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support use_gpu as device
上级
2be96bfc
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
15 deletion
+21
-15
tests/ocr_det_params.txt
tests/ocr_det_params.txt
+1
-1
tests/test.sh
tests/test.sh
+20
-14
未找到文件。
tests/ocr_det_params.txt
浏览文件 @
425e343b
...
...
@@ -2,11 +2,11 @@
model_name:ocr_det
python:python3.7
gpu_list:0|0,1
Global.use_gpu:True|False
Global.auto_cast:null
Global.epoch_num:2
Global.save_model_dir:./output/
Train.loader.batch_size_per_card:2
Global.use_gpu:
Global.pretrained_model:null
train_model_name:latest
train_infer_img_dir:./train_data/icdar2015/text_localization/ch4_test_images/
...
...
tests/test.sh
浏览文件 @
425e343b
...
...
@@ -50,14 +50,15 @@ IFS=$'\n'
model_name
=
$(
func_parser_value
"
${
lines
[1]
}
"
)
python
=
$(
func_parser_value
"
${
lines
[2]
}
"
)
gpu_list
=
$(
func_parser_value
"
${
lines
[3]
}
"
)
autocast_list
=
$(
func_parser_value
"
${
lines
[4]
}
"
)
autocast_key
=
$(
func_parser_key
"
${
lines
[4]
}
"
)
epoch_key
=
$(
func_parser_key
"
${
lines
[5]
}
"
)
epoch_num
=
$(
func_parser_value
"
${
lines
[5]
}
"
)
save_model_key
=
$(
func_parser_key
"
${
lines
[6]
}
"
)
train_batch_key
=
$(
func_parser_key
"
${
lines
[7]
}
"
)
train_batch_value
=
$(
func_parser_value
"
${
lines
[7]
}
"
)
train_use_gpu_key
=
$(
func_parser_key
"
${
lines
[8]
}
"
)
train_use_gpu_key
=
$(
func_parser_key
"
${
lines
[4]
}
"
)
train_use_gpu_value
=
$(
func_parser_value
"
${
lines
[4]
}
"
)
autocast_list
=
$(
func_parser_value
"
${
lines
[5]
}
"
)
autocast_key
=
$(
func_parser_key
"
${
lines
[5]
}
"
)
epoch_key
=
$(
func_parser_key
"
${
lines
[6]
}
"
)
epoch_num
=
$(
func_parser_value
"
${
lines
[6]
}
"
)
save_model_key
=
$(
func_parser_key
"
${
lines
[7]
}
"
)
train_batch_key
=
$(
func_parser_key
"
${
lines
[8]
}
"
)
train_batch_value
=
$(
func_parser_value
"
${
lines
[8]
}
"
)
pretrain_model_key
=
$(
func_parser_key
"
${
lines
[9]
}
"
)
pretrain_model_value
=
$(
func_parser_value
"
${
lines
[9]
}
"
)
train_model_name
=
$(
func_parser_value
"
${
lines
[10]
}
"
)
...
...
@@ -132,7 +133,7 @@ function func_inference(){
_flag_quant
=
$6
# inference
for
use_gpu
in
${
use_gpu_list
[*]
}
;
do
if
[
${
use_gpu
}
=
"False"
]
;
then
if
[
${
use_gpu
}
=
"False"
]
||
[
${
use_gpu
}
=
"cpu"
]
;
then
for
use_mkldnn
in
${
use_mkldnn_list
[*]
}
;
do
if
[
${
use_mkldnn
}
=
"False"
]
&&
[
${
_flag_quant
}
=
"True"
]
;
then
continue
...
...
@@ -149,7 +150,7 @@ function func_inference(){
done
done
done
el
se
el
if
[
${
use_gpu
}
=
"True"
]
||
[
${
use_gpu
}
=
"gpu"
]
;
then
for
use_trt
in
${
use_trt_list
[*]
}
;
do
for
precision
in
${
precision_list
[*]
}
;
do
if
[
${
use_trt
}
=
"False"
]
&&
[
${
precision
}
!=
"fp32"
]
;
then
...
...
@@ -171,6 +172,8 @@ function func_inference(){
done
done
done
else
echo
"Currently does not support hardware other than CPU and GPU"
fi
done
}
...
...
@@ -178,10 +181,12 @@ function func_inference(){
if
[
${
MODE
}
!=
"infer"
]
;
then
IFS
=
"|"
export
Count
=
0
USE_GPU_KEY
=(
${
train_use_gpu_value
}
)
for
gpu
in
${
gpu_list
[*]
}
;
do
use_gpu
=
True
use_gpu
=
${
USE_GPU_KEY
[Count]
}
Count
=
$((
$Count
+
1
))
if
[
${
gpu
}
=
"-1"
]
;
then
use_gpu
=
False
env
=
""
elif
[
${#
gpu
}
-le
1
]
;
then
env
=
"export CUDA_VISIBLE_DEVICES=
${
gpu
}
"
...
...
@@ -232,10 +237,11 @@ for gpu in ${gpu_list[*]}; do
set_pretrain
=
$(
func_set_params
"
${
pretrain_model_key
}
"
"
${
pretrain_model_value
}
"
)
set_batchsize
=
$(
func_set_params
"
${
train_batch_key
}
"
"
${
train_batch_value
}
"
)
set_train_params1
=
$(
func_set_params
"
${
train_param_key1
}
"
"
${
train_param_value1
}
"
)
set_use_gpu
=
$(
func_set_params
"
${
train_use_gpu_key
}
"
"
${
use_gpu
}
"
)
save_log
=
"
${
LOG_PATH
}
/
${
trainer
}
_gpus_
${
gpu
}
_autocast_
${
autocast
}
"
if
[
${#
gpu
}
-le
2
]
;
then
# train with cpu or single gpu
cmd
=
"
${
python
}
${
run_train
}
${
train_use_gpu_key
}
=
${
use_gpu
}
${
save_model_key
}
=
${
save_log
}
${
set_epoch
}
${
set_pretrain
}
${
set_autocast
}
${
set_batchsize
}
${
set_train_params1
}
"
cmd
=
"
${
python
}
${
run_train
}
${
set_
use_gpu
}
${
save_model_key
}
=
${
save_log
}
${
set_epoch
}
${
set_pretrain
}
${
set_autocast
}
${
set_batchsize
}
${
set_train_params1
}
"
elif
[
${#
gpu
}
-le
15
]
;
then
# train with multi-gpu
cmd
=
"
${
python
}
-m paddle.distributed.launch --gpus=
${
gpu
}
${
run_train
}
${
save_model_key
}
=
${
save_log
}
${
set_epoch
}
${
set_pretrain
}
${
set_autocast
}
${
set_batchsize
}
${
set_train_params1
}
"
else
# train with multi-machine
...
...
@@ -247,7 +253,7 @@ for gpu in ${gpu_list[*]}; do
# run eval
if
[
${
eval_py
}
!=
"null"
]
;
then
eval_cmd
=
"
${
python
}
${
eval_py
}
${
save_model_key
}
=
${
save_log
}
${
pretrain_model_key
}
=
${
save_log
}
/
${
train_model_name
}
"
eval_cmd
=
"
${
python
}
${
eval_py
}
${
save_model_key
}
=
${
save_log
}
${
pretrain_model_key
}
=
${
save_log
}
/
${
train_model_name
}
${
set_use_gpu
}
"
eval
$eval_cmd
status_check
$?
"
${
eval_cmd
}
"
"
${
status_log
}
"
fi
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录