From 42e2569ecd5f6e12b60e20f1994b338747662efe Mon Sep 17 00:00:00 2001 From: mahxn0 <1262384588@qq.com> Date: Fri, 29 Nov 2024 11:50:02 +0800 Subject: [PATCH] [Fix](mluOpGenerateProposalsV2): fix 370 bug. --- .../generate_proposals_v2_union_default.mlu | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/kernels/generate_proposals_v2/generate_proposals_v2_union_default.mlu b/kernels/generate_proposals_v2/generate_proposals_v2_union_default.mlu index 6ea808a00..3469c81c8 100644 --- a/kernels/generate_proposals_v2/generate_proposals_v2_union_default.mlu +++ b/kernels/generate_proposals_v2/generate_proposals_v2_union_default.mlu @@ -655,7 +655,7 @@ __mlu_func__ void ProposalForOneImage( im_shape, anchors, variances, workspace_buffer, k_score, HWA, pre_nms_top_n, min_size, pixel_offset, need_top_k, &proposals_num); - rpn_rois_num[0] = 0; + int rpn_num = 0; if (proposals_num == 0) { rpn_rois_num[0] = 1; one_image_proposals_num[0] += rpn_rois_num[0]; @@ -665,10 +665,13 @@ __mlu_func__ void ProposalForOneImage( if (taskDim != 1) { __sync_all_ipu(); } - nonMaximumSuppress(rpn_rois, rpn_roi_probs, rpn_rois_num, proposal_scores, + nonMaximumSuppress(rpn_rois, rpn_roi_probs, &rpn_num, proposal_scores, proposal_boxes, workspace_buffer, nms_thresh, post_nms_top_n, proposals_num, pixel_offset, HWA); - one_image_proposals_num[0] += rpn_rois_num[0]; + if (taskId == 0) { + rpn_rois_num[0] = rpn_num; + one_image_proposals_num[0] += rpn_num; + } } template @@ -706,7 +709,9 @@ __mlu_global__ void mluOpGenerateProposalsV2Kernel( nms_thresh, min_size, pixel_offset, HWA); all_proposals_num += one_image_proposals_num; } - *rpn_rois_batch_size = all_proposals_num; + if (taskId == 0) { + *rpn_rois_batch_size = all_proposals_num; + } } mluOpStatus_t MLUOP_WIN_API KernelGenerateProposalsV2_Default(