TypeError:预期字符串,获取包含类型为“_Message”的张量的列表

时间:2017-11-30 07:58:57

标签: python tensorflow

Windows 7上的Python 3.6 (Jupyter笔记本)

我正在尝试加载标签csv文件。但它不能正常工作。 已经创建了csv文件。 (1列,570行)

我被谷歌搜索调试这个问题,但我找不到 这样的确切情况。

最后,我想用这个标签文件训练jpg文件。

model.py

中的

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-23-6c24000e9977> in <module>()
      1 imagename_queue = tf.train.string_input_producer(images, shuffle=False)
----> 2 labelname_queue = tf.train.string_input_producer([csv_label], shuffle=False)
      3 
      4 # print(type(labelname_queue))
      5 

C:\Anaconda3\lib\site-packages\tensorflow\python\training\input.py in string_input_producer(string_tensor, num_epochs, shuffle, seed, capacity, shared_name, name, cancel_op)
    218 
    219   with ops.name_scope(name, "input_producer", [string_tensor]) as name:
--> 220     string_tensor = ops.convert_to_tensor(string_tensor, dtype=dtypes.string)
    221     with ops.control_dependencies([
    222         control_flow_ops.Assert(

C:\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py in convert_to_tensor(value, dtype, name, preferred_dtype)
    609       name=name,
    610       preferred_dtype=preferred_dtype,
--> 611       as_ref=False)
    612 
    613 

C:\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py in internal_convert_to_tensor(value, dtype, name, as_ref, preferred_dtype)
    674 
    675         if ret is None:
--> 676           ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
    677 
    678         if ret is NotImplemented:

C:\Anaconda3\lib\site-packages\tensorflow\python\framework\constant_op.py in _constant_tensor_conversion_function(v, dtype, name, as_ref)
    119                                          as_ref=False):
    120   _ = as_ref
--> 121   return constant(v, dtype=dtype, name=name)
    122 
    123 

C:\Anaconda3\lib\site-packages\tensorflow\python\framework\constant_op.py in constant(value, dtype, shape, name, verify_shape)
    100   tensor_value = attr_value_pb2.AttrValue()
    101   tensor_value.tensor.CopyFrom(
--> 102       tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape))
    103   dtype_value = attr_value_pb2.AttrValue(type=tensor_value.tensor.dtype)
    104   const_tensor = g.create_op(

C:\Anaconda3\lib\site-packages\tensorflow\python\framework\tensor_util.py in make_tensor_proto(values, dtype, shape, verify_shape)
    374       nparray = np.empty(shape, dtype=np_dt)
    375     else:
--> 376       _AssertCompatible(values, dtype)
    377       nparray = np.array(values, dtype=np_dt)
    378       # check to them.

C:\Anaconda3\lib\site-packages\tensorflow\python\framework\tensor_util.py in _AssertCompatible(values, dtype)
    300     else:
    301       raise TypeError("Expected %s, got %s of type '%s' instead." %
--> 302                       (dtype.name, repr(mismatch), type(mismatch).__name__))
    303 
    304 

TypeError: Expected string, got list containing Tensors of type '_Message' instead.

我收到了这个错误

html

我该如何解决这个问题?

0 个答案:

没有答案