def training_targets(default_anchors, class_predicts, labels): class_predicts = nd.transpose(class_predicts, axes=(0, 2, 1)) z = MultiBoxTarget(*[default_anchors, labels, class_predicts]) box_target = z[0] # box offset target for (x, y, width, height) box_mask = z[1] # mask is used to ignore box offsets we don't want to penalize, e.g. negative samples cls_target = z[2] # cls_target is an array of labels for all anchors boxes return box_target, box_mask, cls_target
def training_targets(self, default_anchors, class_predicts, labels): ''' Helper function to obtain the bounding boxes from the anchors. ''' class_predicts = nd.transpose(class_predicts, axes=(0, 2, 1)) box_target, box_mask, cls_target = MultiBoxTarget(default_anchors, labels, class_predicts) return box_target, box_mask, cls_target
def training_targets(default_anchors, class_predicts, labels): class_predicts = nd.transpose(class_predicts, axes=(0, 2, 1)) z = MultiBoxTarget(*[default_anchors, labels, class_predicts]) box_target = z[0] box_mask = z[1] # ignore certain box offsets cls_target = z[2] return box_target, box_mask, cls_target
def training_targets(anchors, class_preds, labels): ''' :param anchors: 1 x num_anchors x 4 :param class_preds: batchsize x num_anchors x num_cls :param labels: batchsize x label_width :return: box_target: batchsize x (num_anchors x 4) box_mask: batchsize x (num_anchors x 4) cls_target: batchsize x num_anchors ''' class_preds = class_preds.transpose(axes=(0, 2, 1)) # batchsize x num_cls x num_anchors box_target, box_mask, cls_target = MultiBoxTarget(anchors, labels, class_preds, overlap_threshold=.5, \ ignore_label=-1, negative_mining_ratio=3, minimum_negative_samples=0, \ negative_mining_thresh=.5, variances=(0.1, 0.1, 0.2, 0.2), name="multibox_target") return box_target, box_mask, cls_target
def training_targets(anchors, class_preds, labels): class_preds = class_preds.transpose(axes=(0, 2, 1)) return MultiBoxTarget(anchors, labels, class_preds)
def training_targets(anchors, class_preds, labels): class_preds = class_preds.transpose(axes=(0, 2, 1)) return MultiBoxTarget(anchors, labels, class_preds, overlap_threshold=0.3 ) # ,overlap_threshold=0.3,negative_mining_ratio=0.3