logging.basicConfig(level=logging.INFO) # create a file handler handler = logging.FileHandler('output.log') handler.setLevel(logging.INFO) formatter = logging.Formatter('%(asctime)s %(message)s') handler.setFormatter(formatter) # add the handler to the root logger logging.getLogger('').addHandler(handler) argc = len(sys.argv) if argc == 3: net_config_path = sys.argv[1] params = try_pickle_load(sys.argv[2]) if params is None: exit(1) elif argc == 2: net_config_path = sys.argv[1] params = None else: logger.error("Too few arguments") exit(1) conf = load_config(net_config_path) if conf is None: exit(1) # run evaluation evaluate_conv(conf, net_weights=params)
if __name__ == '__main__': """ Examples of usage: python validate.py network.conf network-12-34.bin [train/validation/test] validates network """ logging.basicConfig(level=logging.INFO) argc = len(sys.argv) if argc == 4: net_config_path = sys.argv[1] params = try_pickle_load(sys.argv[2]) dataset = sys.argv[3] if dataset not in ['train', 'validation', 'test']: print "Wrong dataset type: train/validation/test" exit(1) if params is None: exit(1) else: logger.error("Too few arguments") exit(1) conf = load_config(net_config_path) if conf is None: exit(1) conf['run-dataset'] = dataset # run evaluation validate(conf, params)
layers = yuv_laplacian_norm(img, requested_shape, 3) return i, layers if __name__ == "__main__": ''' python generate_iccv_3l.py gen.conf [show] ''' logging.basicConfig(level=logging.INFO) show = False argc = len(sys.argv) if argc == 2: conf_path = sys.argv[1] elif argc == 3: conf_path = sys.argv[1] if sys.argv[2] == "show": show = True else: print "Wrong arguments" exit(1) else: print "Too few arguments" exit(1) conf = load_config(conf_path) if conf is None: exit(1) main(conf, gen_layers_for_image, n_layers=3, show=show)