发生错误TypeError:无法将包含dtype <dtype:'int32'=“”>的张量的列表转换为<dtype:'float32'=“”>

时间:2018-12-25 12:05:48

标签: python tensorflow deep-learning computer-vision object-detection

我想制作自己的tensorflow对象检测api。使用本指南http://www.gradient-ascent.com/blog/2018/7/24/8tdkwi9iwmds0ws0e1fvhuauw8zxdt  当我想训练的时候,我遇到了这个错误。使用3个配置文件,但是 错误仍然存​​在。请帮帮我!

user@pc:~/anaconda3/lib/python3.6/site-packages/tensorflow/models$ python research/object_detection/train.py \
>     --logtostderr \
>     --train_dir=train \
>     --pipeline_config_path=ssd_mobilenet_v2_coco.config
WARNING:tensorflow:From /home/user/anaconda3/lib/python3.6/site-packages/tensorflow/models/research/object_detection/trainer.py:176: create_global_step (from tensorflow.contrib.framework.python.ops.variables) is deprecated and will be removed in a future version.
Instructions for updating:
Please switch to tf.train.create_global_step
WARNING:tensorflow:From /home/user/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/slim/python/slim/data/parallel_reader.py:242: string_input_producer (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by `tf.data`. Use `tf.data.Dataset.from_tensor_slices(string_tensor).shuffle(tf.shape(input_tensor, out_type=tf.int64)[0]).repeat(num_epochs)`. If `shuffle=False`, omit the `.shuffle(...)`.
.
.
.

很多警告(7-8)

Instructions for updating:
Use the `axis` argument instead
WARNING:tensorflow:From /home/user/anaconda3/lib/python3.6/site-packages/tensorflow/models/research/object_detection/core/batcher.py:96: batch (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by `tf.data`. Use `tf.data.Dataset.batch(batch_size)` (or `padded_batch(...)` if `dynamic_pad=True`).
Traceback (most recent call last):
  File "/home/user/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 455, in _apply_op_helper
    as_ref=input_arg.is_ref)
  File "/home/user/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1211, in internal_convert_n_to_tensor
    ctx=ctx))
  File "/home/user/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1146, in internal_convert_to_tensor
    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
  File "/home/user/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 971, in _autopacking_conversion_function
    return _autopacking_helper(v, dtype, name or "packed")
  File "/home/user/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 902, in _autopacking_helper
    elem))
TypeError: Cannot convert a list containing a tensor of dtype <dtype: 'int32'> to <dtype: 'float32'> (Tensor is: <tf.Tensor 'Preprocessor/stack_1:0' shape=(1, 3) dtype=int32>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "research/object_detection/train.py", line 198, in <module>
    tf.app.run()
  File "/home/user/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run
    _sys.exit(main(argv))
  File "research/object_detection/train.py", line 194, in main
    worker_job_name, is_chief, FLAGS.train_dir)
  File "/home/user/anaconda3/lib/python3.6/site-packages/tensorflow/models/research/object_detection/trainer.py", line 192, in train
    clones = model_deploy.create_clones(deploy_config, model_fn, [input_queue])
  File "/home/user/anaconda3/lib/python3.6/site-packages/tensorflow/models/research/slim/deployment/model_deploy.py", line 193, in create_clones
    outputs = model_fn(*args, **kwargs)
  File "/home/user/anaconda3/lib/python3.6/site-packages/tensorflow/models/research/object_detection/trainer.py", line 124, in _create_losses
    images = tf.concat(images, 0)
  File "/home/user/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1124, in concat
    return gen_array_ops.concat_v2(values=values, axis=axis, name=name)
  File "/home/user/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 1033, in concat_v2
    "ConcatV2", values=values, axis=axis, name=name)
  File "/home/user/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 483, in _apply_op_helper
    raise TypeError("%s that don't all match." % prefix)
TypeError: Tensors in list passed to 'values' of 'ConcatV2' Op have types [<NOT CONVERTIBLE TO TENSOR>, <NOT CONVERTIBLE TO TENSOR>, <NOT CONVERTIBLE TO TENSOR>, <NOT CONVERTIBLE TO TENSOR>, <NOT CONVERTIBLE TO TENSOR>, <NOT CONVERTIBLE TO TENSOR>, <NOT CONVERTIBLE TO TENSOR>, <NOT CONVERTIBLE TO TENSOR>,...] that don't all match.

我使用Tensoflow 1.12

0 个答案:

没有答案