def transform_test_set(im_dir):
    # query
    q_im_names = get_im_names(osp.join(im_dir, 'query'),
                              return_path=True,
                              return_np=False)
    q_im_names.sort()
    q_ids = [parse_original_im_name(n, 'id') for n in q_im_names]
    q_cams = [parse_original_im_name(n, 'cam') for n in q_im_names]
    q_marks = [0 for _ in q_im_names]
    # gallery
    g_im_names = get_im_names(osp.join(im_dir, 'bounding_box_test'),
                              return_path=True,
                              return_np=False)
    g_im_names = [
        n for n in g_im_names if not osp.basename(n).startswith('-1')
    ]
    g_im_names.sort()
    g_ids = [parse_original_im_name(n, 'id') for n in g_im_names]
    g_cams = [parse_original_im_name(n, 'cam') for n in g_im_names]
    g_marks = [1 for _ in g_im_names]
    #
    im_names = q_im_names + g_im_names
    ids = q_ids + g_ids
    cams = q_cams + g_cams
    marks = q_marks + g_marks

    return im_names, ids, cams, marks
def transform_trainval_set(im_dir, start_label=0):
    im_names = get_im_names(osp.join(im_dir, 'bounding_box_train'),
                            return_path=True,
                            return_np=False)
    im_names.sort()
    ids = [parse_original_im_name(n, 'id') for n in im_names]
    unique_ids = list(set(ids))
    unique_ids.sort()
    ids2labels = dict(
        zip(unique_ids, range(start_label, start_label + len(unique_ids))))
    labels = [ids2labels[id] for id in ids]
    return im_names, labels, len(unique_ids)