<s> """<STR_LIT>""" <EOL> import _init_paths <EOL> import numpy as np <EOL> from fast_rcnn . config import cfg , cfg_from_file , cfg_from_list , get_output_dir <EOL> from datasets . factory import get_imdb <EOL> from rpn . generate import imdb_proposals <EOL> import cPickle <EOL> import caffe <EOL> import argparse <EOL> import pprint <EOL> import time , os , sys <EOL> def parse_args ( ) : <EOL> """<STR_LIT>""" <EOL> parser = argparse . ArgumentParser ( description = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , dest = '<STR_LIT>' , help = '<STR_LIT>' , <EOL> default = <NUM_LIT:0> , type = int ) <EOL> parser . add_argument ( '<STR_LIT>' , dest = '<STR_LIT>' , <EOL> help = '<STR_LIT>' , <EOL> default = None , type = str ) <EOL> parser . add_argument ( '<STR_LIT>' , dest = '<STR_LIT>' , <EOL> help = '<STR_LIT>' , <EOL> default = None , type = str ) <EOL> parser . add_argument ( '<STR_LIT>' , dest = '<STR_LIT>' , <EOL> help = '<STR_LIT>' , default = None , type = str ) <EOL> parser . add_argument ( '<STR_LIT>' , dest = '<STR_LIT>' , <EOL> help = '<STR_LIT>' , <EOL> default = True , type = bool ) <EOL> parser . add_argument ( '<STR_LIT>' , dest = '<STR_LIT>' , <EOL> help = '<STR_LIT>' , <EOL> default = '<STR_LIT>' , type = str ) <EOL> parser . add_argument ( '<STR_LIT>' , dest = '<STR_LIT>' , <EOL> help = '<STR_LIT>' , default = None , <EOL> nargs = argparse . REMAINDER ) <EOL> if len ( sys . argv ) == <NUM_LIT:1> : <EOL> parser . print_help ( ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> args = parser . parse_args ( ) <EOL> return args <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> args = parse_args ( ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( args ) <EOL> if args . cfg_file is not None : <EOL> cfg_from_file ( args . cfg_file ) <EOL> if args . set_cfgs is not None : <EOL> cfg_from_list ( args . set_cfgs ) <EOL> cfg . GPU_ID = args . gpu_id <EOL> cfg . TEST . RPN_PRE_NMS_TOP_N = - <NUM_LIT:1> <EOL> cfg . TEST . RPN_POST_NMS_TOP_N = <NUM_LIT> <EOL> print ( '<STR_LIT>' ) <EOL> pprint . pprint ( cfg ) <EOL> while not os . path . exists ( args . caffemodel ) and args . wait : <EOL> print ( '<STR_LIT>' . format ( args . caffemodel ) ) <EOL> time . sleep ( <NUM_LIT:10> ) <EOL> caffe . set_mode_gpu ( ) <EOL> caffe . set_device ( args . gpu_id ) <EOL> net = caffe . Net ( args . prototxt , args . caffemodel , caffe . TEST ) <EOL> net . name = os . path . splitext ( os . path . basename ( args . caffemodel ) ) [ <NUM_LIT:0> ] <EOL> imdb = get_imdb ( args . imdb_name ) <EOL> imdb_boxes = imdb_proposals ( net , imdb ) <EOL> output_dir = get_output_dir ( imdb , net ) <EOL> rpn_file = os . path . join ( output_dir , net . name + '<STR_LIT>' ) <EOL> with open ( rpn_file , '<STR_LIT:wb>' ) as f : <EOL> cPickle . dump ( imdb_boxes , f , cPickle . HIGHEST_PROTOCOL ) <EOL> print '<STR_LIT>' . format ( rpn_file ) </s>
