本文整理匯總了Python中config.config.config.config方法的典型用法代碼示例。如果您正苦於以下問題:Python config.config方法的具體用法?Python config.config怎麽用?Python config.config使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類config.config.config
的用法示例。
在下文中一共展示了config.config方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: run
# 需要導入模塊: from config.config import config [as 別名]
# 或者: from config.config.config import config [as 別名]
def run(self):
throttle_timers = {button:0 for button in config['throttled_buttons'].keys()}
while True:
new_messages = self.irc.recv_messages(1024)
if not new_messages:
continue
for message in new_messages:
button = message['message'].lower()
username = message['username'].lower()
if not self.game.is_valid_button(button):
continue
if button in self.config['throttled_buttons']:
if time.time() - throttle_timers[button] < self.config['throttled_buttons'][button]:
continue
throttle_timers[button] = time.time()
self.set_message_buffer({'username': username, 'button': button})
pbutton(self.message_buffer)
self.game.push_button(button)
示例2: __init__
# 需要導入模塊: from config.config import config [as 別名]
# 或者: from config.config.config import config [as 別名]
def __init__(self):
self.config = config
self.irc = Irc(config)
self.game = Game()
self.message_buffer = [{'username': '', 'button': ''}] * self.config['misc']['chat_height']
示例3: set_message_buffer
# 需要導入模塊: from config.config import config [as 別名]
# 或者: from config.config.config import config [as 別名]
def set_message_buffer(self, message):
self.message_buffer.insert(self.config['misc']['chat_height'] - 1, message)
self.message_buffer.pop(0)
示例4: parse_args
# 需要導入模塊: from config.config import config [as 別名]
# 或者: from config.config.config import config [as 別名]
def parse_args():
parser = argparse.ArgumentParser(description='Train deeplab network')
# general
parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str)
args, rest = parser.parse_known_args()
# update config
update_config(args.cfg)
# training
parser.add_argument('--frequent', help='frequency of logging', default=config.default.frequent, type=int)
args = parser.parse_args()
return args
示例5: main
# 需要導入模塊: from config.config import config [as 別名]
# 或者: from config.config.config import config [as 別名]
def main():
print('Called with argument:', args)
ctx = [mx.gpu(int(i)) for i in config.gpus.split(',')]
train_net(args, ctx, config.network.pretrained, config.network.pretrained_epoch, config.TRAIN.model_prefix,
config.TRAIN.begin_epoch, config.TRAIN.end_epoch, config.TRAIN.lr, config.TRAIN.lr_step)
示例6: parse_args
# 需要導入模塊: from config.config import config [as 別名]
# 或者: from config.config.config import config [as 別名]
def parse_args():
parser = argparse.ArgumentParser(description='Train Faster-RCNN network')
# general
parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str)
args, rest = parser.parse_known_args()
# update config
update_config(args.cfg)
# training
parser.add_argument('--frequent', help='frequency of logging', default=config.default.frequent, type=int)
args = parser.parse_args()
return args
示例7: main
# 需要導入模塊: from config.config import config [as 別名]
# 或者: from config.config.config import config [as 別名]
def main():
ctx = [mx.gpu(int(i)) for i in config.gpus.split(',')]
print args
logger, final_output_path = create_logger(config.output_path, args.cfg, config.dataset.test_image_set)
test_rcnn(config, config.dataset.dataset, config.dataset.test_image_set, config.dataset.root_path, config.dataset.dataset_path,
ctx, os.path.join(final_output_path, '..', '_'.join([iset for iset in config.dataset.image_set.split('+')]), config.TRAIN.model_prefix), config.TEST.test_epoch,
args.vis, args.ignore_cache, args.shuffle, config.TEST.HAS_RPN, config.dataset.proposal, args.thresh, logger=logger, output_path=final_output_path)
示例8: main
# 需要導入模塊: from config.config import config [as 別名]
# 或者: from config.config.config import config [as 別名]
def main():
print ('Called with argument:', args)
ctx = [mx.gpu(int(i)) for i in config.gpus.split(',')]
logger, output_path = create_logger(config.output_path, args.cfg, config.dataset.image_set)
shutil.copy2(os.path.join(curr_path, 'symbols', config.symbol + '.py'), output_path)
prefix = os.path.join(output_path, 'rcnn')
logging.info('########## TRAIN rcnn WITH IMAGENET INIT AND RPN DETECTION')
train_rcnn(config, config.dataset.dataset, config.dataset.image_set, config.dataset.root_path, config.dataset.dataset_path,
args.frequent, config.default.kvstore, config.TRAIN.FLIP, config.TRAIN.SHUFFLE, config.TRAIN.RESUME,
ctx, config.network.pretrained, config.network.pretrained_epoch, prefix, config.TRAIN.begin_epoch,
config.TRAIN.end_epoch, train_shared=False, lr=config.TRAIN.lr, lr_step=config.TRAIN.lr_step,
proposal=config.dataset.proposal, logger=logger)
示例9: __init__
# 需要導入模塊: from config.config import config [as 別名]
# 或者: from config.config.config import config [as 別名]
def __init__(self, roidb, config, batch_size=2, shuffle=False, ctx=None, work_load_list=None, aspect_grouping=False):
"""
This Iter will provide roi data to Fast R-CNN network
:param roidb: must be preprocessed
:param batch_size: must divide BATCH_SIZE(128)
:param shuffle: bool
:param ctx: list of contexts
:param work_load_list: list of work load
:param aspect_grouping: group images with similar aspects
:return: ROIIter
"""
super(ROIIter, self).__init__()
# save parameters as properties
self.roidb = roidb
self.cfg = config
self.batch_size = batch_size
self.shuffle = shuffle
self.ctx = ctx
if self.ctx is None:
self.ctx = [mx.cpu()]
self.work_load_list = work_load_list
self.aspect_grouping = aspect_grouping
# infer properties from roidb
self.size = len(roidb)
self.index = np.arange(self.size)
# decide data and label names (only for training)
self.data_name = ['data', 'rois']
self.label_name = ['label', 'bbox_target', 'bbox_weight']
# status variable for synchronization between get_data and get_label
self.cur = 0
self.batch = None
self.data = None
self.label = None
# get first batch to fill in provide_data and provide_label
self.reset()
self.get_batch_individual()
示例10: parse_args
# 需要導入模塊: from config.config import config [as 別名]
# 或者: from config.config.config import config [as 別名]
def parse_args():
parser = argparse.ArgumentParser(description='Train R-FCN network')
# general
parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str)
args, rest = parser.parse_known_args()
# update config
update_config(args.cfg)
# training
parser.add_argument('--frequent', help='frequency of logging', default=config.default.frequent, type=int)
args = parser.parse_args()
return args
示例11: main
# 需要導入模塊: from config.config import config [as 別名]
# 或者: from config.config.config import config [as 別名]
def main():
print('Called with argument:', args)
ctx = [mx.gpu(int(i)) for i in config.gpus.split(',')]
alternate_train(args, ctx, config.network.pretrained, config.network.pretrained_epoch)
示例12: main
# 需要導入模塊: from config.config import config [as 別名]
# 或者: from config.config.config import config [as 別名]
def main():
print ('Called with argument:', args)
ctx = [mx.gpu(int(i)) for i in config.gpus.split(',')]
logger, output_path = create_logger(config.output_path, args.cfg, config.dataset.image_set)
shutil.copy2(os.path.join(curr_path, 'symbols', config.symbol + '.py'), output_path)
prefix = os.path.join(output_path, 'rfcn')
logging.info('########## TRAIN rfcn WITH IMAGENET INIT AND RPN DETECTION')
train_rcnn(config, config.dataset.dataset, config.dataset.image_set, config.dataset.root_path, config.dataset.dataset_path,
args.frequent, config.default.kvstore, config.TRAIN.FLIP, config.TRAIN.SHUFFLE, config.TRAIN.RESUME,
ctx, config.network.pretrained, config.network.pretrained_epoch, prefix, config.TRAIN.begin_epoch,
config.TRAIN.end_epoch, train_shared=False, lr=config.TRAIN.lr, lr_step=config.TRAIN.lr_step,
proposal=config.dataset.proposal, logger=logger)
示例13: __init__
# 需要導入模塊: from config.config import config [as 別名]
# 或者: from config.config.config import config [as 別名]
def __init__(self, roidb, config, batch_size=1, shuffle=False,
has_rpn=False):
super(TestLoader, self).__init__()
# save parameters as properties
self.cfg = config
self.roidb = roidb
self.batch_size = batch_size
self.shuffle = shuffle
self.has_rpn = has_rpn
# infer properties from roidb
self.size = len(self.roidb)
self.index = np.arange(self.size)
# decide data and label names (only for training)
if has_rpn:
self.data_name = ['data', 'im_info']
else:
self.data_name = ['data', 'rois']
self.label_name = None
# status variable for synchronization between get_data and get_label
self.cur = 0
self.data = None
self.label = []
self.im_info = None
# get first batch to fill in provide_data and provide_label
self.reset()
self.get_batch()
示例14: parse_args
# 需要導入模塊: from config.config import config [as 別名]
# 或者: from config.config.config import config [as 別名]
def parse_args():
parser = argparse.ArgumentParser(description='Train Faster-RCNN network')
# general
parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str)
args, rest = parser.parse_known_args()
# update config
update_config(args.cfg)
# training
parser.add_argument('--frequent', help='frequency of logging', default=config.default.frequent, type=int)
args, rest = parser.parse_known_args()
return args
示例15: parse_args
# 需要導入模塊: from config.config import config [as 別名]
# 或者: from config.config.config import config [as 別名]
def parse_args():
parser = argparse.ArgumentParser(description='Test a Faster R-CNN network')
# general
parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str)
args, rest = parser.parse_known_args()
update_config(args.cfg)
# rcnn
parser.add_argument('--vis', help='turn on visualization', action='store_true')
parser.add_argument('--ignore_cache', help='ignore cached results boxes', action='store_true')
parser.add_argument('--thresh', help='valid detection threshold', default=1e-3, type=float)
parser.add_argument('--shuffle', help='shuffle data on visualization', action='store_true')
parser.add_argument('--test_epoch', help='the epoch model to be test', default=config.TEST.test_epoch, type=int)
# nms
parser.add_argument('--nms', help='params for nms or softnms', default=config.TEST.NMS, type=float)
parser.add_argument('--softnms', help='whether to enable softnms', default=config.TEST.SOFTNMS, action='store_true')
parser.add_argument('--naive_nms', help='whether to enable naive nms', default=False, action='store_true')
parser.add_argument('--first_n', help='first_n for learn nms or nms', default=config.TEST.FIRST_N, type=int)
parser.add_argument('--merge', help='merge method for learn nms', default=config.TEST.MERGE_METHOD, type=int)
parser.add_argument('--debug', help='whether to enable debug mode', default=False, action='store_true')
# dataset
parser.add_argument('--test_set', help='which set to be tested', default=config.dataset.test_image_set, type=str)
args, rest = parser.parse_known_args()
# update config
config.TEST.test_epoch = args.test_epoch
config.TEST.NMS = args.nms
config.TEST.SOFTNMS = args.softnms and (not args.naive_nms)
config.TEST.FIRST_N = args.first_n
config.TEST.MERGE_METHOD = args.merge
config.dataset.test_image_set = args.test_set
return args