def main(args): # Combine the default config with # the external config file and the set command if args.cfg is not None: cfg_from_file(args.cfg) if args.set_cfgs is not None: cfg_from_list(args.set_cfgs) cfg.DEBUG = args.debug cfg.GPU_ID = args.gpu_id cfg_print(cfg) # Loading the network caffe.set_mode_gpu() caffe.set_device(args.gpu_id) net = caffe.Net(args.prototxt, args.model, caffe.TEST) # Create the imdb imdb = get_imdb(args.db_name) # Set the network name net.name = args.net_name # Evaluate the network test_net(net, imdb, visualize=args.visualize, no_cache=args.no_cache, output_path=args.out_path)
default=None, nargs=argparse.REMAINDER) return parser.parse_args() if __name__ == '__main__': args = parser() # Load settings if args.conf_file: cfg_from_file(args.conf_file) # For train and test, usually we do not need cache; unless overridden by amend cfg.TEST.NO_CACHE = True if args.set_cfgs: cfg_from_list(args.set_cfgs) # Record logs into cfg cfg.LOG.CMD = ' '.join(sys.argv) cfg.LOG.TIME = datetime.datetime.now().strftime('%Y_%m_%d_%H_%M_%S') np.random.seed(int(cfg.RNG_SEED)) if cfg.TENSORBOARD.ENABLE: tb.client = Tensorboard(hostname=cfg.TENSORBOARD.HOSTNAME, port=cfg.TENSORBOARD.PORT) tb.sess = tb.client.create_experiment(cfg.NAME + '_' + cfg.LOG.TIME) if args.train == 'true' or args.train == 'True': # the training entrance # Get training imdb imdb = get_imdb(cfg.TRAIN.DB) roidb = get_training_roidb(imdb)
default='SSH/configs/wider.yml', type=str) parser.add_argument('--iters', dest='iters', help='Number of iterations for training the network', default=21000, type=int) return parser.parse_args() if __name__ == '__main__': # Get command line arguments args = parser() # Combine external configs with SSH default configs if args.cfg is not None: cfg_from_file(args.cfg) if args.set_cfgs is not None: cfg_from_list(args.set_cfgs) cfg_print(cfg,test=False) # Set the GPU ids gpu_list = args.gpu_ids.split(',') gpus = [int(i) for i in gpu_list] # Set the random seed for numpy np.random.seed(cfg.RNG_SEED) # Prepare the training roidb imdb= get_imdb(args.db_name) roidb = get_training_roidb(imdb) # Train the model train_net(args.solver_proto, roidb, output_dir=get_output_dir(imdb.name),