我在本教程https://github.com/samjabrahams/tensorflow-on-raspberry-pi
中按照“从Pip安装”成功安装了tensorflow到我的覆盆子pi 2我在may laptop上用对象图像(汽车,椅子,桌子,自行车)训练image_retraining项目并在pi 2上运行它。它在pi 2上正常工作
pi@raspberrypi:~/copy $ python label_image.py car.jpg
W tensorflow/core/framework/op_def_util.cc:332] Op BatchNormWithGlobalNormalization is deprecated. It will cease to work in GraphDef version 9. Use tf.nn.batch_normalization().
car (score = 0.99672)
bicycle (score = 0.00122)
chair (score = 0.00109)
table (score = 0.00097)
但是当我运行代码时,我会在笔记本电脑上使用字母图像进行训练。我有错误
pi@raspberrypi:~/luanvan $ python label_image.py 9_9.jpg
E tensorflow/core/common_runtime/executor.cc:334] Executor failed to create kernel. Invalid argument: NodeDef mentions attr 'Tdim' not in Op<name=ExpandDims; signature=input:T, dim:int32 -> output:T; attr=T:type>; NodeDef: ExpandDims = ExpandDims[T=DT_FLOAT, Tdim=DT_INT32, _device="/job:localhost/replica:0/task:0/cpu:0"](Cast, ExpandDims/dim)
[[Node: ExpandDims = ExpandDims[T=DT_FLOAT, Tdim=DT_INT32, _device="/job:localhost/replica:0/task:0/cpu:0"](Cast, ExpandDims/dim)]]
Traceback (most recent call last):
File "label_image.py", line 25, in <module>
{'DecodeJpeg/contents:0': image_data})
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 710, in run
run_metadata_ptr)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 908, in _run
feed_dict_string, options, run_metadata)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 958, in _do_run
target_list, options, run_metadata)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 978, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors.InvalidArgumentError: NodeDef mentions attr 'Tdim' not in Op<name=ExpandDims; signature=input:T, dim:int32 -> output:T; attr=T:type>; NodeDef: ExpandDims = ExpandDims[T=DT_FLOAT, Tdim=DT_INT32, _device="/job:localhost/replica:0/task:0/cpu:0"](Cast, ExpandDims/dim)
[[Node: ExpandDims = ExpandDims[T=DT_FLOAT, Tdim=DT_INT32, _device="/job:localhost/replica:0/task:0/cpu:0"](Cast, ExpandDims/dim)]]
Caused by op u'ExpandDims', defined at:
File "label_image.py", line 18, in <module>
_ = tf.import_graph_def(graph_def, name='')
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/importer.py", line 279, in import_graph_def
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2317, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1239, in __init__
self._traceback = _extract_stack()
我真的不明白。此命令"python new.py 9_9.jpg"
在我的笔记本电脑上正确运行,但在Pi 2上运行时会出现这些错误。
你介意帮我吗
谢谢