Skip to content

Commit

Permalink
fix: matching
Browse files Browse the repository at this point in the history
  • Loading branch information
arabian9ts committed Feb 28, 2018
1 parent 08817c0 commit ea674fe
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,25 +105,17 @@ class label loss is evaled by loss_conf
near_jacc = 0.
near_index = None
for i in range(len(matches)):
jacc = jaccard(center2corner(gt_box), center2corner(self.default_boxes[i]))
jacc = jaccard(gt_box, self.default_boxes[i])
if 0.5 <= jacc:
matches[i] = Box(gt_box, gt_label)
pos += 1
matched.append(gt_label)
else:
if near_jacc < jacc:
near_miss = jacc
near_index = i

# prevent pos from becoming 0 <=> loss_loc is 0
# force to match most near box to ground truth box
if 0 == len(matched) and near_index is not None and matches[near_index] is None:
matches[near_index] = Box(gt_box, gt_label)
pos += 1

indicies = self.extract_highest_indicies(pred_confs, pos*5)

neg_pos = 5
indicies = self.extract_highest_indicies(pred_confs, pos*neg_pos)
for i in indicies:
if neg > pos*neg_pos:
break
if matches[i] is None and classes-1 != np.argmax(pred_confs[i]):
matches[i] = Box([], classes-1)
neg += 1
Expand Down Expand Up @@ -152,4 +144,4 @@ class label loss is evaled by loss_conf
expanded_gt_locs.append(box.loc)


return pos_list, neg_list, expanded_gt_labels, expanded_gt_locs
return pos_list, neg_list, expanded_gt_labels, expanded_gt_locs

0 comments on commit ea674fe

Please sign in to comment.