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
52c9f16e
Commit
52c9f16e
authored
Sep 17, 2021
by
MissPenguin
Browse files
add result comparison for det cpp_infer
parent
988afe1a
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
120 additions
and
5 deletions
+120
-5
deploy/cpp_infer/src/main.cpp
deploy/cpp_infer/src/main.cpp
+11
-1
tests/compare_results.py
tests/compare_results.py
+9
-4
tests/results/det_results_gpu_trt_fp16_cpp.txt
tests/results/det_results_gpu_trt_fp16_cpp.txt
+50
-0
tests/results/det_results_gpu_trt_fp32_cpp.txt
tests/results/det_results_gpu_trt_fp32_cpp.txt
+50
-0
No files found.
deploy/cpp_infer/src/main.cpp
View file @
52c9f16e
...
@@ -91,7 +91,7 @@ int main_det(std::vector<cv::String> cv_all_img_names) {
...
@@ -91,7 +91,7 @@ int main_det(std::vector<cv::String> cv_all_img_names) {
FLAGS_use_tensorrt
,
FLAGS_precision
);
FLAGS_use_tensorrt
,
FLAGS_precision
);
for
(
int
i
=
0
;
i
<
cv_all_img_names
.
size
();
++
i
)
{
for
(
int
i
=
0
;
i
<
cv_all_img_names
.
size
();
++
i
)
{
LOG
(
INFO
)
<<
"The predict img: "
<<
cv_all_img_names
[
i
];
//
LOG(INFO) << "The predict img: " << cv_all_img_names[i];
cv
::
Mat
srcimg
=
cv
::
imread
(
cv_all_img_names
[
i
],
cv
::
IMREAD_COLOR
);
cv
::
Mat
srcimg
=
cv
::
imread
(
cv_all_img_names
[
i
],
cv
::
IMREAD_COLOR
);
if
(
!
srcimg
.
data
)
{
if
(
!
srcimg
.
data
)
{
...
@@ -106,6 +106,16 @@ int main_det(std::vector<cv::String> cv_all_img_names) {
...
@@ -106,6 +106,16 @@ int main_det(std::vector<cv::String> cv_all_img_names) {
time_info
[
0
]
+=
det_times
[
0
];
time_info
[
0
]
+=
det_times
[
0
];
time_info
[
1
]
+=
det_times
[
1
];
time_info
[
1
]
+=
det_times
[
1
];
time_info
[
2
]
+=
det_times
[
2
];
time_info
[
2
]
+=
det_times
[
2
];
if
(
FLAGS_benchmark
)
{
cout
<<
cv_all_img_names
[
i
]
<<
'\t'
;
for
(
int
n
=
0
;
n
<
boxes
.
size
();
n
++
)
{
for
(
int
m
=
0
;
m
<
boxes
[
n
].
size
();
m
++
)
{
cout
<<
boxes
[
n
][
m
][
0
]
<<
' '
<<
boxes
[
n
][
m
][
1
]
<<
' '
;
}
}
cout
<<
endl
;
}
}
}
if
(
FLAGS_benchmark
)
{
if
(
FLAGS_benchmark
)
{
...
...
tests/compare_results.py
View file @
52c9f16e
...
@@ -32,7 +32,6 @@ def run_shell_command(cmd):
...
@@ -32,7 +32,6 @@ def run_shell_command(cmd):
else
:
else
:
return
None
return
None
def
parser_results_from_log_by_name
(
log_path
,
names_list
):
def
parser_results_from_log_by_name
(
log_path
,
names_list
):
if
not
os
.
path
.
exists
(
log_path
):
if
not
os
.
path
.
exists
(
log_path
):
raise
ValueError
(
"The log file {} does not exists!"
.
format
(
log_path
))
raise
ValueError
(
"The log file {} does not exists!"
.
format
(
log_path
))
...
@@ -46,11 +45,13 @@ def parser_results_from_log_by_name(log_path, names_list):
...
@@ -46,11 +45,13 @@ def parser_results_from_log_by_name(log_path, names_list):
outs
=
run_shell_command
(
cmd
)
outs
=
run_shell_command
(
cmd
)
outs
=
outs
.
split
(
"
\n
"
)[
0
]
outs
=
outs
.
split
(
"
\n
"
)[
0
]
result
=
outs
.
split
(
"{}"
.
format
(
name
))[
-
1
]
result
=
outs
.
split
(
"{}"
.
format
(
name
))[
-
1
]
result
=
json
.
loads
(
result
)
try
:
result
=
json
.
loads
(
result
)
except
:
result
=
np
.
array
([
int
(
r
)
for
r
in
result
.
split
()]).
reshape
(
-
1
,
4
)
parser_results
[
name
]
=
result
parser_results
[
name
]
=
result
return
parser_results
return
parser_results
def
load_gt_from_file
(
gt_file
):
def
load_gt_from_file
(
gt_file
):
if
not
os
.
path
.
exists
(
gt_file
):
if
not
os
.
path
.
exists
(
gt_file
):
raise
ValueError
(
"The log file {} does not exists!"
.
format
(
gt_file
))
raise
ValueError
(
"The log file {} does not exists!"
.
format
(
gt_file
))
...
@@ -60,7 +61,11 @@ def load_gt_from_file(gt_file):
...
@@ -60,7 +61,11 @@ def load_gt_from_file(gt_file):
parser_gt
=
{}
parser_gt
=
{}
for
line
in
data
:
for
line
in
data
:
image_name
,
result
=
line
.
strip
(
"
\n
"
).
split
(
"
\t
"
)
image_name
,
result
=
line
.
strip
(
"
\n
"
).
split
(
"
\t
"
)
result
=
json
.
loads
(
result
)
image_name
=
image_name
.
split
(
'/'
)[
-
1
]
try
:
result
=
json
.
loads
(
result
)
except
:
result
=
np
.
array
([
int
(
r
)
for
r
in
result
.
split
()]).
reshape
(
-
1
,
4
)
parser_gt
[
image_name
]
=
result
parser_gt
[
image_name
]
=
result
return
parser_gt
return
parser_gt
...
...
tests/results/det_results_gpu_trt_fp16_cpp.txt
0 → 100644
View file @
52c9f16e
This diff is collapsed.
Click to expand it.
tests/results/det_results_gpu_trt_fp32_cpp.txt
0 → 100644
View file @
52c9f16e
This diff is collapsed.
Click to expand it.
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