Example #1
0
def get_closest_scenes(data_dir, verb):
    verb_data_accessor = multi_item_verbs.VerbDataAccessor(test_info_dir=osp.join("test", BASE_DATA_DIR, data_dir))
    demos_for_verb = verb_data_accessor.get_verb_info(verb)
    closest = {}
    for demo_name, info in demos_for_verb:
        exp_clouds = scene_diff.get_clouds_for_demo(verb_data_accessor, demo_name)
        scene_diff_closest_name = scene_diff.get_closest_demo(verb_data_accessor, verb, exp_clouds, ignore=[demo_name])
        closest[demo_name] = scene_diff_closest_name
    return closest
Example #2
0
def get_closest_single_scene(data_dir, demo_name):
    verb_data_accessor = multi_item_verbs.VerbDataAccessor(test_info_dir=osp.join("test", BASE_DATA_DIR, data_dir))
    all_demo_info = verb_data_accessor.get_all_demo_info()
    all_demo_names = all_demo_info.keys()
    assert demo_name in all_demo_names, "all_demo_names: %s" % (str(all_demo_names))

    verb = verb_data_accessor.get_verb_from_demo_name(demo_name)
    exp_clouds = scene_diff.get_clouds_for_demo(verb_data_accessor, demo_name)
    scene_diff_closest_name = scene_diff.get_closest_demo(verb_data_accessor, verb, exp_clouds, ignore=[demo_name])
    return scene_diff_closest_name
Example #3
0
def test_scene_diff(verb, exp_name, correct_closest_name, data_dir):
    verb_data_accessor = multi_item_verbs.VerbDataAccessor(test_info_dir=osp.join("test", TEST_DATA_DIR, data_dir))
    exp_clouds = scene_diff.get_clouds_for_demo(verb_data_accessor, exp_name)
    scene_diff_closest_name, scene_diff_dists = scene_diff.get_closest_demo(verb_data_accessor, verb, exp_clouds, ignore=[exp_name], return_dists=True)
    if correct_closest_name == scene_diff_closest_name:
        report(True)
    else:
        if scene_diff_dists.has_key(correct_closest_name):
            msg = "Closest demo was %s at distance %f; demo %s had distance %f" % \
                  (scene_diff_closest_name, scene_diff_dists[scene_diff_closest_name],
                  correct_closest_name, scene_diff_dists[correct_closest_name])
        else:
            msg = "Closest demo was %s at distance %f; demo %s was not found" % \
                  (scene_diff_closest_name, scene_diff_dists[scene_diff_closest_name],
                  correct_closest_name)
        report(False, msg)
def find_closest_demo(verb, exp_clouds_pc2):
    exp_clouds = [pc2xyzrgb(cloud)[0] for cloud in exp_clouds_pc2]
    closest_demo_name = scene_diff.get_closest_demo(verb, exp_clouds)
    return closest_demo_name