Beispiel #1
0
def get_iou_totals_per_image(gt_objects, positive_props, detections_regressed,
                             file, percentage):
    total_props_iou = 0
    total_detections_iou = 0
    total_positives = 0
    total_negatives = 0
    total_gt = 0
    total_pckh_precisions = 0
    outliers = 0
    total_fn = 0
    list_found_indices = []
    for gt in gt_objects:
        if (common_functions.check_box_boundaries(gt) == True):
            total_gt += 1
            for prop in positive_props:
                #if(common_functions.check_if_rectangle_contains_another(prop,gt)):
                if (common_functions.bb_intersection_over_boxA(gt, prop) >=
                        0.5):
                    list_found_indices.append(positive_props.index(prop))
                    total_positives += 1
                    total_props_iou += common_functions.bb_intersection_over_union(
                        prop, gt)
                    prop_index = positive_props.index(prop)
                    total_detections_iou += common_functions.bb_intersection_over_union(
                        detections_regressed[prop_index][0], gt)
                    pckh_precision = get_shoulder_precisions(
                        gt, detections_regressed[prop_index][1], file,
                        percentage)
                    total_pckh_precisions += pckh_precision
                    break
    for i in range(0, len(positive_props)):
        if not i in list_found_indices:
            if (common_functions.check_box_boundaries(
                    positive_props[i]) == True):
                total_negatives += 1
            else:
                outliers += 1

    #total_negatives = len(positive_props) - total_positives
    average_props_iou = 0
    average_detections_iou = 0
    average_pckh_precision = 0
    if (total_positives != 0):
        average_props_iou = total_props_iou / total_positives
        average_detections_iou = total_detections_iou / total_positives
        average_pckh_precision = total_pckh_precisions / (total_positives * 2)
    test = total_gt - (total_positives + total_negatives)
    if test > 0:
        total_fn = test
    return average_props_iou, average_detections_iou, total_gt, total_positives, total_negatives, average_pckh_precision, outliers, total_fn
def get_iou_totals_per_image(gt_objects, positive_props, file, percentage):
    total_props_iou = 0
    total_positives = 0
    total_negatives = 0
    total_gt = 0
    outliers = 0
    total_fn = 0
    list_found_indices = []

    for gt in gt_objects:
        gtbox = [gt[0], gt[1], gt[2], gt[3]]
        if (common_functions.check_box_boundaries(gtbox) == True):
            total_gt += 1
            for prop in positive_props:
                #if(common_functions.check_if_rectangle_contains_another(prop,gt)):
                if (common_functions.bb_intersection_over_boxA(gtbox, prop[0])
                        >= 0.5):
                    total_positives += 1
                    list_found_indices.append(positive_props.index(prop))
                    total_props_iou += common_functions.bb_intersection_over_union(
                        prop[0], gtbox)
                    prop_index = positive_props.index(prop)

                    break
    for i in range(0, len(positive_props)):
        if not i in list_found_indices:
            if (common_functions.check_box_boundaries(
                    positive_props[i][0]) == True):
                total_negatives += 1
            else:
                outliers += 1

    #total_negatives = len(positive_props) - total_positives
    average_props_iou = 0
    if (total_positives != 0):
        average_props_iou = total_props_iou / total_positives
    test = total_gt - (total_positives + total_negatives)
    if test > 0:
        total_fn = test
    return average_props_iou, 0, total_gt, total_positives, total_negatives, 0, outliers, total_fn, 0
Beispiel #3
0
def get_iou_totals_per_image(gt_objects, positive_props, file):
    total_props_iou = 0
    total_detections_iou = 0
    total_positives = 0
    total_negatives = 0
    total_gt = 0
    total_pckh_precisions = 0
    list_found_indices = []
    for gt in gt_objects:
        if (common_functions.check_box_boundaries(gt) == True):
            total_gt += 1
            for prop in positive_props:
                if (common_functions.check_if_rectangle_contains_another(
                        prop[0], gt)):
                    list_found_indices.append(positive_props.index(prop))
                    total_positives += 1
                    #total_props_iou += common_functions.bb_intersection_over_union(prop,gt)
                    prop_index = positive_props.index(prop)
                    #total_detections_iou += common_functions.bb_intersection_over_union(detections_regressed[prop_index][0],gt)
                    #pckh_precision = get_shoulder_precisions(gt,detections_regressed[prop_index][1],file)
                    #total_pckh_precisions += pckh_precision
                    break
    for i in range(0, len(positive_props)):
        if not i in list_found_indices:
            if (common_functions.check_box_boundaries(
                    positive_props[i][0]) == True):
                total_negatives += 1

    #total_negatives = len(positive_props) - total_positives
    #average_props_iou = 0
    #average_detections_iou = 0
    #average_pckh_precision = 0
    #if(total_positives != 0):
    #    average_props_iou = total_props_iou/total_positives
    #    average_detections_iou = total_detections_iou/total_positives
    #    average_pckh_precision = total_pckh_precisions/(total_positives * 2)

    return total_gt, total_positives, total_negatives