'Labels boxes detected with the same class from the same image as tp/fp.
Args:
detected_boxes: A numpy array of shape [N, 4] representing detected box
coordinates
detected_scores: A 1-d numpy array of length N representing classification
score
groundtruth_boxes: A numpy array of shape [M, 4] representing ground truth
box coordinates
groundtruth_is_difficult_list: A boolean numpy array of length M denoting
whether a ground truth box is a difficult instance or not
Returns:
scores: A numpy array representing the detection scores
tp_fp_labels: a boolean numpy array indicating whether a detection is a
true positive.'

def _compute_tp_fp_for_single_class(self, detected_boxes, detected_scores, groundtruth_boxes, groundtruth_is_difficult_list):

    if (detected_boxes.size == 0):
        return (np.array([], dtype=float), np.array([], dtype=bool))
    detected_boxlist = np_box_list.BoxList(detected_boxes)
    detected_boxlist.add_field('scores', detected_scores)
    detected_boxlist = np_box_list_ops.non_max_suppression(detected_boxlist, self.nms_max_output_boxes, self.nms_iou_threshold)
    scores = detected_boxlist.get_field('scores')
    if (groundtruth_boxes.size == 0):
        return (scores, np.zeros(detected_boxlist.num_boxes(), dtype=bool))
    gt_boxlist = np_box_list.BoxList(groundtruth_boxes)
    iou = np_box_list_ops.iou(detected_boxlist, gt_boxlist)
    max_overlap_gt_ids = np.argmax(iou, axis=1)
    is_gt_box_detected = np.zeros(gt_boxlist.num_boxes(), dtype=bool)
    tp_fp_labels = np.zeros(detected_boxlist.num_boxes(), dtype=bool)
    is_matched_to_difficult_box = np.zeros(detected_boxlist.num_boxes(), dtype=bool)
    for i in range(detected_boxlist.num_boxes()):
        gt_id = max_overlap_gt_ids[i]
        if (iou[(i, gt_id)] >= self.matching_iou_threshold):
            if (not groundtruth_is_difficult_list[gt_id]):
                if (not is_gt_box_detected[gt_id]):
                    tp_fp_labels[i] = True
                    is_gt_box_detected[gt_id] = True
            else:
                is_matched_to_difficult_box[i] = True
    return (scores[(~ is_matched_to_difficult_box)], tp_fp_labels[(~ is_matched_to_difficult_box)])
