models icon indicating copy to clipboard operation
models copied to clipboard

Fine-tune Inception V3 with Tensorflow 0.12.1 failed

Open panovr opened this issue 9 years ago • 13 comments

Fine-tune Inception V3 with Tensorflow 0.12.1 failed.

Traceback (most recent call last):
  File "train_image_classifier.py", line 585, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 44, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "train_image_classifier.py", line 448, in main
    image = image_preprocessing_fn(image, train_image_size, train_image_size)
  File "/home/ylzhao/project/tensorflow-models/slim/preprocessing/preprocessing_factory.py", line 70, in preprocessing_fn
    image, output_height, output_width, is_training=is_training, **kwargs)
  File "/home/ylzhao/project/tensorflow-models/slim/preprocessing/inception_preprocessing.py", line 302, in preprocess_image
    return preprocess_for_train(image, height, width, bbox, fast_mode)
  File "/home/ylzhao/project/tensorflow-models/slim/preprocessing/inception_preprocessing.py", line 195, in preprocess_for_train
    tf.image_summary('image_with_bounding_boxes', image_with_box)
AttributeError: 'module' object has no attribute 'image_summary'
Traceback (most recent call last):
  File "eval_image_classifier.py", line 191, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 44, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "eval_image_classifier.py", line 128, in main
    image = image_preprocessing_fn(image, eval_image_size, eval_image_size)
  File "/home/ylzhao/project/tensorflow-models/slim/preprocessing/preprocessing_factory.py", line 70, in preprocessing_fn
    image, output_height, output_width, is_training=is_training, **kwargs)
  File "/home/ylzhao/project/tensorflow-models/slim/preprocessing/inception_preprocessing.py", line 304, in preprocess_image
    return preprocess_for_eval(image, height, width)
  File "/home/ylzhao/project/tensorflow-models/slim/preprocessing/inception_preprocessing.py", line 273, in preprocess_for_eval
    image = tf.sub(image, 0.5)
AttributeError: 'module' object has no attribute 'sub'
Traceback (most recent call last):
  File "eval_image_classifier.py", line 191, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 44, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "eval_image_classifier.py", line 128, in main
    image = image_preprocessing_fn(image, eval_image_size, eval_image_size)
  File "/home/ylzhao/project/tensorflow-models/slim/preprocessing/preprocessing_factory.py", line 70, in preprocessing_fn
    image, output_height, output_width, is_training=is_training, **kwargs)
  File "/home/ylzhao/project/tensorflow-models/slim/preprocessing/inception_preprocessing.py", line 304, in preprocess_image
    return preprocess_for_eval(image, height, width)
  File "/home/ylzhao/project/tensorflow-models/slim/preprocessing/inception_preprocessing.py", line 274, in preprocess_for_eval
    image = tf.mul(image, 2.0)
AttributeError: 'module' object has no attribute 'mul'
Traceback (most recent call last):
  File "eval_image_classifier.py", line 191, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 44, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "eval_image_classifier.py", line 139, in main
    logits, _ = network_fn(images)
  File "/home/ylzhao/project/models/slim/nets/nets_factory.py", line 105, in network_fn
    return func(images, num_classes, is_training=is_training)
  File "/home/ylzhao/project/models/slim/nets/inception_v3.py", line 481, in inception_v3
    depth_multiplier=depth_multiplier)
  File "/home/ylzhao/project/models/slim/nets/inception_v3.py", line 161, in inception_v3_base
    net = tf.concat(3, [branch_0, branch_1, branch_2, branch_3])
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 1053, in concat
    dtype=dtypes.int32).get_shape(
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 651, in convert_to_tensor
    as_ref=False)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 716, in internal_convert_to_tensor
    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/constant_op.py", line 176, in _constant_tensor_conversion_function
    return constant(v, dtype=dtype, name=name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/constant_op.py", line 165, in constant
    tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape))
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 367, in make_tensor_proto
    _AssertCompatible(values, dtype)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 302, in _AssertCompatible
    (dtype.name, repr(mismatch), type(mismatch).__name__))
TypeError: Expected int32, got list containing Tensors of type '_Message' instead.

panovr avatar Jan 25 '17 03:01 panovr

Yes, the image_summary has been moved to tf.summary.image. If you could send a PR for that, that would be great. thanks!

drpngx avatar Jan 25 '17 18:01 drpngx

@drpngx I realized that tf.image_summary -> tf.summary.image change. However, I still have no ideas of how to resolve the TypeError: Expected int32, got list containing Tensors of type '_Message' instead. error.

panovr avatar Jan 26 '17 02:01 panovr

Did you check the parameter order? I think we swapped them.

drpngx avatar Jan 26 '17 03:01 drpngx

I was getting a similar error. I reverted to TF 0.11 and got it resolved.

infomaniac777 avatar Jan 26 '17 05:01 infomaniac777

I had a similar issue, I found it was cause by the parameter order of concat. Changing to concat_v2 (which has other order ) as here seemed to work

da-steve101 avatar Jan 27 '17 03:01 da-steve101

Still waiting for @panovr

drpngx avatar Jan 27 '17 17:01 drpngx

Though I can run finetune_inception_v3_on_flowers.sh after some changes, the modifications is much more than estimated, and I'm a bit afraid that if my changes are correct. Personally, I will reverted to TF 0.11 until TF 1.0.0 released.

panovr avatar Jan 27 '17 21:01 panovr

OK. @da-steve101 , do you want to submit a PR?

drpngx avatar Jan 27 '17 23:01 drpngx

I resolved these issues by changing concat to concat_v2, replacing the operators by their new names and replacing image_summary, histogram_summary and scalar_summary with summary.image, summary.histogram, summary.scalar.

as6520 avatar Feb 02 '17 20:02 as6520

Hi everyone, I've just started playing with tensorflow through slim.

I've done exactly all the steps mentioned in this link: https://github.com/tensorflow/models/tree/master/slim

They suggest installing this binary: tensorflow-0.10.0rc0-cp27-none-linux_x86_64.whl which is tensorflow version 0.10

However, I am getting the same errors mentioned above. Replacing "image_summary" with "summary.image" worked but Replacing "concat" with "concat_v2" has not solve the problem. I am still getting: AttributeError: 'module' object has no attribute 'concat_v2'

It seems that there are incompatibilities between the current Slim and tensorflow. Should I wait for an updated version of slim?. Is there a tensorfolw version that works correctly with Slim? Can you please provide me with the link of that tensorflow binary?

Thanks

SihamTabik avatar Feb 23 '17 16:02 SihamTabik

Hi guys, have very similar problem, I already used tf_upgrade.py update our code, but it still has the error (dtype.name, repr(mismatch), type(mismatch).name)) TypeError: Expected int32, got list containing Tensors of type '_Message' instead.

anywang avatar Mar 07 '17 22:03 anywang

For TF 1.0 users, this upgrades inception and resnet_v2 for slim, which should help the situation. I tested training from scratch rather the fine-tune but this is much better than trying to run TF 1.0 on the current code. https://github.com/tensorflow/models/pull/1151

tfboyd avatar Mar 13 '17 17:03 tfboyd

Let me know other issues you having running TF 1.0. I can/will try to help with anything related to imagenet and these models because I happen to be in this code right now.

tfboyd avatar Mar 13 '17 17:03 tfboyd