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
390b87ae
"host/online_compilation/kernel.cpp.in" did not exist on "1685048a6725e531b577510295d2d62664c15962"
Commit
390b87ae
authored
Jun 24, 2022
by
charlie
Browse files
Formatting
parent
2c1cdd15
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
50 deletions
+56
-50
src/include/migraphx/op/nonmaxsuppression.hpp
src/include/migraphx/op/nonmaxsuppression.hpp
+56
-50
No files found.
src/include/migraphx/op/nonmaxsuppression.hpp
View file @
390b87ae
...
@@ -160,8 +160,8 @@ struct nonmaxsuppression
...
@@ -160,8 +160,8 @@ struct nonmaxsuppression
// filter boxes below score_threshold
// filter boxes below score_threshold
template
<
class
T
>
template
<
class
T
>
std
::
priority_queue
<
std
::
pair
<
double
,
int64_t
>>
filter_boxes_by_score
(
std
::
priority_queue
<
std
::
pair
<
double
,
int64_t
>>
T
scores_start
,
std
::
size_t
num_boxes
,
double
score_threshold
)
const
filter_boxes_by_score
(
T
scores_start
,
std
::
size_t
num_boxes
,
double
score_threshold
)
const
{
{
std
::
priority_queue
<
std
::
pair
<
double
,
int64_t
>>
boxes_heap
;
std
::
priority_queue
<
std
::
pair
<
double
,
int64_t
>>
boxes_heap
;
auto
insert_to_boxes_heap
=
auto
insert_to_boxes_heap
=
...
@@ -180,16 +180,14 @@ struct nonmaxsuppression
...
@@ -180,16 +180,14 @@ struct nonmaxsuppression
}
}
template
<
class
H
,
class
S
>
template
<
class
H
,
class
S
>
void
select_boxes
(
void
select_boxes
(
H
&
boxes_heap
,
H
&
boxes_heap
,
std
::
vector
<
std
::
pair
<
double
,
int64_t
>>&
selected_boxes_inside_class
,
std
::
vector
<
std
::
pair
<
double
,
int64_t
>>&
selected_boxes_inside_class
,
std
::
vector
<
int64_t
>&
selected_indices
,
std
::
vector
<
int64_t
>&
selected_indices
,
S
batch_boxes_start
,
S
batch_boxes_start
,
std
::
size_t
max_output_boxes_per_class
,
std
::
size_t
max_output_boxes_per_class
,
double
iou_threshold
,
double
iou_threshold
,
std
::
size_t
batch_idx
,
std
::
size_t
batch_idx
,
std
::
size_t
class_idx
std
::
size_t
class_idx
)
const
)
const
{
{
selected_boxes_inside_class
.
clear
();
selected_boxes_inside_class
.
clear
();
// Get the next box with top score, filter by iou_threshold
// Get the next box with top score, filter by iou_threshold
...
@@ -199,8 +197,8 @@ struct nonmaxsuppression
...
@@ -199,8 +197,8 @@ struct nonmaxsuppression
// Check with existing selected boxes for this class, remove box if it
// Check with existing selected boxes for this class, remove box if it
// exceeds the IOU (Intersection Over Union) threshold
// exceeds the IOU (Intersection Over Union) threshold
const
auto
next_top_score
=
boxes_heap
.
top
();
const
auto
next_top_score
=
boxes_heap
.
top
();
bool
not_selected
=
std
::
any_of
(
bool
not_selected
=
selected_boxes_inside_class
.
begin
(),
std
::
any_of
(
selected_boxes_inside_class
.
begin
(),
selected_boxes_inside_class
.
end
(),
selected_boxes_inside_class
.
end
(),
[
&
](
auto
selected_index
)
{
[
&
](
auto
selected_index
)
{
return
this
->
suppress_by_iou
(
return
this
->
suppress_by_iou
(
...
@@ -250,12 +248,20 @@ struct nonmaxsuppression
...
@@ -250,12 +248,20 @@ struct nonmaxsuppression
auto
batch_idx
=
idx
[
0
];
auto
batch_idx
=
idx
[
0
];
auto
class_idx
=
idx
[
1
];
auto
class_idx
=
idx
[
1
];
// index offset for this class
// index offset for this class
auto
scores_start
=
scores
.
begin
()
+
(
batch_idx
*
num_classes
+
class_idx
)
*
num_boxes
;
auto
scores_start
=
scores
.
begin
()
+
(
batch_idx
*
num_classes
+
class_idx
)
*
num_boxes
;
// iterator to first value of this batch
// iterator to first value of this batch
auto
batch_boxes_start
=
boxes
.
begin
()
+
batch_idx
*
num_boxes
*
4
;
auto
batch_boxes_start
=
boxes
.
begin
()
+
batch_idx
*
num_boxes
*
4
;
auto
boxes_heap
=
auto
boxes_heap
=
filter_boxes_by_score
(
scores_start
,
num_boxes
,
score_threshold
);
filter_boxes_by_score
(
scores_start
,
num_boxes
,
score_threshold
);
select_boxes
(
boxes_heap
,
selected_boxes_inside_class
,
selected_indices
,
batch_boxes_start
,
max_output_boxes_per_class
,
iou_threshold
,
batch_idx
,
class_idx
);
select_boxes
(
boxes_heap
,
selected_boxes_inside_class
,
selected_indices
,
batch_boxes_start
,
max_output_boxes_per_class
,
iou_threshold
,
batch_idx
,
class_idx
);
});
});
std
::
copy
(
selected_indices
.
begin
(),
selected_indices
.
end
(),
output
.
begin
());
std
::
copy
(
selected_indices
.
begin
(),
selected_indices
.
end
(),
output
.
begin
());
});
});
...
...
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