Skip to content

Commit b29be44

Browse files
Merge pull request #2017 from oyel/dev-1.x
2 parents 9a03b56 + a64c6a5 commit b29be44

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

mmdet3d/models/task_modules/samplers/iou_neg_piecewise_sampler.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Copyright (c) OpenMMLab. All rights reserved.
2+
import math
3+
24
import torch
35

46
from mmdet3d.registry import TASK_UTILS
@@ -74,9 +76,11 @@ def _sample_neg(self, assign_result, num_expected, **kwargs):
7476
# if the numbers of negative samplers in previous
7577
# pieces are less than the expected number, extend
7678
# the same number in the current piece.
77-
piece_expected_num = int(
78-
num_expected *
79-
self.neg_piece_fractions[piece_inds]) + extend_num
79+
piece_expected_num = min(
80+
num_expected,
81+
math.ceil(num_expected *
82+
self.neg_piece_fractions[piece_inds]) +
83+
extend_num)
8084
min_iou_thr = self.neg_iou_thr[piece_inds + 1]
8185
max_iou_thr = self.neg_iou_thr[piece_inds]
8286
piece_neg_inds = torch.nonzero(

0 commit comments

Comments
 (0)