Tensorflow 对象检测 API - “fine_tune"与“检测"vs “分类" [英] Tensorflow Object Detection API - "fine_tune" vs "detection" vs "classification"

查看:280
本文介绍了Tensorflow 对象检测 API - “fine_tune"与“检测"vs “分类"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注本教程:https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html

在其中,它在文件 pipeline.config 中有以下片段:

In it, it has the following snippet in the file pipeline.config:

fine_tune_checkpoint_type: "detection" # Set this to "detection" since we want to be training the full detection model

进一步调查得出以下发现:

Further investigation leads to the following discoveries:

  • fine_tune_checkpoint_type 字段至少有 3 个选项 - fine_tunedetectionclassification
  • 并非来自 模型动物园 允许所有选项.
  • There are at least 3 options for the field fine_tune_checkpoint_type - fine_tune,detection and classification
  • Not all models from the model zoo allow all options.

我的问题是:

  • 在这种情况下,fine_tunedetectionclassification 分别是什么意思,更重要的是什么时候使用每一个是合适的.
  • 如何判断哪些选项与模型动物园中的模型兼容?
  • What do each of fine_tune,detection and classification mean in this context, and more importantly when is it appropriate to use each one.
  • How do I tell which options are compatible with models in the model zoo?

最终我希望进行迁移学习 - 例如使用现有的训练模型并训练它为一个或多个新类绘制框.

Ultimately I wish to do transfer learning - e.g. take an existing trained model and train it to draw boxes for one or more novel classes.

推荐答案

这些选项指示如何恢复检查点,来自 这里

Those options indicates how to restore checkpoints and comes from here

我把有趣的部分复制到这里:

I copy here the interesting part:

此选项控制如何从(预训练的)fine_tune_checkpoint 恢复变量.对于 TF2 模型,支持 3 种不同的类型:

This option controls how variables are restored from the (pre-trained) fine_tune_checkpoint. For TF2 models, 3 different types are supported:

  1. classification":只恢复特征提取器的分类骨干部分.当您想从预训练的图像分类模型开始训练检测模型时,通常使用此选项,例如在 ImageNet 上预训练的 ResNet 模型.
  2. 检测":恢复整个特征提取器.完整检测模型中唯一没有恢复的部分是框和类预测头.当您想要使用预训练的检测模型并在需要不同框和类别预测头的新数据集或任务上进行训练时,通常会使用此选项.
  3. full":恢复整个检测模型,包括特征提取器、其分类主干和预测头.仅当预训练和微调任务相同时才应使用此选项.否则,模型的参数可能具有不兼容的形状,这将在尝试恢复检查点时导致错误.有关此参数的更多详细信息,请参阅/meta_architectures/*meta_arch.py​​ 文件中的 restore_map (TF1) 或 restore_from_object (TF2) 函数文档.

我猜fine_tune目前被full"取代.根据您的需要,正确的选择似乎是检测".要知道哪些模型支持多种选项,如上所述,您必须查看正确 /meta_architectures/*meta_arch.py​​ 文件中的 restore_from_object 函数定义

I guess fine_tune is currently replaced by "full". Based on your needs the right choice appear to be "detection". To know which models supports wich options, as indicated above you have to look at the restore_from_object function definition in the proper /meta_architectures/*meta_arch.py files

这篇关于Tensorflow 对象检测 API - “fine_tune"与“检测"vs “分类"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆