當前位置: 首頁>>代碼示例>>Python>>正文


Python config.config方法代碼示例

本文整理匯總了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) 
開發者ID:aidanrwt,項目名稱:twitch-plays,代碼行數:27,代碼來源:bot.py

示例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'] 
開發者ID:aidanrwt,項目名稱:twitch-plays,代碼行數:7,代碼來源:bot.py

示例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) 
開發者ID:aidanrwt,項目名稱:twitch-plays,代碼行數:5,代碼來源:bot.py

示例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 
開發者ID:tonysy,項目名稱:Deep-Feature-Flow-Segmentation,代碼行數:15,代碼來源:train.py

示例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) 
開發者ID:tonysy,項目名稱:Deep-Feature-Flow-Segmentation,代碼行數:7,代碼來源:train.py

示例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 
開發者ID:i-pan,項目名稱:kaggle-rsna18,代碼行數:15,代碼來源:train_end2end.py

示例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) 
開發者ID:i-pan,項目名稱:kaggle-rsna18,代碼行數:11,代碼來源:test.py

示例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) 
開發者ID:i-pan,項目名稱:kaggle-rsna18,代碼行數:15,代碼來源:train_rcnn.py

示例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() 
開發者ID:i-pan,項目名稱:kaggle-rsna18,代碼行數:43,代碼來源:loader.py

示例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 
開發者ID:i-pan,項目名稱:kaggle-rsna18,代碼行數:15,代碼來源:train_end2end.py

示例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) 
開發者ID:i-pan,項目名稱:kaggle-rsna18,代碼行數:6,代碼來源:train_alternate.py

示例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) 
開發者ID:i-pan,項目名稱:kaggle-rsna18,代碼行數:15,代碼來源:train_rfcn.py

示例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() 
開發者ID:i-pan,項目名稱:kaggle-rsna18,代碼行數:33,代碼來源:loader.py

示例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 
開發者ID:i-pan,項目名稱:kaggle-rsna18,代碼行數:15,代碼來源:train_end2end.py

示例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 
開發者ID:i-pan,項目名稱:kaggle-rsna18,代碼行數:34,代碼來源:test.py


注:本文中的config.config.config.config方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。