def main(argv): # Parse script arguments try: opts, _ = getopt.getopt(argv, "s:t:c:d", ["scene=", "tree=", "classifier=", "double-step"]) except getopt.GetoptError: print_script_usage() sys.exit(2) features = featuresfirststep.all_features_dict() scene = None tree = None step_size = 1 for opt, arg in opts: if opt in ("-s", "--scene"): scene = Scene(arg) load_maxima([scene]) elif opt in ("-t", "--tree"): tree = evaluatetree.read_decision_tree(arg, features) elif opt in ("-d", "--double-step"): step_size = 2 if scene is None or tree is None: print_script_usage() sys.exit(2) print_R_script(scene, tree, step_size)
def main(argv): # Parse script arguments try: opts, _ = getopt.getopt(argv, "s:t:c:d", ["scene=", "tree=", "classifier=", "double-step"]) except getopt.GetoptError: print_script_usage() sys.exit(2) features = featuresfirststep.all_features_dict() scene = None tree = None classifier = None step_size = 1 for opt, arg in opts: if opt in ("-s", "--scene"): scene = load_scene(arg) elif opt in ("-t", "--tree"): tree = evaluatetree.read_decision_tree(arg, features) elif opt in ("-c", "--classifier"): if arg == "highest": classifier = featuresfirststep.highest_on_left elif arg == "nearest": classifier = featuresfirststep.nearest_on_left elif arg == "near_high": classifier = featuresfirststep.highest_and_near_on_left elif opt in ("-d", "--double-step"): step_size = 2 if scene is None or tree is None: print_script_usage() sys.exit(2) print_R_script(scene, tree, classifier, step_size)
def main(argv): # Parse script arguments try: opts, _ = getopt.getopt(argv, "d:uo", ["left-right-tree=", "lowlight", "low-light", "lowlightgauss", "low-light-gauss", "action-tree=", "double-step", "backlash", "noise", "specific-scene=", "perfect-file=", "use-only="]) except getopt.GetoptError: print_script_usage() sys.exit(2) params = BenchmarkParameters() specific_scene = None use_only_file = None scenes_folder = "focusraw/" for opt, arg in opts: if opt in ("-d", "--double-step"): params.step_size = 2 raise Exception("Simulator does not support double step size yet.") elif opt in ("-uo", "--use-only"): use_only_file = arg elif opt in ("--lowlight", "--low-light"): scenes_folder = "lowlightraw/" elif opt in ("--lowlightgauss", "--low-light-gauss"): scenes_folder = "lowlightgaussraw/" elif opt == "--left-right-tree": params.left_right_tree = evaluatetree.read_decision_tree( arg, featuresfirststep.all_features_dict()) elif opt == "--action-tree": params.action_tree = evaluatetree.read_decision_tree( arg, featuresturn.all_features_dict()) elif opt == "--specific-scene": specific_scene = arg elif opt == "--perfect-file": params.perfect_classification = load_classifications(arg) elif opt == "--backlash": params.backlash = True elif opt == "--noise": params.noise = True else: print_script_usage() sys.exit(2) random.seed(seed) # Make sure simulator has everything it needs. if params.missing_params(): print_script_usage() sys.exit(2) scenes = load_scenes(folder=scenes_folder, excluded_scenes=["cat.txt", "moon.txt", "projector2.txt", "projector3.txt"]) if use_only_file: scenes = [scene for scene in scenes if scene.filename == use_only_file] if specific_scene is None: benchmark_scenes(params, scenes) else: benchmark_specific(params, scenes, specific_scene)