TF 目标识别 训练过程出现异常,麻烦谁帮忙看一下咋回事


D:\yuany\13 workspace\05 tensorflow\models\research>python object_detection/train.py --logtostderr --train_dir=E:/data --pipeline_config_path=E:/data/faster_rcnn_resnet101_pets.config
d:\ProgramData\Anaconda3\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype (float).type`.
  from ._conv import register_converters as _register_converters
WARNING:tensorflow:From D:\yuany\13 workspace\05 tensorflow\models\research\object_detection\trainer.py:262: 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:num_readers has been reduced to 0 to match input file shards.
Traceback (most recent call last):
  File "object_detection/train.py", line 183, in <module>
    tf.app.run ()
  File "d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py", line 126, in run
    _sys.exit (main (argv))
  File "object_detection/train.py", line 179, in main
    graph_hook_fn=graph_rewriter_fn)
  File "D:\yuany\13 workspace\05 tensorflow\models\research\object_detection\trainer.py", line 276, in train
    train_config.prefetch_queue_capacity, data_augmentation_options)
  File "D:\yuany\13 workspace\05 tensorflow\models\research\object_detection\trainer.py", line 59, in create_input_queue
    tensor_dict = create_tensor_dict_fn ()
  File "object_detection/train.py", line 120, in get_next
    dataset_builder.build (config)).get_next ()
  File "D:\yuany\13 workspace\05 tensorflow\models\research\object_detection\builders\dataset_builder.py", line 134, in build
    config.input_path [:], input_reader_config)
  File "D:\yuany\13 workspace\05 tensorflow\models\research\object_detection\builders\dataset_builder.py", line 80, in read_dataset
    sloppy=config.shuffle))
  File "d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 973, in apply
    dataset = transformation_func (self)
  File "d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\contrib\data\python\ops\interleave_ops.py", line 76, in _apply_fn
    buffer_output_elements, prefetch_input_elements)
  File "d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\data\ops\readers.py", line 130, in __init__
    cycle_length, block_length)
  File "d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 1959, in __init__
    super (InterleaveDataset, self).__init__(input_dataset, map_func)
  File "d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 1928, in __init__
    self._map_func.add_to_graph (ops.get_default_graph ())
  File "d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\function.py", line 484, in add_to_graph
    self._create_definition_if_needed ()
  File "d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\function.py", line 319, in _create_definition_if_needed
    self._create_definition_if_needed_impl ()
  File "d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\function.py", line 336, in _create_definition_if_needed_impl
    outputs = self._func (*inputs)
  File "d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 1916, in tf_map_func
    dataset = map_func (nested_args)
  File "d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\data\ops\readers.py", line 196, in __init__
    filenames = ops.convert_to_tensor (filenames, dtype=dtypes.string)
  File "d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1014, in convert_to_tensor
    as_ref=False)
  File "d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1104, in internal_convert_to_tensor
    ret = conversion_func (value, dtype=dtype, name=name, as_ref=as_ref)
  File "d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 947, in _TensorTensorConversionFunction
    (dtype.name, t.dtype.name, str (t)))
ValueError: Tensor conversion requested dtype string for Tensor with dtype float32: 'Tensor ("arg0:0", shape=(), dtype=float32)'

galosy 2018-7-11 12:26:43

看一下第一行第二行和最后一行的报错,应该是参数类型不对,你再核对一下你的命令行参数格式。


neverchange 发表于 2018-7-11 15:17:46

命令行参数如下:目录文件确保是存在的
python object_detection/train.py --logtostderr --train_dir=E:/data --pipeline_config_path=E:/data/faster_rcnn_resnet101_pets.config

D:\yuany\13 workspace\05 tensorflow\models\research>python object_detection/train.py --logtostderr --train_dir=E:/data --pipeline_config_path=E:/data/faster_rcnn_resnet101_pets.config
d:\ProgramData\Anaconda3\lib\site-packages\h5py_init_.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype (float).type.
from ._conv import register_converters as _register_converters
WARNING:tensorflow:From D:\yuany\13 workspace\05 tensorflow\models\research\object_detection\trainer.py:262: 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:num_readers has been reduced to 0 to match input file shards.
Traceback (most recent call last):
File “object_detection/train.py”, line 183, in
tf.app.run ()
File “d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py”, line 126, in run
_sys.exit (main (argv))
File “object_detection/train.py”, line 179, in main
graph_hook_fn=graph_rewriter_fn)
File “D:\yuany\13 workspace\05 tensorflow\models\research\object_detection\trainer.py”, line 276, in train
train_config.prefetch_queue_capacity, data_augmentation_options)
File “D:\yuany\13 workspace\05 tensorflow\models\research\object_detection\trainer.py”, line 59, in create_input_queue
tensor_dict = create_tensor_dict_fn ()
File “object_detection/train.py”, line 120, in get_next
dataset_builder.build (config)).get_next ()
File “D:\yuany\13 workspace\05 tensorflow\models\research\object_detection\builders\dataset_builder.py”, line 134, in build
config.input_path [:], input_reader_config)
File “D:\yuany\13 workspace\05 tensorflow\models\research\object_detection\builders\dataset_builder.py”, line 80, in read_dataset
sloppy=config.shuffle))
File “d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py”, line 973, in apply
dataset = transformation_func (self)
File “d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\contrib\data\python\ops\interleave_ops.py”, line 76, in _apply_fn
buffer_output_elements, prefetch_input_elements)
File “d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\data\ops\readers.py”, line 130, in init
cycle_length, block_length)
File “d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py”, line 1959, in init
super (InterleaveDataset, self).init(input_dataset, map_func)
File “d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py”, line 1928, in init
self._map_func.add_to_graph (ops.get_default_graph ())
File “d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\function.py”, line 484, in add_to_graph
self._create_definition_if_needed ()
File “d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\function.py”, line 319, in _create_definition_if_needed
self._create_definition_if_needed_impl ()
File “d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\function.py”, line 336, in _create_definition_if_needed_impl
outputs = self._func (*inputs)
File “d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py”, line 1916, in tf_map_func
dataset = map_func (nested_args)
File “d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\data\ops\readers.py”, line 196, in init
filenames = ops.convert_to_tensor (filenames, dtype=dtypes.string)
File “d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py”, line 1014, in convert_to_tensor
as_ref=False)
File “d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py”, line 1104, in internal_convert_to_tensor
ret = conversion_func (value, dtype=dtype, name=name, as_ref=as_ref)
File “d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py”, line 947, in _TensorTensorConversionFunction
(dtype.name, t.dtype.name, str (t)))
ValueError: Tensor conversion requested dtype string for Tensor with dtype float32: ‘Tensor (“arg0:0”, shape=(), dtype=float32)’

D:\yuany\13 workspace\05 tensorflow\models\research>


galosy 发表于 2018-7-11 15:46:07

这个 stack 和你贴子里的一样啊,train.py 是你自己写的吧,这个需要你自己 check 代码读取参数的部分,或者你贴出来这个文件,我帮你看看。你重点看看下面错误的定位。

Traceback (most recent call last):
  File "object_detection/train.py", line 183, in <module>
    tf.app.run ()
  File "d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py", line 126, in run
    _sys.exit (main (argv))
  File "object_detection/train.py", line 179, in main
    graph_hook_fn=graph_rewriter_fn)
  File "D:\yuany\13 workspace\05 tensorflow\models\research\object_detection\trainer.py", line 276, in train
    train_config.prefetch_queue_capacity, data_augmentation_options)
  File "D:\yuany\13 workspace\05 tensorflow\models\research\object_detection\trainer.py", line 59, in create_input_queue
    tensor_dict = create_tensor_dict_fn ()
  File "object_detection/train.py", line 120, in get_next
    dataset_builder.build (config)).get_next ()

neverchange 于 2018-7-12 08:48

object_detection/train.py,是 TensorFlow 里面的 model 模块里面的训练函数,不是我新写的


galosy 发表于 2018-7-12 17:13:15

有代码之类的嘛,,,目前看下来貌似是 tensor 构建的时候哪里写错了,,,但是没看到代码有点蛋疼


ViolinSolo 发表于 2018-7-13 15:52:43

开源的代码


galosy 发表于 2018-7-13 15:56:26

唔,为什么我翻了翻也没找到 train.py 我看你不是运行了

python object_detection/train.py -

嘛,为何我没找到呀,你是哪个版本的 tf 呢~


ViolinSolo 发表于 2018-7-13 16:13:12

看图,我用的 1.8 的 TF


galosy 发表于 2018-7-13 16:17:29

哈囧,我先研究下,是不是要切各分支什么的,给你看看我的。。。。


ViolinSolo 发表于 2018-7-13 16:23:06

晕了,你这个比我这边跑不起来问题还大,不过我换了个自己做的数据集,自己跑了个训练模型成功了,网上下载的数据集没跑起来。


galosy 发表于 2018-7-13 16:26:28

这个很尴尬了,我感觉他应该是改名字了,,虽然不知道怎么做到的,,明明更新时间都没变哈哈哈,emmm 自己的数据能用就好了,,,网上数据集跑不起来正常,,当然如果是那种很常见的公开数据集跑不起来就有点不正常了


ViolinSolo 发表于 2018-7-13 16:30:54