当前位置: 首页>>代码示例>>Python>>正文


Python cfg.OUTPUT_DIR属性代码示例

本文整理汇总了Python中core.config.cfg.OUTPUT_DIR属性的典型用法代码示例。如果您正苦于以下问题:Python cfg.OUTPUT_DIR属性的具体用法?Python cfg.OUTPUT_DIR怎么用?Python cfg.OUTPUT_DIR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在core.config.cfg的用法示例。


在下文中一共展示了cfg.OUTPUT_DIR属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_output_dir

# 需要导入模块: from core.config import cfg [as 别名]
# 或者: from core.config.cfg import OUTPUT_DIR [as 别名]
def get_output_dir(args, run_name):
    """ Get root output directory for each run """
    cfg_filename, _ = os.path.splitext(os.path.split(args.cfg_file)[1])
    return os.path.join(cfg.OUTPUT_DIR, cfg_filename, run_name) 
开发者ID:roytseng-tw,项目名称:Detectron.pytorch,代码行数:6,代码来源:misc.py

示例2: test_restore_checkpoint

# 需要导入模块: from core.config import cfg [as 别名]
# 或者: from core.config.cfg import OUTPUT_DIR [as 别名]
def test_restore_checkpoint():
    # Create Model
    model = model_builder.create(cfg.MODEL.TYPE, train=True)
    add_momentum_init_ops(model)
    init_weights(model)
    # Fill input blobs
    roidb = combined_roidb_for_training(
        cfg.TRAIN.DATASETS, cfg.TRAIN.PROPOSAL_FILES
    )
    model_builder.add_training_inputs(model, roidb=roidb)
    workspace.CreateNet(model.net)
    # Bookkeeping for checkpoint creation
    iter_num = 0
    checkpoints = {}
    output_dir = get_output_dir(cfg.TRAIN.DATASETS, training=True)
    chk_file_path = os.path.join(output_dir, 'model_iter{}.pkl'.format(iter_num))
    checkpoints[iter_num] = chk_file_path
    # Save model weights
    nu.save_model_to_weights_file(checkpoints[iter_num], model)
    orig_gpu_0_params, orig_all_params = get_params(model)
    # Change the model weights
    init_weights(model)
    # Reload the weights in the model
    nu.initialize_gpu_from_weights_file(model, chk_file_path, gpu_id=0)
    nu.broadcast_parameters(model)
    shutil.rmtree(cfg.OUTPUT_DIR)
    _, restored_all_params = get_params(model)
    # Check if all params are loaded correctly
    for scoped_name, blob in orig_all_params.items():
        np.testing.assert_array_equal(blob, restored_all_params[scoped_name])
    # Check if broadcast_parameters works
    for scoped_name, blob in restored_all_params.items():
        unscoped_name = c2_utils.UnscopeName(scoped_name)
        np.testing.assert_array_equal(blob, orig_gpu_0_params[unscoped_name]) 
开发者ID:ronghanghu,项目名称:seg_every_thing,代码行数:36,代码来源:test_restore_checkpoint.py

示例3: get_output_dir

# 需要导入模块: from core.config import cfg [as 别名]
# 或者: from core.config.cfg import OUTPUT_DIR [as 别名]
def get_output_dir(args, run_name):
    """ Get root output directory for each run """
    cfg_filename, _ = os.path.splitext(os.path.split(args.cfg_file)[1])
    return os.path.join(cfg.OUTPUT_DIR, cfg_filename, args.dataset, run_name) 
开发者ID:jz462,项目名称:Large-Scale-VRD.pytorch,代码行数:6,代码来源:misc.py


注:本文中的core.config.cfg.OUTPUT_DIR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。