Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_41840029
PaddleOCR
提交
1b07e429
P
PaddleOCR
项目概览
weixin_41840029
/
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看板
提交
1b07e429
编写于
9月 16, 2022
作者:
L
LDOUBLEV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix trt
上级
31a84a33
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
22 addition
and
15 deletion
+22
-15
deploy/cpp_infer/src/ocr_cls.cpp
deploy/cpp_infer/src/ocr_cls.cpp
+5
-2
deploy/cpp_infer/src/ocr_det.cpp
deploy/cpp_infer/src/ocr_det.cpp
+5
-2
deploy/cpp_infer/src/ocr_rec.cpp
deploy/cpp_infer/src/ocr_rec.cpp
+5
-3
tools/infer/utility.py
tools/infer/utility.py
+7
-8
未找到文件。
deploy/cpp_infer/src/ocr_cls.cpp
浏览文件 @
1b07e429
...
...
@@ -112,8 +112,11 @@ void Classifier::LoadModel(const std::string &model_dir) {
precision
=
paddle_infer
::
Config
::
Precision
::
kInt8
;
}
config
.
EnableTensorRtEngine
(
1
<<
20
,
10
,
3
,
precision
,
false
,
false
);
config
.
CollectShapeRangeInfo
(
"./trt_shape.txt"
);
config
.
EnableTunedTensorRtDynamicShape
(
"./trt_shape.txt"
,
true
);
if
(
!
Utility
::
PathExists
(
"./trt_cls_shape.txt"
)){
config
.
CollectShapeRangeInfo
(
"./trt_cls_shape.txt"
);
}
else
{
config
.
EnableTunedTensorRtDynamicShape
(
"./trt_cls_shape.txt"
,
true
);
}
}
}
else
{
config
.
DisableGpu
();
...
...
deploy/cpp_infer/src/ocr_det.cpp
浏览文件 @
1b07e429
...
...
@@ -33,8 +33,11 @@ void DBDetector::LoadModel(const std::string &model_dir) {
precision
=
paddle_infer
::
Config
::
Precision
::
kInt8
;
}
config
.
EnableTensorRtEngine
(
1
<<
30
,
1
,
20
,
precision
,
false
,
false
);
config
.
CollectShapeRangeInfo
(
"./trt_shape.txt"
);
config
.
EnableTunedTensorRtDynamicShape
(
"./trt_shape.txt"
,
true
);
if
(
!
Utility
::
PathExists
(
"./trt_det_shape.txt"
)){
config
.
CollectShapeRangeInfo
(
"./trt_det_shape.txt"
);
}
else
{
config
.
EnableTunedTensorRtDynamicShape
(
"./trt_det_shape.txt"
,
true
);
}
}
}
else
{
...
...
deploy/cpp_infer/src/ocr_rec.cpp
浏览文件 @
1b07e429
...
...
@@ -147,9 +147,11 @@ void CRNNRecognizer::LoadModel(const std::string &model_dir) {
if
(
this
->
precision_
==
"int8"
)
{
precision
=
paddle_infer
::
Config
::
Precision
::
kInt8
;
}
config
.
EnableTensorRtEngine
(
1
<<
20
,
10
,
15
,
precision
,
false
,
false
);
config
.
CollectShapeRangeInfo
(
"./trt_shape.txt"
);
config
.
EnableTunedTensorRtDynamicShape
(
"./trt_shape.txt"
,
true
);
if
(
!
Utility
::
PathExists
(
"./trt_rec_shape.txt"
)){
config
.
CollectShapeRangeInfo
(
"./trt_rec_shape.txt"
);
}
else
{
config
.
EnableTunedTensorRtDynamicShape
(
"./trt_rec_shape.txt"
,
true
);
}
}
}
else
{
...
...
tools/infer/utility.py
浏览文件 @
1b07e429
...
...
@@ -228,19 +228,18 @@ def create_predictor(args, mode, logger):
use_calib_mode
=
False
)
# collect shape
if
args
.
shape_info_filename
is
not
None
:
if
not
os
.
path
.
exists
(
args
.
shape_info_filename
)
:
config
.
collect_shape_range_info
(
args
.
shape_info_filename
)
trt_shape_f
=
f
"
{
os
.
path
.
dirname
(
args
.
shape_info_filename
)
}
/
{
mode
}
_
{
os
.
path
.
basename
(
args
.
shape_info_filename
)
}
"
if
trt_shape_f
is
not
None
:
if
not
os
.
path
.
exists
(
trt_shape_f
):
config
.
collect_shape_range_info
(
trt_shape_f
)
logger
.
info
(
f
"collect dynamic shape info into :
{
args
.
shape_info_filename
}
"
f
"collect dynamic shape info into :
{
trt_shape_f
}
"
)
else
:
logger
.
info
(
f
"dynamic shape info file(
{
args
.
shape_info_filename
}
) 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
(
args
.
shape_info_filename
,
True
)
config
.
enable_tuned_tensorrt_dynamic_shape
(
trt_shape_f
,
True
)
else
:
logger
.
info
(
f
"when using tensorrt, dynamic shape is a suggested option, you can use '--shape_info_filename=shape.txt' for offline dygnamic shape tuning"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录