def mine(self, im, gt_bboxes):
"""
Propose bounding boxes using proposer, and
augment non-overlapping boxes with IoU < 0.1
to the ground truth set.
(up to a maximum of num_proposals)
"""
bboxes = self.proposer_.process(im)
if len(gt_bboxes):
# Determine bboxes that have low IoU with ground truth
# iou = [N x GT]
iou = brute_force_match(bboxes, gt_bboxes,
match_func=lambda x,y: intersection_over_union(x,y))
# print('Detected {}, {}, {}'.format(iou.shape, len(gt_bboxes), len(bboxes))) # , np.max(iou, axis=1)
overlap_inds, = np.where(np.max(iou, axis=1) < 0.1)
bboxes = bboxes[overlap_inds]
# print('Remaining non-overlapping {}'.format(len(bboxes)))
bboxes = bboxes[:self.num_proposals_]
targets = self.generate_targets(len(bboxes))
return bboxes, targets
评论列表
文章目录