def main(): """Sets up all the configurations for apollocaffe, and ReInspect and runs the trainer.""" parser = apollocaffe.base_parser() parser.add_argument('--config', required=True) args = parser.parse_args() config = json.load(open(args.config, 'r')) if args.weights is not None: config["solver"]["weights"] = args.weights apollocaffe.set_random_seed(config["solver"]["random_seed"]) apollocaffe.set_device(args.gpu) apollocaffe.set_cpp_loglevel(args.loglevel) net = apollocaffe.ApolloNet() image_mean = load_image_mean_from_binproto(config['data']["idl_mean"]) fake_input_en = {"image": np.zeros((1, 3, 227, 227))} forward(net, fake_input_en, deploy=True) if config["solver"]["weights"]: net.load(config["solver"]["weights"]) else: raise Exception('weights file is not provided!') run_socket(net, 13502, image_mean)
def main(): network_generators = { 'ZF': ZFGenerator } args = parse_args(network_generators.keys()) if args.cfg is not None: cfg_from_file(args.cfg) apollocaffe.set_random_seed(cfg.RNG_SEED) np.random.seed(cfg.RNG_SEED) if args.gpu_id >= 0: apollocaffe.set_device(args.gpu_id) apollocaffe.set_cpp_loglevel(3) train_roidb = None if args.train_imdb is not None: train_imdb = get_imdb(args.train_imdb) train_imdb.set_proposal_method(cfg.TRAIN.PROPOSAL_METHOD) train_roidb = get_training_roidb(train_imdb) test_roidb = None if args.test_imdb is not None: test_imdb = get_imdb(args.test_imdb) test_imdb.set_proposal_method('gt') prepare_roidb(test_imdb) test_roidb = test_imdb.roidb faster_rcnn = FasterRCNN(args, network_generators, train_roidb=train_roidb, test_roidb=test_roidb) faster_rcnn.train() return 0
def main(): parser = apollocaffe.base_parser() parser.add_argument("--config", required=True) args = parser.parse_args() config = json.load(open(args.config, 'r')) apollocaffe.set_random_seed(config["solver"]["random_seed"]) apollocaffe.set_device(args.gpu) apollocaffe.set_cpp_loglevel(args.loglevel) train(config)
def main(): parser = apollocaffe.base_parser() parser.add_argument("--config", required=True) args = parser.parse_args() config = json.load(open(args.config, 'r')) apollocaffe.set_random_seed(config["solver"]["random_seed"]) apollocaffe.set_device(args.gpu) apollocaffe.set_cpp_loglevel(args.loglevel) evaluate(config)
def main(): parser = apollocaffe.base_parser() parser.add_argument("--config", required=True) args = parser.parse_args() config = json.load(open(args.config, 'r')) apollocaffe.set_random_seed(config["solver"]["random_seed"]) apollocaffe.set_device(args.gpu) apollocaffe.set_cpp_loglevel(args.loglevel) list_add=data_root+'list_all_test.txt' list_crop_add=data_root+'list_det_crop_align_filled.txt' feat_add=data_root+'feat1.txt' train_gt=np.loadtxt(list_add, dtype={'names': ('name', ), 'formats': ('S200', )}) train_crop_gt=np.loadtxt(list_crop_add, dtype={'names': ('name', 'label'), 'formats': ('S200', 'i4')}) train_feat=np.loadtxt(feat_add) train_feat_list=[] train_label_list=[] assert(len(train_crop_gt)==train_feat.shape[0]) im_list=train_crop_gt['name']; for k in xrange(len(im_list)): im_list[k]=im_list[k].split('/')[-1][0:-7] im_list_uniq=list(set(im_list)) for s in im_list_uniq: idx=s==train_crop_gt['name'] feat=train_feat[idx,:] train_feat_list.append(feat) train_label_list.append(s) feat_add2=data_root+'feat2.txt' train_feat2=np.loadtxt(feat_add2)#.reshape((-1,1)) train_feat_list2=[] assert(len(train_crop_gt)==train_feat2.shape[0]) for s in im_list_uniq: idx=s==im_list feat2=train_feat2[idx,:] train_feat_list2.append(feat2) holistic_feat_add=data_root+'feat_centrist_test_d1024.txt' holistic_feat=np.loadtxt(holistic_feat_add) scene_feat_list=[] for k,s in enumerate(im_list_uniq): idx=s.split('/')[-1]==train_gt['name'] assert(idx.sum()==1) scene_feat_list.append(holistic_feat[idx,:]) test_data={'feats': train_feat_list, 'feats2': train_feat_list2, 'labels': train_label_list, 'scene_feats': scene_feat_list, 'current_idx': 0} evaluate(config, test_data)
def main(): parser = apollocaffe.base_parser() parser.add_argument('--config', required=True) args = parser.parse_args() config = json.load(open(args.config, 'r')) if args.weights is not None: config["solver"]["weights"] = args.weights config["solver"]["start_iter"] = args.start_iter apollocaffe.set_random_seed(config["solver"]["random_seed"]) apollocaffe.set_device(args.gpu) apollocaffe.set_cpp_loglevel(args.loglevel) train(config)
def main(): parser = apollocaffe.base_parser() parser.add_argument("--config", required=True) args = parser.parse_args() config = json.load(open(args.config, "r")) if args.weights is not None: config["solver"]["weights"] = args.weights config["solver"]["start_iter"] = args.start_iter apollocaffe.set_random_seed(config["solver"]["random_seed"]) apollocaffe.set_device(args.gpu) apollocaffe.set_cpp_loglevel(args.loglevel) train(config)
def main(): """Sets up all the configurations for apollocaffe, and ReInspect and runs the trainer.""" parser = apollocaffe.base_parser() parser.add_argument('--config', required=True) args = parser.parse_args() config = json.load(open(args.config, 'r')) if args.weights is not None: config["solver"]["weights"] = args.weights apollocaffe.set_random_seed(config["solver"]["random_seed"]) apollocaffe.set_device(args.gpu) apollocaffe.set_cpp_loglevel(args.loglevel) deploy(config)
def main(): """Sets up all the configurations for apollocaffe, and ReInspect and runs the trainer.""" parser = apollocaffe.base_parser() parser.add_argument('--config', required=True) args = parser.parse_args() config = json.load(open(args.config, 'r')) if args.weights is not None: config["solver"]["weights"] = args.weights config["solver"]["start_iter"] = args.start_iter apollocaffe.set_random_seed(config["solver"]["random_seed"]) apollocaffe.set_device(args.gpu) apollocaffe.set_cpp_loglevel(args.loglevel) train(config)
def main(): """Sets up all the configurations for apollocaffe, and ReInspect and runs the trainer.""" parser = apollocaffe.base_parser() parser.add_argument('--config', required=True) args = parser.parse_args() config = json.load(open(args.config, 'r')) if args.weights is not None: config["solver"]["weights"] = args.weights config["solver"]["start_iter"] = args.start_iter apollocaffe.set_random_seed(config["solver"]["random_seed"]) apollocaffe.set_device(args.gpu) apollocaffe.set_cpp_loglevel(args.loglevel) print json.dumps(config['solver'], indent=4, sort_keys=True) print json.dumps(config['MMD'], indent=4, sort_keys=True) train(config)