def train_fast_rcnn(queue=None, imdb_name=None, init_model=None, solver=None, max_iters=None, cfg=None, rpn_file=None):
 cfg.TRAIN.HAS_RPN = False
 cfg.TRAIN.PROPOSAL_METHOD = 'rpn'
 cfg.TRAIN.IMS_PER_BATCH = 2
 print 'Init model: {}'.format(init_model)
 print 'RPN proposals: {}'.format(rpn_file)
 print 'Using config:'
 pprint.pprint(cfg)
 import caffe
 _init_caffe(cfg)
 (roidb, imdb) = get_roidb(imdb_name, rpn_file=rpn_file)
 output_dir = get_output_dir(imdb)
 print 'Output will be saved to `{:s}`'.format(output_dir)
 model_paths = train_net(solver, roidb, output_dir, pretrained_model=init_model, max_iters=max_iters)
 for i in model_paths[:(-1)]:
  os.remove(i)
 fast_rcnn_model_path = model_paths[(-1)]
 queue.put({'model_path': fast_rcnn_model_path})

def train_fast_rcnn ( queue = None , imdb_name = None , init_model = None , solver = None , max_iters = None , cfg = None , rpn_file = None ) : cfg . TRAIN . HAS_RPN = False cfg . TRAIN . PROPOSAL_METHOD = 'rpn' cfg . TRAIN . IMS_PER_BATCH = 2 print 'Init model: {}' . format ( init_model ) print 'RPN proposals: {}' . format ( rpn_file ) print 'Using config:' pprint . pprint ( cfg ) import caffe _init_caffe ( cfg ) ( roidb , imdb ) = get_roidb ( imdb_name , rpn_file = rpn_file ) output_dir = get_output_dir ( imdb ) print 'Output will be saved to `{:s}`' . format ( output_dir ) model_paths = train_net ( solver , roidb , output_dir , pretrained_model = init_model , max_iters = max_iters ) for i in model_paths [ : ( - 1 ) ] : os . remove ( i ) fast_rcnn_model_path = model_paths [ ( - 1 ) ] queue . put ( { 'model_path' : fast_rcnn_model_path } )
train a fast r-cnn using proposals generated by an rpn .