【问题标题】:How to train a ssd-mobilenet from scratch如何从头开始训练 ssd-mobilenet
【发布时间】:2020-06-25 15:56:39
【问题描述】:

如何在没有迁移学习的情况下从 tensorflow 对象检测模型动物园重新训练 ssd-mobilenet-v2。我指的是每一个重量,而不仅仅是最后一层。

我是否必须构建网络架构和训练脚本,或者我可以对 .config 文件或训练自定义对象检测器的文档中指定的 train.py 脚本进行一些小的更改。

这种方法会提高/恶化网络准确性/损失吗?

提前感谢您的帮助。

【问题讨论】:

    标签: python tensorflow object-detection object-detection-api mobilenet


    【解决方案1】:

    首先,默认情况下所有参数都被重新训练,除非您在 pipeline.config 中另有定义。

    有一个名为 pipeline.config 的文件,您可以使用它来控制您的训练过程。 https://github.com/tensorflow/models/blob/master/research/object_detection/samples/configs/ssd_mobilenet_v2_coco.config

    在配置文件中,您可以定义是否要从检查点加载模型参数。 您可以选择多种操作: 1. 为骨干网加载参数(即你的 mobilenet 特征提取器) 2. 为预测和回归头加载参数。 3.不要加载参数(通常你不会喜欢这个——训练和收敛需要更长的时间)

    更具体地说,您应该在 pipline.config 中关注以下节点:

    1. fine_tune_checkpoint - 用于进行迁移学习的原始模型的检查点。
    2. fine_tune_checkpoint_type - 定义检查点是否为分类/检测
    3. load_all_detection_checkpoint_vars - 如果 True - 那么来自 fine_tune_checkpoint 的参数将在训练开始之前加载。
    4. freeze_variables - 如果您不想重新训练所有参数,您可以定义要冻结的变量。 (在他们的 proto 文件 object_detection/protos/train.proto 中查看这些的完整文档) - https://github.com/tensorflow/models/blob/master/research/object_detection/protos/train.proto

    例子:

    153   fine_tune_checkpoint: "<PATH-TO-DOWNLOADED-CKPT>/model.ckpt"
    154   fine_tune_checkpoint_type: detection
    155   load_all_detection_checkpoint_vars: true
    

    所有参数都将被加载并重新训练。

    【讨论】:

      猜你喜欢
      • 2020-03-26
      • 1970-01-01
      • 2020-04-07
      • 2020-12-11
      • 2020-09-09
      • 2020-08-25
      • 1970-01-01
      • 1970-01-01
      • 2018-08-12
      相关资源
      最近更新 更多