Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
paddle_dbnet
Commits
8f838187
Commit
8f838187
authored
Dec 07, 2021
by
LDOUBLEV
Browse files
fix trt
parent
d4c4877e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
tools/infer/utility.py
tools/infer/utility.py
+6
-9
No files found.
tools/infer/utility.py
View file @
8f838187
...
@@ -195,7 +195,8 @@ def create_predictor(args, mode, logger):
...
@@ -195,7 +195,8 @@ def create_predictor(args, mode, logger):
max_batch_size
=
args
.
max_batch_size
,
max_batch_size
=
args
.
max_batch_size
,
min_subgraph_size
=
args
.
min_subgraph_size
)
min_subgraph_size
=
args
.
min_subgraph_size
)
# skip the minmum trt subgraph
# skip the minmum trt subgraph
if
mode
==
"det"
:
use_dynamic_shape
=
True
if
mode
==
"det"
and
args
.
rec_algorithm
==
"DB"
:
min_input_shape
=
{
min_input_shape
=
{
"x"
:
[
1
,
3
,
50
,
50
],
"x"
:
[
1
,
3
,
50
,
50
],
"conv2d_92.tmp_0"
:
[
1
,
120
,
20
,
20
],
"conv2d_92.tmp_0"
:
[
1
,
120
,
20
,
20
],
...
@@ -260,6 +261,8 @@ def create_predictor(args, mode, logger):
...
@@ -260,6 +261,8 @@ def create_predictor(args, mode, logger):
max_input_shape
.
update
(
max_pact_shape
)
max_input_shape
.
update
(
max_pact_shape
)
opt_input_shape
.
update
(
opt_pact_shape
)
opt_input_shape
.
update
(
opt_pact_shape
)
elif
mode
==
"rec"
:
elif
mode
==
"rec"
:
if
args
.
rec_algorithm
!=
"CRNN"
:
use_dynamic_shape
=
False
min_input_shape
=
{
"x"
:
[
1
,
3
,
32
,
10
]}
min_input_shape
=
{
"x"
:
[
1
,
3
,
32
,
10
]}
max_input_shape
=
{
"x"
:
[
args
.
rec_batch_num
,
3
,
32
,
1536
]}
max_input_shape
=
{
"x"
:
[
args
.
rec_batch_num
,
3
,
32
,
1536
]}
opt_input_shape
=
{
"x"
:
[
args
.
rec_batch_num
,
3
,
32
,
320
]}
opt_input_shape
=
{
"x"
:
[
args
.
rec_batch_num
,
3
,
32
,
320
]}
...
@@ -268,14 +271,8 @@ def create_predictor(args, mode, logger):
...
@@ -268,14 +271,8 @@ def create_predictor(args, mode, logger):
max_input_shape
=
{
"x"
:
[
args
.
rec_batch_num
,
3
,
48
,
1024
]}
max_input_shape
=
{
"x"
:
[
args
.
rec_batch_num
,
3
,
48
,
1024
]}
opt_input_shape
=
{
"x"
:
[
args
.
rec_batch_num
,
3
,
48
,
320
]}
opt_input_shape
=
{
"x"
:
[
args
.
rec_batch_num
,
3
,
48
,
320
]}
else
:
else
:
min_input_shape
=
{
"x"
:
[
1
,
3
,
10
,
10
]}
use_dynamic_shape
=
False
max_input_shape
=
{
"x"
:
[
1
,
3
,
512
,
512
]}
if
use_dynamic_shape
:
opt_input_shape
=
{
"x"
:
[
1
,
3
,
256
,
256
]}
if
mode
==
"rec"
:
if
args
.
rec_algorithm
==
"CRNN"
:
config
.
set_trt_dynamic_shape_info
(
min_input_shape
,
max_input_shape
,
opt_input_shape
)
else
:
config
.
set_trt_dynamic_shape_info
(
config
.
set_trt_dynamic_shape_info
(
min_input_shape
,
max_input_shape
,
opt_input_shape
)
min_input_shape
,
max_input_shape
,
opt_input_shape
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment