当我指的是网络的一层时,我很困惑范围或操作的含义。如果我想微调网络的最后一个softmax层,我是要转到作用域、操作还是变量来处理它?这些术语之间有什么区别?在
我看过TF slim walkthrough ipynb教程,下面是他们如何排除一些微调范围的方法:
def get_init_fn():
"""Returns a function run by the chief worker to warm-start the training."""
checkpoint_exclude_scopes=["InceptionV1/Logits", "InceptionV1/AuxLogits"]
exclusions = [scope.strip() for scope in checkpoint_exclude_scopes]
variables_to_restore = []
for var in slim.get_model_variables():
excluded = False
for exclusion in exclusions:
if var.op.name.startswith(exclusion):
excluded = True
break
if not excluded:
variables_to_restore.append(var)
return slim.assign_from_checkpoint_fn(
os.path.join(checkpoints_dir, 'inception_v1.ckpt'),
variables_to_restore)
似乎他们排除了某些作用域["InceptionV1/Logits", "InceptionV1/AuxLogits"]
,从中他们将每个变量从他们想要排除的范围中排除,并且从他们没有列出的范围中包括任何变量{
如果是这样,这就是令人困惑的部分:变量与操作的相关性是什么?我的印象是操作名称用于查找作用域名称,如["InceptionV1/Logits", "InceptionV1/AuxLogits"]
,例如,通过写入[op.name for op in g.get_operations()]
。如果是这样,为什么一个变量仍然有一个op.name
?在
如何找到作用域名称以选择要微调的某些层?我想这对消除我的困惑很重要。在
谢谢你们的帮助。在
目前没有回答
相关问题 更多 >
编程相关推荐