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)
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)
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)
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)
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)
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)
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)
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)
def main(): scenes = OptionParser([SceneOps()]).parse_args() for scene in scenes: offset = scene.compute_offset() print "%s: %0.3f" % (scene, offset)
def main(): figure_options = OptionParser([FigureOpsCVPR17()]).parse_args() # delay imports to speed up usage response from toolkit.algorithms import Algorithm, PerPixBest from toolkit.evaluations import paper_cvprw_2017 as cvprw from toolkit.utils import log, misc from toolkit.scenes import PhotorealisticScene # prepare scenes if USE_TEST_SCENE_GT: benchmark_scenes = misc.get_benchmark_scenes() else: benchmark_scenes = misc.get_stratified_scenes( ) + misc.get_training_scenes() # prepare algorithms fnames_baseline_algos = ["epi1", "epi2", "lf", "mv", "lf_occ26"] fnames_challenge_algos = [ "ober", "omg_occ", "ps_rf25", "rm3de", "sc_gc", "spo_lf4cv", "zctv1" ] fnames_other_submissions = ["obercross", "ofsy_330dnr2"] baseline_algorithms = Algorithm.initialize_algorithms( fnames_baseline_algos, is_baseline=True) challenge_algorithms = Algorithm.initialize_algorithms( fnames_challenge_algos) other_algorithms = Algorithm.initialize_algorithms( fnames_other_submissions) for algorithm in other_algorithms: algorithm.display_name = "'" + algorithm.display_name algorithms = sorted(baseline_algorithms) + sorted( other_algorithms) + sorted(challenge_algorithms) algorithms = Algorithm.set_colors(algorithms) # create figures if "normalsdemo" in figure_options: log.info("Creating normals demo figure with Sideboard scene.") scene = PhotorealisticScene("sideboard") cvprw.plot_normals_explanation(Algorithm("epi1"), scene, subdir=SUBDIR) if "radar" in figure_options: log.info("Creating radar charts.") cvprw.plot_radar_charts(algorithms, subdir=SUBDIR) if "badpix" in figure_options: log.info("Creating figures with BadPix series.") per_pix_best = PerPixBest() per_pix_best.compute_meta_results(algorithms, benchmark_scenes) cvprw.plot_bad_pix_series(algorithms + [per_pix_best], USE_TEST_SCENE_GT, subdir=SUBDIR) if "median" in figure_options: log.info("Creating median comparison figures.") cvprw.plot_median_diffs(algorithms, misc.get_stratified_scenes(), subdir=SUBDIR) cvprw.plot_median_diffs(algorithms, misc.get_training_scenes(), subdir=SUBDIR) if "normals" in figure_options: log.info("Creating surface normal figure with Cotton scene.") cvprw.plot_normal_maps(algorithms, PhotorealisticScene("cotton"), subdir=SUBDIR) if USE_TEST_SCENE_GT and "discont" in figure_options: log.info("Creating discontinuity figure with Bicycle scene.") cvprw.plot_discont_overview(algorithms, PhotorealisticScene("bicycle"), subdir=SUBDIR) if "accuracy" in figure_options: log.info("Creating high accuracy figure.") selection = [ "ofsy_330dnr2", "zctv1", "obercross", "ober", "sc_gc", "spo_lf4cv", "rm3de", "ps_rf25" ] high_accuracy_algorithms = [] # algorithms should be exactly in the order of 'selection' for algo_name in selection: high_accuracy_algorithms.append( [a for a in algorithms if a.get_name() == algo_name][0]) scenes = [PhotorealisticScene("cotton"), PhotorealisticScene("boxes")] cvprw.plot_high_accuracy(high_accuracy_algorithms, scenes, subdir=SUBDIR) if "scenes" in figure_options: log.info("Creating scene overview figure.") cvprw.plot_benchmark_scene_overview(misc.get_benchmark_scenes(), subdir=SUBDIR) if "difficulty" in figure_options: log.info("Creating scene difficulty figure.") cvprw.plot_scene_difficulty(benchmark_scenes, subdir=SUBDIR)