Fix proposal_exec
in ref impl (#9569)
ROI indices and ROI counter aren't cleaned up, so it led to segfault
This commit is contained in:
parent
5bf44b92e1
commit
c1d7535044
@ -181,7 +181,6 @@ static void enumerate_proposals(const T* bottom4d,
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static void nms(const int num_boxes,
|
static void nms(const int num_boxes,
|
||||||
std::vector<int>& is_dead,
|
|
||||||
const std::vector<ProposalBox<T>>& proposals,
|
const std::vector<ProposalBox<T>>& proposals,
|
||||||
std::vector<unsigned int>& index_out,
|
std::vector<unsigned int>& index_out,
|
||||||
int& num_out,
|
int& num_out,
|
||||||
@ -189,7 +188,7 @@ static void nms(const int num_boxes,
|
|||||||
const float nms_thresh,
|
const float nms_thresh,
|
||||||
const int max_num_out,
|
const int max_num_out,
|
||||||
T coordinates_offset) {
|
T coordinates_offset) {
|
||||||
std::fill(is_dead.begin(), is_dead.begin() + num_boxes, 0);
|
std::vector<int> is_dead(num_boxes, 0);
|
||||||
for (int box = 0; box < num_boxes; ++box) {
|
for (int box = 0; box < num_boxes; ++box) {
|
||||||
if (is_dead[box])
|
if (is_dead[box])
|
||||||
continue;
|
continue;
|
||||||
@ -348,7 +347,6 @@ static void proposal_exec(const T* class_probs,
|
|||||||
int num_rois = 0;
|
int num_rois = 0;
|
||||||
std::vector<ProposalBox<T>> proposals(num_proposals);
|
std::vector<ProposalBox<T>> proposals(num_proposals);
|
||||||
const int pre_nms_topn = num_proposals < attrs.pre_nms_topn ? num_proposals : attrs.pre_nms_topn;
|
const int pre_nms_topn = num_proposals < attrs.pre_nms_topn ? num_proposals : attrs.pre_nms_topn;
|
||||||
std::vector<int> is_dead(pre_nms_topn);
|
|
||||||
std::vector<unsigned int> roi_indices(attrs.post_nms_topn);
|
std::vector<unsigned int> roi_indices(attrs.post_nms_topn);
|
||||||
|
|
||||||
std::vector<float> anchors = generate_anchors(attrs, anchor_count);
|
std::vector<float> anchors = generate_anchors(attrs, anchor_count);
|
||||||
@ -359,6 +357,9 @@ static void proposal_exec(const T* class_probs,
|
|||||||
bool swap_xy = attrs.framework == "tensorflow";
|
bool swap_xy = attrs.framework == "tensorflow";
|
||||||
|
|
||||||
for (unsigned int batch_idx = 0; batch_idx < batch_num; ++batch_idx) {
|
for (unsigned int batch_idx = 0; batch_idx < batch_num; ++batch_idx) {
|
||||||
|
std::fill(roi_indices.begin(), roi_indices.end(), 0);
|
||||||
|
num_rois = 0;
|
||||||
|
|
||||||
enumerate_proposals(p_bottom_item + num_proposals + batch_idx * num_proposals * 2,
|
enumerate_proposals(p_bottom_item + num_proposals + batch_idx * num_proposals * 2,
|
||||||
p_d_anchor_item + batch_idx * num_proposals * 4,
|
p_d_anchor_item + batch_idx * num_proposals * 4,
|
||||||
anchors.data(),
|
anchors.data(),
|
||||||
@ -385,7 +386,6 @@ static void proposal_exec(const T* class_probs,
|
|||||||
return (box1.score > box2.score);
|
return (box1.score > box2.score);
|
||||||
});
|
});
|
||||||
nms(pre_nms_topn,
|
nms(pre_nms_topn,
|
||||||
is_dead,
|
|
||||||
proposals,
|
proposals,
|
||||||
roi_indices,
|
roi_indices,
|
||||||
num_rois,
|
num_rois,
|
||||||
|
@ -144,8 +144,6 @@ std::vector<std::string> disabledTestPatterns() {
|
|||||||
*IS=_TS=\(\(4\.5\.6\.7\)\)_RS=\(\(1\.1\.6\.1\)\)_\(\(1\.5\.6\.1\)\)_\(\(1\.1\.1\.1\)\)_\(\(1\.1\.6\.1\)\).*)",
|
*IS=_TS=\(\(4\.5\.6\.7\)\)_RS=\(\(1\.1\.6\.1\)\)_\(\(1\.5\.6\.1\)\)_\(\(1\.1\.1\.1\)\)_\(\(1\.1\.6\.1\)\).*)",
|
||||||
// Issue: 69222
|
// Issue: 69222
|
||||||
R"(.*smoke_PriorBoxClustered.*PriorBoxClusteredLayerCPUTest.*_netPRC=f16_.*)",
|
R"(.*smoke_PriorBoxClustered.*PriorBoxClusteredLayerCPUTest.*_netPRC=f16_.*)",
|
||||||
// Issue: 71121
|
|
||||||
R"(.*smoke_Proposal*.*TS=\(2.*)",
|
|
||||||
// TODO : CVS-69533
|
// TODO : CVS-69533
|
||||||
R"(.*ConvolutionLayerCPUTest.*IS=\{.+\}.*_Fused=.*Add\(Parameters\).*)",
|
R"(.*ConvolutionLayerCPUTest.*IS=\{.+\}.*_Fused=.*Add\(Parameters\).*)",
|
||||||
R"(.*GroupConvolutionLayerCPUTest.*IS=\{.+\}.*_Fused=.*Add\(Parameters\).*)",
|
R"(.*GroupConvolutionLayerCPUTest.*IS=\{.+\}.*_Fused=.*Add\(Parameters\).*)",
|
||||||
|
Loading…
Reference in New Issue
Block a user