def rpn_generate(queue=None, imdb_name=None, rpn_model_path=None, cfg=None, rpn_test_prototxt=None):
 cfg.TEST.RPN_PRE_NMS_TOP_N = (-1)
 cfg.TEST.RPN_POST_NMS_TOP_N = 2000
 print 'RPN model: {}'.format(rpn_model_path)
 print 'Using config:'
 pprint.pprint(cfg)
 import caffe
 _init_caffe(cfg)
 imdb = get_imdb(imdb_name)
 print 'Loaded dataset `{:s}` for proposal generation'.format(imdb.name)
 rpn_net = caffe.Net(rpn_test_prototxt, rpn_model_path, caffe.TEST)
 output_dir = get_output_dir(imdb)
 print 'Output will be saved to `{:s}`'.format(output_dir)
 rpn_proposals = imdb_proposals(rpn_net, imdb)
 rpn_net_name = os.path.splitext(os.path.basename(rpn_model_path))[0]
 rpn_proposals_path = os.path.join(output_dir, (rpn_net_name + '_proposals.pkl'))
 with open(rpn_proposals_path, 'wb') as f:
  cPickle.dump(rpn_proposals, f, cPickle.HIGHEST_PROTOCOL)
 print 'Wrote RPN proposals to {}'.format(rpn_proposals_path)
 queue.put({'proposal_path': rpn_proposals_path})

def rpn_generate ( queue = None , imdb_name = None , rpn_model_path = None , cfg = None , rpn_test_prototxt = None ) : cfg . TEST . RPN_PRE_NMS_TOP_N = ( - 1 ) cfg . TEST . RPN_POST_NMS_TOP_N = 2000 print 'RPN model: {}' . format ( rpn_model_path ) print 'Using config:' pprint . pprint ( cfg ) import caffe _init_caffe ( cfg ) imdb = get_imdb ( imdb_name ) print 'Loaded dataset `{:s}` for proposal generation' . format ( imdb . name ) rpn_net = caffe . Net ( rpn_test_prototxt , rpn_model_path , caffe . TEST ) output_dir = get_output_dir ( imdb ) print 'Output will be saved to `{:s}`' . format ( output_dir ) rpn_proposals = imdb_proposals ( rpn_net , imdb ) rpn_net_name = os . path . splitext ( os . path . basename ( rpn_model_path ) ) [ 0 ] rpn_proposals_path = os . path . join ( output_dir , ( rpn_net_name + '_proposals.pkl' ) ) with open ( rpn_proposals_path , 'wb' ) as f : cPickle . dump ( rpn_proposals , f , cPickle . HIGHEST_PROTOCOL ) print 'Wrote RPN proposals to {}' . format ( rpn_proposals_path ) queue . put ( { 'proposal_path' : rpn_proposals_path } )
use a trained rpn to generate proposals .