本文整理汇总了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)
示例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])
示例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)