frame

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

KeyError: "The name 'inputs:0' refers to a Tensor which does not exist. when compile mobilenet v1

Hello, guys. Now I retrained mobilenet v1 model to fine-tune it's output layer to 8 classes. It works well but when I tried to compile it into NCS graph some error happens and please help me.

For this model, I have ckpt files like model.ckpt.meta or model.ckpt.index and so on.
And in terminal, I use the command:
mvNCCompile ./model.ckpt-70310.meta -s 12 -in=inputs -on=MobilenetV1/Logits/Predictions -is 224 224 -o MobilenetV1.graph

and it outputs:
vNCCompile v02.00, Copyright @ Intel Corporation 2017

****** Info: No Weights provided. inferred path: ./model.ckpt-70310.data-00000-of-00001******
/home/meom/.local/lib/python3.5/site-packages/tensorflow/python/framework/tensor_util.py:499: DeprecationWarning: The binary mode of fromstring is deprecated, as it behaves surprisingly on unicode inputs. Use frombuffer instead
Traceback (most recent call last):
File "/usr/local/bin/mvNCCompile", line 206, in
create_graph(args.network, args.image, args.inputnode, args.outputnode, args.outfile, args.nshaves, args.inputsize, args.weights, args.explicit_concat, args.ma2480, args.scheduler, args.new_parser, args.cpp, args)
File "/usr/local/bin/mvNCCompile", line 185, in create_graph
load_ret = load_network(args, parser, myriad_config)
File "/usr/local/bin/ncsdk/Controllers/Scheduler.py", line 146, in load_network
parse_ret = parse_tensor(arguments, myriad_conf)
File "/usr/local/bin/ncsdk/Controllers/TensorFlowParser.py", line 225, in parse_tensor
inputTensor = graph.get_tensor_by_name(inputnode + ':0')
File "/home/meom/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 2733, in get_tensor_by_name
return self.as_graph_element(name, allow_tensor=True, allow_operation=False)
File "/home/meom/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 2584, in as_graph_element
return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
File "/home/meom/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 2626, in _as_graph_element_locked
"graph." % (repr(name), repr(op_name)))
KeyError: "The name 'inputs:0' refers to a Tensor which does not exist. The operation, 'inputs', does not exist in the graph."

Comments

  • 3 Comments sorted by Votes Date Added
  • I use slim in tensorflow model to fine-tune mobilenet v1.

  • @Meow10

    Just, there is no placeholder named "inputs".
    Please post the Python code used for training.

  • edited January 3 Vote Up0Vote Down

    @PINTO I modified the 'train_image_classifier.py' in tensorflow slim and used the script to train the mobilenet V1. The script is as follows:
    set -e

    PRETRAINED_CHECKPOINT_DIR=./checkpoints
    TRAIN_DIR=./models/mobilenet_v1_224
    DATASET_DIR=./data

    python train_image_classifier.py \
    --train_dir=${TRAIN_DIR} \
    --dataset_name=flowers \
    --dataset_split_name=train \
    --dataset_dir=${DATASET_DIR} \
    --model_name=mobilenet_v1 \
    --checkpoint_path=${PRETRAINED_CHECKPOINT_DIR} \
    --checkpoint_exclude_scopes=MobilenetV1/Logits \
    # --trainable_scopes=mobilenet_v1/Logits \
    --max_number_of_steps=100 \
    --batch_size=32 \
    --learning_rate=0.01 \
    --save_interval_secs=60 \
    --save_summaries_secs=60 \
    --log_every_n_steps=100 \
    --optimizer=rmsprop \
    --weight_decay=0.00004

    and the code for mobile V1 in slim is as follows:
    https://github.com/tensorflow/models/blob/master/research/slim/nets/mobilenet_v1.py

Sign In or Register to comment.