print('Calculating error: {}, {}, {}, {}, {}, {}'.format( error_type, method, dataset_str, scene_id, im_id, obj_id)) # Load depth image if VSD is selected if error_type == 'vsd' and im_id != im_id_prev: depth_path = dp['test_depth_mpath'].format(scene_id, im_id) # depth_im = inout.load_depth(depth_path) depth_im = inout.load_depth2(depth_path) # Faster depth_im *= dp['cam']['depth_scale'] # to [mm] # Load camera matrix if error_type in ['vsd', 'cou']: K = scene_info[im_id]['cam_K'] # Load pose estimates res = inout.load_results_sixd17(res_path) ests = res['ests'] # Sort the estimates by score (in descending order) ests_sorted = sorted(enumerate(ests), key=lambda x: x[1]['score'], reverse=True) # Select the required number of top estimated poses if n_top == 0: # All estimates are considered n_top_curr = None elif n_top == -1: # Given by the number of GT poses n_gt = sum([gt['obj_id'] == obj_id for gt in scene_gt[im_id]]) n_top_curr = n_gt else: n_top_curr = n_top
print('Calculating error: {}, {}, {}, {}, {}, {}'.format( error_type, method, dataset_str, scene_id, im_id, obj_id)) # Load depth image if VSD is selected if error_type == 'vsd' and im_id != im_id_prev: depth_path = dp['test_depth_mpath'].format(scene_id, im_id) # depth_im = inout.load_depth(depth_path) depth_im = inout.load_depth2(depth_path) # Faster depth_im *= dp['cam']['depth_scale'] # to [mm] # Load camera matrix if error_type in ['vsd', 'cou']: K = scene_info[im_id]['cam_K'] # Load pose estimates res = inout.load_results_sixd17(res_path) ests = res['ests'] # Sort the estimates by score (in descending order) ests_sorted = sorted(enumerate(ests), key=lambda x: x[1]['score'], reverse=True) # Select the required number of top estimated poses if n_top == 0: # All estimates are considered n_top_curr = None elif n_top == -1: # Given by the number of GT poses n_gt = sum([gt['obj_id'] == obj_id for gt in scene_gt[im_id]]) n_top_curr = n_gt else: n_top_curr = n_top ests_sorted = ests_sorted[slice(0, n_top_curr)]