Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleOCR
提交
aaeed8d4
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看板
提交
aaeed8d4
编写于
9月 19, 2022
作者:
L
LDOUBLEV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
delete shape_info_name
上级
a678faf7
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
16 addition
and
14 deletion
+16
-14
tools/infer/utility.py
tools/infer/utility.py
+16
-14
未找到文件。
tools/infer/utility.py
浏览文件 @
aaeed8d4
...
@@ -38,7 +38,6 @@ def init_args():
...
@@ -38,7 +38,6 @@ def init_args():
parser
.
add_argument
(
"--ir_optim"
,
type
=
str2bool
,
default
=
True
)
parser
.
add_argument
(
"--ir_optim"
,
type
=
str2bool
,
default
=
True
)
parser
.
add_argument
(
"--use_tensorrt"
,
type
=
str2bool
,
default
=
False
)
parser
.
add_argument
(
"--use_tensorrt"
,
type
=
str2bool
,
default
=
False
)
parser
.
add_argument
(
"--min_subgraph_size"
,
type
=
int
,
default
=
15
)
parser
.
add_argument
(
"--min_subgraph_size"
,
type
=
int
,
default
=
15
)
parser
.
add_argument
(
"--shape_info_filename"
,
type
=
str
,
default
=
None
)
parser
.
add_argument
(
"--precision"
,
type
=
str
,
default
=
"fp32"
)
parser
.
add_argument
(
"--precision"
,
type
=
str
,
default
=
"fp32"
)
parser
.
add_argument
(
"--gpu_mem"
,
type
=
int
,
default
=
500
)
parser
.
add_argument
(
"--gpu_mem"
,
type
=
int
,
default
=
500
)
...
@@ -226,22 +225,25 @@ def create_predictor(args, mode, logger):
...
@@ -226,22 +225,25 @@ def create_predictor(args, mode, logger):
use_calib_mode
=
False
)
use_calib_mode
=
False
)
# collect shape
# collect shape
trt_shape_f
=
f
"
{
os
.
path
.
dirname
(
args
.
shape_info_filename
)
}
/
{
mode
}
_
{
os
.
path
.
basename
(
args
.
shape_info_filename
)
}
"
model_name
=
os
.
path
.
basename
(
if
trt_shape_f
is
not
None
:
model_dir
[:
-
1
])
if
model_dir
.
endswith
(
"/"
)
else
os
.
path
.
basename
(
model_dir
)
trt_shape_f
=
f
"
{
mode
}
_
{
model_name
}
.txt"
if
not
os
.
path
.
exists
(
trt_shape_f
):
if
not
os
.
path
.
exists
(
trt_shape_f
):
config
.
collect_shape_range_info
(
trt_shape_f
)
config
.
collect_shape_range_info
(
trt_shape_f
)
logger
.
info
(
logger
.
info
(
f
"collect dynamic shape info into :
{
trt_shape_f
}
"
f
"collect dynamic shape info into :
{
trt_shape_f
}
"
)
)
else
:
else
:
logger
.
info
(
logger
.
info
(
f
"dynamic shape info file(
{
trt_shape_f
}
) already exists, not need to generate again."
f
"dynamic shape info file(
{
trt_shape_f
}
) already exists, not need to generate again."
)
)
config
.
enable_tuned_tensorrt_dynamic_shape
(
trt_shape_f
,
True
)
try
:
else
:
config
.
enable_tuned_tensorrt_dynamic_shape
(
trt_shape_f
,
logger
.
info
(
True
)
f
"when using tensorrt, dynamic shape is a suggested option, you can use '--shape_info_filename=shape.txt' for offline dygnamic shape tuning"
except
Exception
as
E
:
)
logger
.
info
(
E
)
logger
.
info
(
"Please keep your paddlepaddle-gpu >= 2.3.0!"
)
elif
args
.
use_xpu
:
elif
args
.
use_xpu
:
config
.
enable_xpu
(
10
*
1024
*
1024
)
config
.
enable_xpu
(
10
*
1024
*
1024
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录