Skip to content

Commit

Permalink
disable proposal subsampling due to focal loss
Browse files Browse the repository at this point in the history
  • Loading branch information
jhultman committed Feb 22, 2020
1 parent 4bddc94 commit 08ea6d4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions pvrcnn/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
'center_z': -0.6,
},
]
_C.NUM_PROPOSAL_SAMPLE = 256
_C.NUM_PROPOSAL_SAMPLE = -1
_C.ALLOW_LOW_QUALITY_MATCHES = True
_C.NUM_CLASSES = len(_C.ANCHORS)
_C.NUM_YAW = 2
Expand Down Expand Up @@ -89,11 +89,11 @@

# Train
_C.TRAIN = CN()
_C.TRAIN.LR = 1e-4
_C.TRAIN.LR = 2.5e-3
_C.TRAIN.LAMBDA = 1.0
_C.TRAIN.EPOCHS = 100
_C.TRAIN.EPOCHS = 80
_C.TRAIN.BATCH_SIZE = 6
_C.TRAIN.PROPOSAL_NUM_NEGATIVES = 128
_C.TRAIN.REFINEMENT_NUM_NEGATIVES = 128

# Data augmentation
_C.AUG = CN()
Expand Down
4 changes: 3 additions & 1 deletion pvrcnn/core/proposal_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def compute_iou_matrix(self, boxes, anchors):

def resample_pos_neg(self, match_labels):
"""Tries to sample positives and negatives 50/50."""
if self.cfg.NUM_PROPOSAL_SAMPLE < 0:
return
match_labels = match_labels.view(-1)
pos_idx, neg_idx = subsample_labels(
match_labels, self.cfg.NUM_PROPOSAL_SAMPLE, 0.5, 0
Expand Down Expand Up @@ -64,7 +66,7 @@ def get_cls_targets(self, match_labels):
def get_reg_targets(self, boxes, matches, match_labels):
"""
Standard VoxelNet-style box encoding.
TODO: Angle binning.
TODO: Angle binning, angle periodicity.
"""
A = self.anchors[match_labels == 1]
G = boxes[matches[match_labels == 1]].cuda()
Expand Down
4 changes: 3 additions & 1 deletion pvrcnn/core/refinement_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ def batch_correspondence_mask(self, box_counts, device):
return mask

def fill_negatives(self, targets_cls):
(B, N, _), M = targets_cls.shape, self.cfg.TRAIN.PROPOSAL_NUM_NEGATIVES
"""TODO: REFINEMENT_NUM_NEGATIVES needs rethinking."""
M = self.cfg.TRAIN.REFINEMENT_NUM_NEGATIVES
(B, N, _) = targets_cls.shape
inds = torch.randint(N, (B, M), dtype=torch.long)
targets_cls[:, inds, -2] = 1
targets_cls[:, inds, -1] = 0
Expand Down

0 comments on commit 08ea6d4

Please sign in to comment.