def main(args): if len(args) < 2: menu = ( "Usage: {0} preprocess [config_file] \n" " {0} train [config_file] [test_index] [val_index] [seed]\n" " {0} saliency [config_file] [test_index] [val_index] " "[seed] [testing|validating|training] [index]") print(menu.format(args[0])) exit(1) config = load_config(args[2]) if args[1] == 'preprocess': preprocess(config) elif args[1] == 'train': test_index = int(args[3]) validation_index = int(args[4]) myseed = int(args[5]) train(test_index, validation_index, myseed, config) else: test_index = int(args[3]) validation_index = int(args[4]) myseed = int(args[5]) setname = args[6] index = int(args[7]) saliency(test_index, validation_index, myseed, config, setname, index)
def load_all(config_files): """Load config files.""" result = [] for config_file in config_files: config = load_config(config_file) config['name'] = config_file result.append(config) return result
def main(args): if len(args) < 3: print("Usage: {0} [preprocess|run] [config_file.json]".format(args[0])) exit(1) config = load_config(args[2]) if args[1] == 'preprocess': # make all preprocessing stages before pass them to the CNN preprocess(config) else: run_all(config)
def main(args): if len(args) < 2: menu = "Usage: {0} [main_config]" print(menu.format(args[0])) exit(1) filename = args[1] main_config = load_config(filename) main_config['name'] = filename configs = copy_conf(main_config, load_all(get_config_filenames(filename, main_config))) preprocess_all(configs) run_all(main_config, configs)
def main(args): if len(args) < 2: menu = ("Usage: {0} preprocess [config_file] \n" " {0} run [config_file] [test_index] [validation_index] " "[seed] \n" " {0} predict [config_file]") print(menu.format(args[0])) exit(1) config = load_config(args[2]) if args[1] == 'preprocess': preprocess(config) elif args[1] == 'run': test_index = int(args[3]) validation_index = int(args[4]) myseed = int(args[5]) run(test_index, validation_index, myseed, config) else: myseed = int(args[3]) m, report, accuracy = predict(myseed, config)