(file_path, phase)
return name_bbs_dict
Citypersons .mat annotation operations
    return: a dict, key: imagename, value: an array of n* <lbl, x1 y1 x2 y2>
Citypersons .mat annotation operations
    return: a dict, key: imagename, value: an array of n* <lbl, x1 y1 x2 y2>
Citypersons . mat annotation operations return : a dict key : imagename value : an array of n * <lbl x1 y1 x2 y2 >
def parse_cityperson_mat(file_path, phase):
    '''
    Citypersons .mat annotation operations
    return: a dict, key: imagename, value: an array of n* <lbl, x1 y1 x2 y2>
    '''
    tv = phase
    k = 'anno_{}_aligned'.format(phase)
    bbox_counter = 0
    rawmat = loadmat(file_path, mat_dtype=True)
    mat = rawmat[k][0]  # uint8 overflow fix
    name_bbs_dict = {}
    for img_idx in range(len(mat)):
        # each image
        img_anno = mat[img_idx][0, 0]

        city_name = img_anno[0][0]
        img_name_with_ext = img_anno[1][0]
        bbs = img_anno[2]  # n x 10 matrix
        # 10-D: n* [class_label, x1, y1, w, h, instance_id, x1_vis, y1_vis, w_vis, h_vis]

        name_bbs_dict[img_name_with_ext] = bbs
        bbox_counter += bbs.shape[0]

    img_num = len(mat)  # - noins_img_counter
    print('Parsed {}: {} bboxes in {} images remained ({:.2f} boxes/img) '.format(tv,
                                                                                 bbox_counter,
                                                                                 img_num,
                                                                                 bbox_counter / img_num))
    return name_bbs_dict
def parse_cityperson_mat ( file_path , phase ) : tv = phase k = 'anno_{}_aligned' . format ( phase ) bbox_counter = 0 rawmat = loadmat ( file_path , mat_dtype = True ) mat = rawmat [ k ] [ 0 ] # uint8 overflow fix name_bbs_dict = { } for img_idx in range ( len ( mat ) ) : # each image img_anno = mat [ img_idx ] [ 0 , 0 ] city_name = img_anno [ 0 ] [ 0 ] img_name_with_ext = img_anno [ 1 ] [ 0 ] bbs = img_anno [ 2 ] # n x 10 matrix # 10-D: n* [class_label, x1, y1, w, h, instance_id, x1_vis, y1_vis, w_vis, h_vis] name_bbs_dict [ img_name_with_ext ] = bbs bbox_counter += bbs . shape [ 0 ] img_num = len ( mat ) # - noins_img_counter print ( 'Parsed {}: {} bboxes in {} images remained ({:.2f} boxes/img) ' . format ( tv , bbox_counter , img_num , bbox_counter / img_num ) ) return name_bbs_dict