當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。