dp_split = dataset_params.get_split_params(p['datasets_path'], p['dataset'],
                                           p['dataset_split'],
                                           p['dataset_split_type'])

scene_ids = dp_split['scene_ids']
dists = []
azimuths = []
elevs = []
visib_fracts = []
ims_count = 0
for scene_id in scene_ids:
    misc.log('Processing - dataset: {} ({}, {}), scene: {}'.format(
        p['dataset'], p['dataset_split'], p['dataset_split_type'], scene_id))

    # Load GT poses.
    scene_gt = inout.load_scene_gt(
        dp_split['scene_gt_tpath'].format(scene_id=scene_id))

    # Load info about the GT poses.
    scene_gt_info = inout.load_json(
        dp_split['scene_gt_info_tpath'].format(scene_id=scene_id),
        keys_to_int=True)

    ims_count += len(scene_gt)

    for im_id in scene_gt.keys():
        for gt_id, im_gt in enumerate(scene_gt[im_id]):

            # Object distance.
            dist = np.linalg.norm(im_gt['cam_t_m2c'])
            dists.append(dist)
Esempio n. 2
0
# Load dataset parameters.
dp_split = dataset_params.get_split_params(p['datasets_path'], p['dataset'],
                                           p['dataset_split'],
                                           p['dataset_split_type'])

model_type = None
if p['dataset'] == 'tless':
    model_type = 'cad'
dp_model = dataset_params.get_model_params(p['datasets_path'], p['dataset'],
                                           model_type)

scene_ids = dataset_params.get_present_scene_ids(dp_split)
for scene_id in scene_ids:
    # Load scene GT.
    scene_gt_path = dp_split['scene_gt_tpath'].format(scene_id=scene_id)
    scene_gt = inout.load_scene_gt(scene_gt_path)

    # Load scene camera.
    scene_camera_path = dp_split['scene_camera_tpath'].format(
        scene_id=scene_id)
    scene_camera = inout.load_scene_camera(scene_camera_path)

    # Create folders for the output masks (if they do not exist yet).
    mask_dir_path = os.path.dirname(dp_split['mask_tpath'].format(
        scene_id=scene_id, im_id=0, gt_id=0))
    misc.ensure_dir(mask_dir_path)

    mask_visib_dir_path = os.path.dirname(dp_split['mask_visib_tpath'].format(
        scene_id=scene_id, im_id=0, gt_id=0))
    misc.ensure_dir(mask_visib_dir_path)