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
gaoqiong
MIGraphX
Commits
467617bc
Commit
467617bc
authored
Jun 23, 2022
by
charlie
Browse files
Review changes
parent
d6a2cfb5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
src/include/migraphx/op/nonmaxsuppression.hpp
src/include/migraphx/op/nonmaxsuppression.hpp
+11
-3
No files found.
src/include/migraphx/op/nonmaxsuppression.hpp
View file @
467617bc
...
@@ -39,7 +39,15 @@ struct nonmaxsuppression
...
@@ -39,7 +39,15 @@ struct nonmaxsuppression
// check input shape
// check input shape
if
(
lens
[
1
]
!=
inputs
.
at
(
1
).
lens
()[
2
])
if
(
lens
[
1
]
!=
inputs
.
at
(
1
).
lens
()[
2
])
{
{
MIGRAPHX_THROW
(
"NonMaxSuppression: dimension mismatch between first and second input!"
);
MIGRAPHX_THROW
(
"NonMaxSuppression: spatial dimension mismatch between boxes and scores input"
);
}
// check batch sizes
if
(
lens
[
0
]
!=
inputs
.
at
(
1
).
lens
()[
0
])
{
MIGRAPHX_THROW
(
"NonMaxSuppression: number of batches mismatch between boxes and scores input"
);
}
}
std
::
vector
<
int64_t
>
out_lens
(
2
);
std
::
vector
<
int64_t
>
out_lens
(
2
);
...
@@ -134,7 +142,7 @@ struct nonmaxsuppression
...
@@ -134,7 +142,7 @@ struct nonmaxsuppression
{
{
std
::
priority_queue
<
std
::
pair
<
float
,
int64_t
>>
boxes_heap
;
std
::
priority_queue
<
std
::
pair
<
float
,
int64_t
>>
boxes_heap
;
auto
insert_to_boxes_heap
=
auto
insert_to_boxes_heap
=
make_function_output_iterator
([
&
boxes_heap
](
const
auto
&
x
)
{
boxes_heap
.
push
(
x
);
});
make_function_output_iterator
([
&
](
const
auto
&
x
)
{
boxes_heap
.
push
(
x
);
});
int64_t
box_idx
=
0
;
int64_t
box_idx
=
0
;
transform_if
(
transform_if
(
scores
.
begin
()
+
score_offset_ind
,
scores
.
begin
()
+
score_offset_ind
,
...
@@ -167,7 +175,7 @@ struct nonmaxsuppression
...
@@ -167,7 +175,7 @@ struct nonmaxsuppression
const
auto
&
lens
=
scores
.
get_shape
().
lens
();
const
auto
&
lens
=
scores
.
get_shape
().
lens
();
const
auto
num_batches
=
lens
[
0
];
const
auto
num_batches
=
lens
[
0
];
const
auto
num_classes
=
lens
[
1
];
const
auto
num_classes
=
lens
[
1
];
const
auto
num_boxes
=
boxes
.
get_shape
().
lens
()[
1
];
const
auto
num_boxes
=
lens
[
2
];
// boxes of a class with NMS applied [score, index]
// boxes of a class with NMS applied [score, index]
std
::
vector
<
std
::
pair
<
float
,
int64_t
>>
selected_boxes_inside_class
;
std
::
vector
<
std
::
pair
<
float
,
int64_t
>>
selected_boxes_inside_class
;
std
::
vector
<
int64_t
>
selected_indices
;
std
::
vector
<
int64_t
>
selected_indices
;
...
...
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