Пример #1
0
def main():
    parser = OptionParser([SceneOps(), AlgorithmOps(with_gt=True), MetaAlgorithmOps(default=[])])
    scenes, algorithms, meta_algorithms, compute_meta_algos = parser.parse_args()

    # delay imports to speed up usage response
    from toolkit import settings
    from toolkit.algorithms import MetaAlgorithm
    from toolkit.utils import log, misc, point_cloud

    if compute_meta_algos and meta_algorithms:
        MetaAlgorithm.prepare_meta_algorithms(meta_algorithms, algorithms, scenes)

    algorithms += meta_algorithms

    for scene in scenes:
        center_view = scene.get_center_view()

        for algorithm in algorithms:
            if algorithm.get_name() == "gt":
                disp_map = scene.get_gt()
            else:
                disp_map = misc.get_algo_result(algorithm, scene)

            log.info("Creating point cloud for scene '%s' with '%s' disparity map." %
                     (scene.get_name(), algorithm.get_name()))

            pc = point_cloud.convert(scene, disp_map, center_view)

            file_name = "%s_%s.ply" % (scene.get_name(), algorithm.get_name())
            file_path = op.join(settings.EVAL_PATH, "point_clouds", file_name)
            log.info("Saving point cloud to: %s" % file_path)
            point_cloud.save(pc, file_path)
def main():
    parser = OptionParser([SceneOps(), AlgorithmOps(), ThresholdOps()])
    scenes, algorithms, threshold = parser.parse_args()

    # delay imports to speed up usage response
    from toolkit.evaluations import error_heatmaps
    error_heatmaps.plot(algorithms, scenes, thresh=threshold)
Пример #3
0
def main():
    parser = OptionParser([
        ConverterOps(input_help="path to png disparity map",
                     output_help="path to pfm disparity map")
    ])

    image_path, config_path, pfm_path = parser.parse_args()

    from toolkit.scenes import PhotorealisticScene
    from toolkit.utils import log, file_io
    import numpy as np

    scene = PhotorealisticScene("demo", path_to_config=config_path)

    disp_map = file_io.read_file(image_path)
    log.info("Input range: [%0.1f, %0.1f]" %
             (np.min(disp_map), np.max(disp_map)))

    # scale from [MIN, MAX] to [disp_min, disp_max]
    disp_map = (scene.disp_max - scene.disp_min) * (disp_map - MIN) / (
        MAX - MIN) + scene.disp_min
    log.info("Output range: [%0.1f, %0.1f]" %
             (np.min(disp_map), np.max(disp_map)))

    file_io.write_file(disp_map, pfm_path)
Пример #4
0
def main():
    parser = OptionParser([
        AlgorithmOps(),
        SceneOps(),
        MetaAlgorithmOps(with_load_argument=False)
    ])
    algorithms, scenes, meta_algorithms = parser.parse_args()

    from toolkit.algorithms import MetaAlgorithm
    MetaAlgorithm.prepare_meta_algorithms(meta_algorithms, algorithms, scenes)
Пример #5
0
def main():
    parser = OptionParser([SceneOps(), AlgorithmOps(), MetaAlgorithmOps(default=[])])
    scenes, algorithms, meta_algorithms, compute_meta_algos = parser.parse_args()

    # delay imports to speed up usage response
    from toolkit.algorithms import MetaAlgorithm
    from toolkit.evaluations import bad_pix_series

    if compute_meta_algos and meta_algorithms:
        MetaAlgorithm.prepare_meta_algorithms(meta_algorithms, algorithms, scenes)

    bad_pix_series.plot(algorithms+meta_algorithms, scenes)
def main():
    parser = OptionParser([SceneOps(), AlgorithmOps(), MetricOps(), MetaAlgorithmOps(default=[])])
    scenes, algorithms, metrics, meta_algorithms, compute_meta_algos = parser.parse_args()

    # delay imports to speed up usage response
    from toolkit.algorithms import MetaAlgorithm
    from toolkit.evaluations import metric_overviews

    if compute_meta_algos and meta_algorithms:
        MetaAlgorithm.prepare_meta_algorithms(meta_algorithms, algorithms, scenes)

    metric_overviews.plot_general_overview(algorithms+meta_algorithms, scenes, metrics)
Пример #7
0
def main():
    parser = OptionParser([ConverterOps(input_help="path to disparity map",
                                        output_help="path to depth map")])

    disp_map_path, config_path, depth_map_path = parser.parse_args()

    from toolkit.scenes import PhotorealisticScene
    from toolkit.utils import file_io

    scene = PhotorealisticScene("demo", path_to_config=config_path)
    disp_map = file_io.read_file(disp_map_path)
    depth_map = scene.disp2depth(disp_map)
    file_io.write_file(depth_map, depth_map_path)
def main():
    accv_algo_names = ["epi1", "epi2", "lf_occ", "lf", "mv"]
    parser = OptionParser(
        [AlgorithmOps(default=accv_algo_names),
         FigureOpsACCV16()])

    algorithms, figure_options = parser.parse_args()

    # delay imports to speed up usage response
    from toolkit.evaluations import paper_accv_2016, error_heatmaps
    from toolkit.scenes import Backgammon, Dots, Pyramids, Stripes
    from toolkit.utils import log, misc

    if "heatmaps" in figure_options:
        log.info("Creating error heatmaps.")
        scenes = misc.get_stratified_scenes() + misc.get_training_scenes()
        error_heatmaps.plot(algorithms, scenes, subdir=SUBDIR)

    if "radar" in figure_options:
        log.info("Creating radar charts for stratified and training scenes.")
        paper_accv_2016.plot_radar_charts(algorithms, subdir=SUBDIR)

    if "backgammon" in figure_options:
        log.info("Creating special chart for backgammon scene.")
        Backgammon().plot_fattening_thinning(algorithms, subdir=SUBDIR)

    if "pyramids" in figure_options:
        log.info("Creating special chart for pyramids scene.")
        Pyramids().plot_algo_disp_vs_gt_disp(algorithms, subdir=SUBDIR)

    if "dots" in figure_options:
        log.info("Creating special chart for dots scene.")
        Dots().plot_error_vs_noise(algorithms, subdir=SUBDIR)

    if "stripes" in figure_options:
        log.info("Creating special chart for stripes scene.")
        Stripes().visualize_masks(subdir=SUBDIR)

    if "stratified" in figure_options:
        for scene in misc.get_stratified_scenes():
            log.info("Creating metric visualizations for scene: %s." %
                     scene.get_display_name())
            scene.plot_algo_overview(algorithms,
                                     with_metric_vis=True,
                                     subdir=SUBDIR)

    if "training" in figure_options:
        for scene in misc.get_training_scenes():
            log.info("Creating metric visualizations for scene: %s." %
                     scene.get_display_name())
            scene.plot_algo_overview(algorithms, subdir=SUBDIR)
Пример #9
0
def main():
    parser = OptionParser([SceneOps(), AlgorithmOps(), MetaAlgorithmOps()])
    scenes, algorithms, meta_algorithms, compute_meta_algos = parser.parse_args(
    )

    # delay imports to speed up usage response
    from toolkit.algorithms import MetaAlgorithm
    from toolkit.evaluations import meta_algo_comparisons

    if compute_meta_algos and meta_algorithms:
        MetaAlgorithm.prepare_meta_algorithms(meta_algorithms, algorithms,
                                              scenes)

    for meta_algorithm in meta_algorithms:
        meta_algo_comparisons.plot(algorithms, scenes, meta_algorithm)
def main():
    parser = OptionParser(
        [AlgorithmOps(),
         SceneOps(), MetaAlgorithmOps(default=[])])
    algorithms, scenes, meta_algorithms, compute_meta_algos = parser.parse_args(
    )

    # delay imports to speed up usage response
    from toolkit.algorithms import MetaAlgorithm
    from toolkit.evaluations import pairwise_algo_comparisons

    if compute_meta_algos and meta_algorithms:
        MetaAlgorithm.prepare_meta_algorithms(meta_algorithms, algorithms,
                                              scenes)

    pairwise_algo_comparisons.plot_pairwise_comparisons(
        algorithms + meta_algorithms, scenes)
Пример #11
0
def main():
    parser = OptionParser([ConverterOpsExt(input_help="path to disparity map",
                                           output_help="path to point cloud",
                                           optional_input=[("-c", "color_map_file",
                                                            "path to color map, "
                                                            "e.g. to center view of the scene")])])

    disp_map_path, config_path, point_cloud_path, color_map_path = parser.parse_args()

    from toolkit.scenes import PhotorealisticScene
    from toolkit.utils import point_cloud, file_io

    scene = PhotorealisticScene("demo", path_to_config=config_path)
    disp_map = file_io.read_file(disp_map_path)

    if color_map_path:
        color_map = file_io.read_file(color_map_path)
    else:
        color_map = None

    points = point_cloud.convert(scene, disp_map, color_map)
    point_cloud.save(points, point_cloud_path)
Пример #12
0
def main():
    parser = OptionParser([
        SceneOps(),
        AlgorithmOps(),
        MetricOps(),
        VisualizationOps(),
        OverwriteOps(),
        MetaAlgorithmOps(default=[])
    ])
    scenes, algorithms, metrics, with_vis, add_to_existing, meta_algorithms, compute_meta_algos = parser.parse_args(
    )

    # delay import to speed up usage response
    from toolkit import settings
    from toolkit.algorithms import MetaAlgorithm
    from toolkit.evaluations import submission_evaluation
    from toolkit.utils import misc

    if compute_meta_algos and meta_algorithms:
        MetaAlgorithm.prepare_meta_algorithms(meta_algorithms, algorithms,
                                              scenes)

    algorithms += meta_algorithms

    for algorithm in algorithms:
        evaluation_output_path = op.join(settings.ALGO_EVAL_PATH,
                                         algorithm.get_name())
        algorithm_input_path = misc.get_path_to_algo_data(algorithm)
        submission_evaluation.evaluate(
            scenes=scenes,
            metrics=metrics,
            visualize=with_vis,
            evaluation_output_path=evaluation_output_path,
            algorithm_input_path=algorithm_input_path,
            add_to_existing_results=add_to_existing)