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
64a3580f
Unverified
Commit
64a3580f
authored
Apr 27, 2021
by
MissPenguin
Committed by
GitHub
Apr 27, 2021
Browse files
Modify the resize operation to be consistent with the python version (#2651)
parent
796aea86
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
13 deletions
+7
-13
deploy/cpp_infer/src/preprocess_op.cpp
deploy/cpp_infer/src/preprocess_op.cpp
+3
-12
tools/infer/predict_det.py
tools/infer/predict_det.py
+4
-1
No files found.
deploy/cpp_infer/src/preprocess_op.cpp
100644 → 100755
View file @
64a3580f
...
@@ -77,19 +77,10 @@ void ResizeImgType0::Run(const cv::Mat &img, cv::Mat &resize_img,
...
@@ -77,19 +77,10 @@ void ResizeImgType0::Run(const cv::Mat &img, cv::Mat &resize_img,
int
resize_h
=
int
(
float
(
h
)
*
ratio
);
int
resize_h
=
int
(
float
(
h
)
*
ratio
);
int
resize_w
=
int
(
float
(
w
)
*
ratio
);
int
resize_w
=
int
(
float
(
w
)
*
ratio
);
if
(
resize_h
%
32
==
0
)
resize_h
=
resize_h
;
resize_h
=
max
(
int
(
round
(
float
(
resize_h
)
/
32
)
*
32
),
32
);
else
if
(
resize_h
/
32
<
1
+
1e-5
)
resize_w
=
max
(
int
(
round
(
float
(
resize_w
)
/
32
)
*
32
),
32
);
resize_h
=
32
;
else
resize_h
=
(
resize_h
/
32
)
*
32
;
if
(
resize_w
%
32
==
0
)
resize_w
=
resize_w
;
else
if
(
resize_w
/
32
<
1
+
1e-5
)
resize_w
=
32
;
else
resize_w
=
(
resize_w
/
32
)
*
32
;
if
(
!
use_tensorrt
)
{
if
(
!
use_tensorrt
)
{
cv
::
resize
(
img
,
resize_img
,
cv
::
Size
(
resize_w
,
resize_h
));
cv
::
resize
(
img
,
resize_img
,
cv
::
Size
(
resize_w
,
resize_h
));
ratio_h
=
float
(
resize_h
)
/
float
(
h
);
ratio_h
=
float
(
resize_h
)
/
float
(
h
);
...
...
tools/infer/predict_det.py
View file @
64a3580f
...
@@ -39,7 +39,10 @@ class TextDetector(object):
...
@@ -39,7 +39,10 @@ class TextDetector(object):
self
.
args
=
args
self
.
args
=
args
self
.
det_algorithm
=
args
.
det_algorithm
self
.
det_algorithm
=
args
.
det_algorithm
pre_process_list
=
[{
pre_process_list
=
[{
'DetResizeForTest'
:
None
'DetResizeForTest'
:
{
'limit_side_len'
:
args
.
det_limit_side_len
,
'limit_type'
:
args
.
det_limit_type
}
},
{
},
{
'NormalizeImage'
:
{
'NormalizeImage'
:
{
'std'
:
[
0.229
,
0.224
,
0.225
],
'std'
:
[
0.229
,
0.224
,
0.225
],
...
...
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