0

我将从以下提供的预训练模型中微调一些图像模型:https ://github.com/tensorflow/models/tree/master/research/slim

这是微调脚本的模板:

$ DATASET_DIR=/tmp/flowers
$ TRAIN_DIR=/tmp/flowers-models/inception_v3
$ CHECKPOINT_PATH=/tmp/my_checkpoints/inception_v3.ckpt
$ python train_image_classifier.py \
    --train_dir=${TRAIN_DIR} \
    --dataset_dir=${DATASET_DIR} \
    --dataset_name=flowers \
    --dataset_split_name=train \
    --model_name=inception_v3 \
    --checkpoint_path=${CHECKPOINT_PATH} \
    # Please notice the 2 lines below
    --checkpoint_exclude_scopes=InceptionV3/Logits,InceptionV3/AuxLogits \ 
    --trainable_scopes=InceptionV3/Logits,InceptionV3/AuxLogits

最后两行是我们要微调的层,上面的示例仅适用于 Inception 模型。

我想知道我们怎么知道这一层的确切名称InceptionV3/Logits呢?如果我对 ResNet 进行微调,我应该在模板中输入哪个名称?有没有一种正式的方法来获取网络图,以便知道所有层的名称?

4

1 回答 1

0

当您使用 slim 加载模型时,您应该有两个变量:网络的输出张量和网络组件的字典(这就是您要查找的内容)

这是一个简单的演示代码:

input_image = tf.placeholder('float32', [batch_size, image_size, image_size, 3])
net, end_points = inception.inception_v3(input_image)
于 2018-06-08T14:43:19.470 回答