问题描述
我正在关注本教程: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_tune
、detection
和classification
- 并非来自 模型动物园 允许所有选项.
- There are at least 3 options for the field
fine_tune_checkpoint_type
-fine_tune
,detection
andclassification
- Not all models from the model zoo allow all options.
我的问题是:
- 在这种情况下,
fine_tune
、detection
和classification
分别是什么意思,更重要的是什么时候使用每一个是合适的. - 如何判断哪些选项与模型动物园中的模型兼容?
- What do each of
fine_tune
,detection
andclassification
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 种不同的类型:
- classification":只恢复特征提取器的分类骨干部分.当您想从预训练的图像分类模型开始训练检测模型时,通常使用此选项,例如在 ImageNet 上预训练的 ResNet 模型.
- 检测":恢复整个特征提取器.完整检测模型中唯一没有恢复的部分是框和类预测头.当您想要使用预训练的检测模型并在需要不同框和类别预测头的新数据集或任务上进行训练时,通常会使用此选项.
- 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 “分类"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!