本文介绍了如何使用Tensorflow的对象检测API修改训练中的冻结层?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在训练中使用



如图所示,权重不再具有 train 操作



通过为 freeze_variables 选择特定的模式,您可以非常灵活地冻结变量(可以从张量流图)。



Btw,是实际的过滤操作。


I am using Tensorflow's Object Detection API in training.

In which file, the freezed layers are defined to fine-tune the model in training.I need to experiment changing freezed layers in fine-tuning.

For example, if I use Resnet50 configuration, where I can change the freezed layers?

解决方案

That certainly you can do.

By reading the proto file for training, there is a field called freeze_variables, this is supposed to be a list containing all variables that you want to freeze, e.g. excluding them during the training.

Supposed you want to freeze the weights from the first bottleneck in the first unit of the first block, you can do it by adding

freeze_variables: ["resnet_v1_50/block1/unit_1/bottleneck_v1/conv1/weights"]

so your config flie looks like this:

train_config: {
  batch_size: 1
  freeze_variables: ["resnet_v1_50/block1/unit_1/bottleneck_v1/conv1/weights"]
  ...

You can verify that the weights are in fact freezed by checking the tensorflow graph.

As shown, the weights do not have train operation anymore.

By choosing specific patterns for freeze_variables, you can freeze variables very flexibly (you can get layer names from the tensorflow graph).

Btw, here is the actual filtering operation.

这篇关于如何使用Tensorflow的对象检测API修改训练中的冻结层?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 16:48
查看更多