models icon indicating copy to clipboard operation
models copied to clipboard

InceptionV3 graph has tensor absence from ckpt

Open Zachary4biz opened this issue 6 years ago • 1 comments

System information

  • What is the top-level directory of the model you are using:
  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): MacOS Sierra 10.12.6
  • TensorFlow installed from (source or binary): pypi (binary i suppose?)
  • TensorFlow version (use command below): v1.15.0-rc3-22-g590d6eef7e 1.15.0
  • Bazel version (if compiling from source): -
  • CUDA/cuDNN version: no gpu
  • GPU model and memory: no gpu
  • Exact command to reproduce: see Source code part

Describe the problem

I just download the pre-train model, and try to restore it. error raised as follow, and reproducible case is provided too.

ckpt download from this page md5 of the inception_v3_2016_08_28.tar.gz: 0b7c5aaf2203128c5eb6216f3e25813c md5 of the inception_v3.ckpt: 5fd07d9834fe14479e4da82df9365ede

NotFoundError (full traceback in the last)

NotFoundError: Tensor name "InceptionV3/AuxLogits/Conv2d_2a_3x3/BatchNorm/beta" not found in checkpoint files ./tmp/CBIR/inception_v3.ckpt

my assumption?

I have used print_tensors_in_checkpoint_file to check all tensors in the .ckpt file, and there is no Tensor named like Conv2d_2a_3x3/BatchNorm/beta

I assume this is because somehow the implement of inception from tensorflow.contrib.slim.python.slim.nets does not match with the pre-trained model ?

maybe this implement has dropped 3x3 kernel while the model is outdated?

Source code / logs

reproducible case

from tensorflow.contrib.slim.python.slim.nets import inception
from tensorflow.contrib import slim
import tensorflow as tf
# ckpt download from https://github.com/tensorflow/models/blob/master/research/slim/README.md#pre-trained-models
# md5 of the inception_v3_2016_08_28.tar.gz: 0b7c5aaf2203128c5eb6216f3e25813c
# md5 of the inception_v3.ckpt: 5fd07d9834fe14479e4da82df9365ede
ckpt_fp = "./tmp/CBIR/inception_v3.ckpt"  
g = tf.Graph()
with g.as_default():
    sess = tf.Session(graph=g)
    input_image = tf.placeholder(dtype=tf.float32, shape=[None, 244, 244, 3], name="input")
    with slim.arg_scope(inception.inception_v3_arg_scope()):
        logits, end_points = inception.inception_v3(input_image, is_training=False)
    f_vec = end_points['PreLogits']  # (N, 2048)
    saver = tf.train.Saver()
    saver.restore(sess, ckpt_fp)

Traceback

traceback.txt

Zachary4biz avatar Nov 14 '19 10:11 Zachary4biz