Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_41840029
PaddleOCR
提交
31a84a33
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看板
提交
31a84a33
编写于
9月 16, 2022
作者:
L
LDOUBLEV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support dynamic trt
上级
50e3bacd
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
9 addition
and
56 deletion
+9
-56
deploy/cpp_infer/src/ocr_cls.cpp
deploy/cpp_infer/src/ocr_cls.cpp
+2
-0
deploy/cpp_infer/src/ocr_det.cpp
deploy/cpp_infer/src/ocr_det.cpp
+4
-43
deploy/cpp_infer/src/ocr_rec.cpp
deploy/cpp_infer/src/ocr_rec.cpp
+3
-13
未找到文件。
deploy/cpp_infer/src/ocr_cls.cpp
浏览文件 @
31a84a33
...
...
@@ -112,6 +112,8 @@ 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
);
}
}
else
{
config
.
DisableGpu
();
...
...
deploy/cpp_infer/src/ocr_det.cpp
浏览文件 @
31a84a33
...
...
@@ -32,49 +32,10 @@ void DBDetector::LoadModel(const std::string &model_dir) {
if
(
this
->
precision_
==
"int8"
)
{
precision
=
paddle_infer
::
Config
::
Precision
::
kInt8
;
}
config
.
EnableTensorRtEngine
(
1
<<
20
,
1
,
20
,
precision
,
false
,
false
);
std
::
map
<
std
::
string
,
std
::
vector
<
int
>>
min_input_shape
=
{
{
"x"
,
{
1
,
3
,
50
,
50
}},
{
"conv2d_92.tmp_0"
,
{
1
,
120
,
20
,
20
}},
{
"conv2d_91.tmp_0"
,
{
1
,
24
,
10
,
10
}},
{
"conv2d_59.tmp_0"
,
{
1
,
96
,
20
,
20
}},
{
"nearest_interp_v2_1.tmp_0"
,
{
1
,
256
,
10
,
10
}},
{
"nearest_interp_v2_2.tmp_0"
,
{
1
,
256
,
20
,
20
}},
{
"conv2d_124.tmp_0"
,
{
1
,
256
,
20
,
20
}},
{
"nearest_interp_v2_3.tmp_0"
,
{
1
,
64
,
20
,
20
}},
{
"nearest_interp_v2_4.tmp_0"
,
{
1
,
64
,
20
,
20
}},
{
"nearest_interp_v2_5.tmp_0"
,
{
1
,
64
,
20
,
20
}},
{
"elementwise_add_7"
,
{
1
,
56
,
2
,
2
}},
{
"nearest_interp_v2_0.tmp_0"
,
{
1
,
256
,
2
,
2
}}};
std
::
map
<
std
::
string
,
std
::
vector
<
int
>>
max_input_shape
=
{
{
"x"
,
{
1
,
3
,
1536
,
1536
}},
{
"conv2d_92.tmp_0"
,
{
1
,
120
,
400
,
400
}},
{
"conv2d_91.tmp_0"
,
{
1
,
24
,
200
,
200
}},
{
"conv2d_59.tmp_0"
,
{
1
,
96
,
400
,
400
}},
{
"nearest_interp_v2_1.tmp_0"
,
{
1
,
256
,
200
,
200
}},
{
"nearest_interp_v2_2.tmp_0"
,
{
1
,
256
,
400
,
400
}},
{
"conv2d_124.tmp_0"
,
{
1
,
256
,
400
,
400
}},
{
"nearest_interp_v2_3.tmp_0"
,
{
1
,
64
,
400
,
400
}},
{
"nearest_interp_v2_4.tmp_0"
,
{
1
,
64
,
400
,
400
}},
{
"nearest_interp_v2_5.tmp_0"
,
{
1
,
64
,
400
,
400
}},
{
"elementwise_add_7"
,
{
1
,
56
,
400
,
400
}},
{
"nearest_interp_v2_0.tmp_0"
,
{
1
,
256
,
400
,
400
}}};
std
::
map
<
std
::
string
,
std
::
vector
<
int
>>
opt_input_shape
=
{
{
"x"
,
{
1
,
3
,
640
,
640
}},
{
"conv2d_92.tmp_0"
,
{
1
,
120
,
160
,
160
}},
{
"conv2d_91.tmp_0"
,
{
1
,
24
,
80
,
80
}},
{
"conv2d_59.tmp_0"
,
{
1
,
96
,
160
,
160
}},
{
"nearest_interp_v2_1.tmp_0"
,
{
1
,
256
,
80
,
80
}},
{
"nearest_interp_v2_2.tmp_0"
,
{
1
,
256
,
160
,
160
}},
{
"conv2d_124.tmp_0"
,
{
1
,
256
,
160
,
160
}},
{
"nearest_interp_v2_3.tmp_0"
,
{
1
,
64
,
160
,
160
}},
{
"nearest_interp_v2_4.tmp_0"
,
{
1
,
64
,
160
,
160
}},
{
"nearest_interp_v2_5.tmp_0"
,
{
1
,
64
,
160
,
160
}},
{
"elementwise_add_7"
,
{
1
,
56
,
40
,
40
}},
{
"nearest_interp_v2_0.tmp_0"
,
{
1
,
256
,
40
,
40
}}};
config
.
SetTRTDynamicShapeInfo
(
min_input_shape
,
max_input_shape
,
opt_input_shape
);
config
.
EnableTensorRtEngine
(
1
<<
30
,
1
,
20
,
precision
,
false
,
false
);
config
.
CollectShapeRangeInfo
(
"./trt_shape.txt"
);
config
.
EnableTunedTensorRtDynamicShape
(
"./trt_shape.txt"
,
true
);
}
}
else
{
config
.
DisableGpu
();
...
...
deploy/cpp_infer/src/ocr_rec.cpp
浏览文件 @
31a84a33
...
...
@@ -148,19 +148,9 @@ void CRNNRecognizer::LoadModel(const std::string &model_dir) {
precision
=
paddle_infer
::
Config
::
Precision
::
kInt8
;
}
config
.
EnableTensorRtEngine
(
1
<<
20
,
10
,
15
,
precision
,
false
,
false
);
int
imgH
=
this
->
rec_image_shape_
[
1
];
int
imgW
=
this
->
rec_image_shape_
[
2
];
std
::
map
<
std
::
string
,
std
::
vector
<
int
>>
min_input_shape
=
{
{
"x"
,
{
1
,
3
,
imgH
,
10
}},
{
"lstm_0.tmp_0"
,
{
10
,
1
,
96
}}};
std
::
map
<
std
::
string
,
std
::
vector
<
int
>>
max_input_shape
=
{
{
"x"
,
{
this
->
rec_batch_num_
,
3
,
imgH
,
2500
}},
{
"lstm_0.tmp_0"
,
{
1000
,
1
,
96
}}};
std
::
map
<
std
::
string
,
std
::
vector
<
int
>>
opt_input_shape
=
{
{
"x"
,
{
this
->
rec_batch_num_
,
3
,
imgH
,
imgW
}},
{
"lstm_0.tmp_0"
,
{
25
,
1
,
96
}}};
config
.
SetTRTDynamicShapeInfo
(
min_input_shape
,
max_input_shape
,
opt_input_shape
);
config
.
CollectShapeRangeInfo
(
"./trt_shape.txt"
);
config
.
EnableTunedTensorRtDynamicShape
(
"./trt_shape.txt"
,
true
);
}
}
else
{
config
.
DisableGpu
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录