简体   繁体   English

了解 Tensorflow 对象检测 API,检查点的 kwargs class,什么是`_base_tower_layers_for_heads`?

[英]Understanding Tensorflow Object-Detection API, kwargs for Checkpoint class, what is `_base_tower_layers_for_heads`?

Currently, I've been learning how to use Object-Detection API from Tensorflow.目前,我一直在学习如何使用 Tensorflow 中的 Object-Detection API。 I follow a quick start tutorial for training with custom data with this notebook as suggested by them.我按照他们的建议使用此笔记本使用自定义数据进行培训的快速入门教程。 In the effort to understanding each line of the code, I stumbled upon this snippet code in the "Create Model and Restore Weight" part.为了理解代码的每一行,我在“创建 Model 并恢复权重”部分中偶然发现了这段代码。

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,
    )

I don't really understand what are the keyword arguments that are available for the Checkpoint class in that particular snippet code.我真的不明白该特定代码段中可用于Checkpoint class 的关键字 arguments 是什么。 My question is;我的问题是; is there any documentation out there that shows the list of the keyword arguments?是否有任何文档显示关键字 arguments 的列表? or at least explain what are _base_tower_layers_for_heads and _box_prediction_head ?或者至少解释什么是_base_tower_layers_for_heads_box_prediction_head

I've read the tf.train.Checkpoint documentation .我已阅读tf.train.Checkpoint 文档 It says that we can provide models or optimizers for the constructor's keyword argument.它说我们可以为构造函数的关键字参数提供modelsoptimizers I am already familiar with this class to restore the weights to my model, however, I find it is alien to see _base_tower_layers_for_heads or _box_prediction_head for the keyword argument.我已经熟悉这个 class 来恢复我的 model 的权重,但是,我发现看到关键字参数的_base_tower_layers_for_heads_box_prediction_head是陌生的。

I do know about 'heads' and different types of 'heads' in the object detection architecture and their relation to transfer learning, what I don't understand is in the context of their data structure.我确实知道 object 检测架构中的“头”和不同类型的“头”以及它们与迁移学习的关系,但我不了解的是它们的数据结构。 How do I know, these keyword arguments exist?我怎么知道,这些关键字 arguments 存在? and is there any other else?还有其他的吗? I would really appreciate it if somebody could give me insights or at least tell me where can I find documentation that I can read to understand it more.如果有人能给我一些见解,或者至少告诉我在哪里可以找到我可以阅读以进一步理解它的文档,我将不胜感激。

I found pretty useful information about Checkpoint class.我发现了有关Checkpoint class 的非常有用的信息。 It does not come from the documentation but from the tutorial, Training Checkpoints > Loading Mechanism .它不是来自文档,而是来自教程Training Checkpoints > Loading Mechanism

This is what I understand so far:这是我目前所理解的:

  1. The keyword arguments are basically the name of the attributes that are saved in our checkpoint file.关键字 arguments 基本上是保存在我们的检查点文件中的属性的名称。
  2. The variable that is passed to that particular keyword argument is the variable whose value we want to replace with checkpoint values, in other words, our model attributes.传递给该特定关键字参数的变量是我们想要用检查点值替换其值的变量,换句话说,我们的 model 属性。
  3. The checkpoint architecture must match our model architecture in order to make this variable restoration works.检查点架构必须与我们的 model 架构相匹配,才能使这个变量恢复工作。

If we want to know what are the attributes that are saved in our checkpoint file, we can run this command如果我们想知道我们的检查点文件中保存的属性是什么,我们可以运行这个命令

tf.train.list_variables(tf.train.latest_checkpoint('path_to_checkpoint'))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法为Tensorflow对象检测API编译.proto文件 - Unable to compile .proto files for Tensorflow object-detection API 自定义数据集上的tensorflow对象检测API评估 - tensorflow object-detection api eval on custom dataset Tensorflow 对象检测使我的系统过载 - Tensorflow object-detection overload my system Tensorflow 对象检测运行错误 - Tensorflow Object-detection running error 当 num_of_stages: 1(仅限 RPN)在 tensorflow 对象检测 api 中时,导出推理图会出错 - export inference graph gives error when num_of_stages: 1 (RPN only) in tensorflow object-detection api Tensorflow对象检测API:如何禁用从检查点加载 - Tensorflow object detection API: How to disable loading from checkpoint 了解 Tensorflow Object 检测 API 评估指标 - Understanding Tensorflow Object Detection API Evaluation metrics 使用张量流训练对象检测模型时,错误索引 [0] = 0 不在 [0, 0) 中 - Error indices[0] = 0 is not in [0, 0) while training an object-detection model with tensorflow 在Tensorflow对象检测中尝试评估相关模型时出错 - Error when trying to evaluate pertained model in tensorflow object-detection tensorflow对象检测中checkpoint_dir和fine_tune_checkpoint有什么区别? - What is the difference between checkpoint_dir and fine_tune_checkpoint in tensorflow object detection?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM