如何从头开始训练 ssd-mobilenet [英] How to train a ssd-mobilenet from scratch

查看:246
本文介绍了如何从头开始训练 ssd-mobilenet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How can I retrain a ssd-mobilenet-v2 from the tensorflow object detection model zoo without transfer learning. I mean every weight and not just the last layer.

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

Do I have to build the network architecture and the script for training or can I make some minor change to the .config file or the train.py script specified in the docs on training a custom object detector.

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

Will this approach improve/worsen the network accuracy/loss?

在此先感谢您的帮助.

推荐答案

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

First, by default all parameters are being retrained, unless you defined otherwise in the pipeline.config.

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

There's a file named pipeline.config, which you use to control your training process. https://github.com/tensorflow/models/blob/master/research/object_detection/samples/configs/ssd_mobilenet_v2_coco.config

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

In the config file you can define whether you want to load the model parameters from a checkpoint or not. There are a several actions you can choose: 1. load parameters for the backbone (i.e. your mobilenet feature extractor) 2. load parameters for the prediction and regressions heads. 3. don't load parameters (usually you won't prefer this one - will take longer to train and converge)

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

To be more specific, you should focus the following nodes in the pipline.config:

  1. fine_tune_checkpoint - 要用于进行迁移学习的原始模型的检查点.
  2. fine_tune_checkpoint_type - 定义检查点是否为分类/检测
  3. load_all_detection_checkpoint_vars - 如果 True - 那么会在训练开始前加载来自 fine_tune_checkpoint 的参数.
  4. freeze_variables - 如果您不想重新训练所有参数,您可以定义要冻结的变量.(在他们的原型文件中查看这些的完整文档object_detection/protos/train.proto) - https://github.com/tensorflow/models/blob/master/research/object_detection/protos/train.proto)
  1. fine_tune_checkpoint - checkpoint for the original model you want to use to do transfer learning.
  2. fine_tune_checkpoint_type - define whether the checkpoint is classification/detection
  3. load_all_detection_checkpoint_vars - if True - then the parameters from the fine_tune_checkpoint will be loaded before the start of the training.
  4. freeze_variables - in case you don't want to retrain all the parameters you can define which variables to freeze. ( see full documentation of these in their proto file 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

所有参数都将被加载和重新训练.

All parameters will be loaded and retrained.

这篇关于如何从头开始训练 ssd-mobilenet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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