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)
def SSH_init(): import caffe from utils.get_config import cfg, cfg_print, cfg_from_file cfg_from_file('./lib/SSH/SSH/configs/wider_pyramid.yml') cfg_print(cfg) caffe.set_mode_gpu() caffe.set_device(0) # loading network net = caffe.Net('./lib/SSH/SSH/models/test_ssh.prototxt', './lib/SSH/data/SSH_models/SSH.caffemodel', caffe.TEST) net.name = 'SSH' return net
cv2.WINDOW_FULLSCREEN) else: cv2.setWindowProperty(windowName, cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_NORMAL) if __name__ == "__main__": # Parse arguments args = parser() # Load the external config if args.cfg is not None: cfg_from_file(args.cfg) # Print config file cfg_print(cfg) # Loading the network cfg.GPU_ID = args.gpu_id caffe.set_mode_gpu() caffe.set_device(args.gpu_id) assert os.path.isfile( args.prototxt), 'Please provide a valid path for the prototxt!' assert os.path.isfile( args.model), 'Please provide a valid path for the caffemodel!' print('Loading the network...', end="") net = caffe.Net(args.prototxt, args.model, caffe.TEST) net.name = 'SSH' print('Done!') print("OpenCV version: {}".format(cv2.__version__))
parser.add_argument('--out_path',dest='out_path',help='Output path for saving the figure', default='data/demo',type=str) parser.add_argument('--cfg',dest='cfg',help='Config file to overwrite the default configs', default='SSH/configs/default_config.yml',type=str) return parser.parse_args() if __name__ == "__main__": # Parse arguments args = parser() # Load the external config if args.cfg is not None: cfg_from_file(args.cfg) # Print config file cfg_print(cfg) # Loading the network cfg.GPU_ID = args.gpu_id caffe.set_mode_gpu() caffe.set_device(args.gpu_id) assert os.path.isfile(args.prototxt),'Please provide a valid path for the prototxt!' assert os.path.isfile(args.model),'Please provide a valid path for the caffemodel!' print('Loading the network...', end="") net = caffe.Net(args.prototxt, args.model, caffe.TEST) net.name = 'SSH' print('Done!') # Read image assert os.path.isfile(args.im_path),'Please provide a path to an existing image!'
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,
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), pretrained_model=args.pretrained,