def __match_with_labels(self,gt_anchor_labels,gt_anchor_bboxes,gt_anchor_scores,jaccard,matching_threshold,gt_labels,gt_bboxes,num_anchors):
#debugging info
#jaccard = tf.Print(jaccard, [gt_labels], "gt_labels")
#match default boxes to any ground truth with jaccard overlap higher than a threshold (0.5).
mask = tf.reduce_max (jaccard, axis = 0) > matching_threshold
mask_inds = tf.argmax(jaccard, axis = 0)
matched_labels = tf.gather(gt_labels, mask_inds)
gt_anchor_labels = tf.where(mask, matched_labels, gt_anchor_labels)
gt_anchor_bboxes = tf.where(mask, tf.gather(gt_bboxes, mask_inds),gt_anchor_bboxes)
gt_anchor_scores = tf.reduce_max(jaccard, axis= 0)
#matching each ground truth box to the default box with the best jaccard overlap
use_no_miss = True
if use_no_miss:
gt_anchor_labels,gt_anchor_bboxes,gt_anchor_scores = self.__match_no_miss(gt_anchor_labels, \
gt_anchor_bboxes, gt_anchor_scores, jaccard, \
gt_labels, gt_bboxes, num_anchors)
return gt_anchor_labels,gt_anchor_bboxes,gt_anchor_scores
评论列表
文章目录