nn/nn_utils.py
def read_iou_from_file(result_record):
    """
    read iou records from a file, ious will be stored based on each file and each filed (city_name)
    :param result_record: record read from a result file
    :return: tile based iou, field based iou and overall iou
    """
    tile_dict = {}
    field_list = []
    field_dict = {}
    overall = np.zeros(2)
    for cnt, line in enumerate(result_record[:-1]):
        tile_name = line.split(' ')[0]
        a, b = [float(item) for item in line.split('(')[1].strip().strip(')').split(',')]
        tile_dict[tile_name] = a / b
        field_name = ''.join([a for a in tile_name if not a.isdigit()])
        if field_name not in field_dict:
            field_list.append(field_name)
            field_dict[field_name] = np.array([a, b])
        else:
            field_dict[field_name] += np.array([a, b])
        overall += np.array([a, b])
    for field_name in field_list:
        field_dict[field_name] = field_dict[field_name][0] / field_dict[field_name][1]
    overall = overall[0] / overall[1]
    return tile_dict, field_dict, overall

    read iou records from a file, ious will be stored based on each file and each filed (city_name)
    :param result_record: record read from a result file
    :return: tile based iou, field based iou and overall iou
    
read iou records from a file, ious will be stored based on each file and each filed (city_name)
read iou records from a file ious will be stored based on each file and each filed ( city_name )
def read_iou_from_file(result_record):
    tile_dict = {}
    field_list = []
    field_dict = {}
    overall = np.zeros(2)
    for cnt, line in enumerate(result_record[:-1]):
        tile_name = line.split(' ')[0]
        a, b = [float(item) for item in line.split('(')[1].strip().strip(')').split(',')]
        tile_dict[tile_name] = a / b
        field_name = ''.join([a for a in tile_name if not a.isdigit()])
        if field_name not in field_dict:
            field_list.append(field_name)
            field_dict[field_name] = np.array([a, b])
        else:
            field_dict[field_name] += np.array([a, b])
        overall += np.array([a, b])
    for field_name in field_list:
        field_dict[field_name] = field_dict[field_name][0] / field_dict[field_name][1]
    overall = overall[0] / overall[1]
    return tile_dict, field_dict, overall
def read_iou_from_file ( result_record ) : tile_dict = { } field_list = [ ] field_dict = { } overall = np . zeros ( 2 ) for cnt , line in enumerate ( result_record [ : - 1 ] ) : tile_name = line . split ( ' ' ) [ 0 ] a , b = [ float ( item ) for item in line . split ( '(' ) [ 1 ] . strip ( ) . strip ( ')' ) . split ( ',' ) ] tile_dict [ tile_name ] = a / b field_name = '' . join ( [ a for a in tile_name if not a . isdigit ( ) ] ) if field_name not in field_dict : field_list . append ( field_name ) field_dict [ field_name ] = np . array ( [ a , b ] ) else : field_dict [ field_name ] += np . array ( [ a , b ] ) overall += np . array ( [ a , b ] ) for field_name in field_list : field_dict [ field_name ] = field_dict [ field_name ] [ 0 ] / field_dict [ field_name ] [ 1 ] overall = overall [ 0 ] / overall [ 1 ] return tile_dict , field_dict , overall
read iou records from a file, ious will be stored based on each file and each filed (city_name)
read iou records from a file ious will be stored based on each file and each filed ( city_name )
"""
    read iou records from a file, ious will be stored based on each file and each filed (city_name)
    :param result_record: record read from a result file
    :return: tile based iou, field based iou and overall iou
    """
None
result_record
record read from a result file
record read from a result file