【发布时间】:2020-07-21 18:22:58
【问题描述】:
目前,我一直在学习如何使用 Tensorflow 的 Object-Detection API。我按照他们的建议使用this notebook 使用自定义数据进行训练的快速入门教程。为了理解代码的每一行,我在“创建模型并恢复权重”部分偶然发现了这段 sn-p 代码。
fake_box_predictor = tf.compat.v2.train.Checkpoint(
_base_tower_layers_for_heads=detection_model._box_predictor._base_tower_layers_for_heads,
# _prediction_heads=detection_model._box_predictor._prediction_heads,
# (i.e., the classification head that we *will not* restore)
_box_prediction_head=detection_model._box_predictor._box_prediction_head,
)
我真的不明白在那个特定的 sn-p 代码中,Checkpoint 类可用的关键字参数是什么。我的问题是;是否有任何文档显示关键字参数列表?或者至少解释一下_base_tower_layers_for_heads和_box_prediction_head是什么?
我读过tf.train.Checkpointdocumentation。它说我们可以为构造函数的关键字参数提供models 或optimizers。我已经熟悉这个类来恢复我的模型的权重,但是,我发现看到 _base_tower_layers_for_heads 或 _box_prediction_head 作为关键字参数是陌生的。
我确实知道对象检测架构中的“头”和不同类型的“头”以及它们与迁移学习的关系,但我不了解的是它们的数据结构的上下文。我怎么知道,这些关键字参数存在?还有其他的吗?如果有人能给我见解或至少告诉我在哪里可以找到我可以阅读以进一步理解它的文档,我将不胜感激。
【问题讨论】:
标签: python tensorflow tensorflow2.0 object-detection object-detection-api