0

I'm going to finetune some of the image models from the pre-trained models provided in: https://github.com/tensorflow/models/tree/master/research/slim

Here is the template of the finetune script:

$ 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

The last 2 lines are the layers that we want to finetune, the above example is only for Inception model.

I wonder that how can we know the exact name of this layer like InceptionV3/Logits? And if I do finetune for ResNet, which name should I type in the template? Is there a formal way to get the graph of the net, in order to know all of the layer names?

Blurie
  • 148
  • 1
  • 2
  • 13
  • ALready answered in: https://stackoverflow.com/questions/50595658/what-are-input-and-output-node-names-in-inception-v3-with-slim-library/50598579#50598579 – Vijay Mariappan Jun 06 '18 at 10:28

1 Answers1

0

When you load your model with slim you should have the two variables: the output tensor of the network and a dictionary of the components of the network (which is what you are looking for)

This is a simple demo code:

input_image = tf.placeholder('float32', [batch_size, image_size, image_size, 3])
net, end_points = inception.inception_v3(input_image)
Laura López
  • 471
  • 1
  • 4
  • 12