tensorflow 模型不兼容

Posted lion-zheng

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tensorflow 模型不兼容相关的知识,希望对你有一定的参考价值。

[ERROR] [1533570199.196157]: bad callback: <bound method TLDetector.image_cb of <__main__.TLDetector object at 0x7f1fda105450>>
Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/home/novak/Carnd3/wow-now/ros/src/tl_detector/tl_detector.py", line 148, in image_cb
    light_wp, state = self.process_traffic_lights()
  File "/home/novak/Carnd3/wow-now/ros/src/tl_detector/tl_detector.py", line 317, in process_traffic_lights
    state = self.get_light_state(light)
  File "/home/novak/Carnd3/wow-now/ros/src/tl_detector/tl_detector.py", line 275, in get_light_state
    return self.light_classifier.get_classification(cv_image)
  File "/home/novak/Carnd3/wow-now/ros/src/tl_detector/light_classification/tl_classifier.py", line 69, in get_classification
    feed_dict={self.image_tensor: image_exp})
  File "/home/novak/tensorflow1.3/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 895, in run
    run_metadata_ptr)
  File "/home/novak/tensorflow1.3/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1124, in _run
    feed_dict_tensor, options, run_metadata)
  File "/home/novak/tensorflow1.3/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1321, in _do_run
    options, run_metadata)
  File "/home/novak/tensorflow1.3/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1340, in _do_call
    raise type(e)(node_def, op, message)
InvalidArgumentError: NodeDef mentions attr ‘identical_element_shapes‘ not in Op<name=TensorArrayV3; signature=size:int32 -> handle:resource, flow:float; attr=dtype:type; attr=element_shape:shape,default=<unknown>; attr=dynamic_size:bool,default=false; attr=clear_after_read:bool,default=true; attr=tensor_array_name:string,default=""; is_stateful=true>; NodeDef: Preprocessor/map/TensorArray = TensorArrayV3[clear_after_read=true, dtype=DT_FLOAT, dynamic_size=false, element_shape=<unknown>, identical_element_shapes=true, tensor_array_name="", _device="/job:localhost/replica:0/task:0/cpu:0"](Preprocessor/map/strided_slice). (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).
     [[Node: Preprocessor/map/TensorArray = TensorArrayV3[clear_after_read=true, dtype=DT_FLOAT, dynamic_size=false, element_shape=<unknown>, identical_element_shapes=true, tensor_array_name="", _device="/job:localhost/replica:0/task:0/cpu:0"](Preprocessor/map/strided_slice)]]

Caused by op u‘Preprocessor/map/TensorArray‘, defined at:
  File "/home/novak/Carnd3/wow-now/ros/src/tl_detector/tl_detector.py", line 327, in <module>
    TLDetector()
  File "/home/novak/Carnd3/wow-now/ros/src/tl_detector/tl_detector.py", line 67, in __init__
    self.light_classifier = TLClassifier(self.usingSimulator)
  File "/home/novak/Carnd3/wow-now/ros/src/tl_detector/light_classification/tl_classifier.py", line 35, in __init__
    tf.import_graph_def(od_graph_def, name=‘‘)
  File "/home/novak/tensorflow1.3/local/lib/python2.7/site-packages/tensorflow/python/framework/importer.py", line 313, in import_graph_def
    op_def=op_def)
  File "/home/novak/tensorflow1.3/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2630, in create_op
    original_op=self._default_original_op, op_def=op_def)
  File "/home/novak/tensorflow1.3/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1204, in __init__
    self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access

InvalidArgumentError (see above for traceback): NodeDef mentions attr ‘identical_element_shapes‘ not in Op<name=TensorArrayV3; signature=size:int32 -> handle:resource, flow:float; attr=dtype:type; attr=element_shape:shape,default=<unknown>; attr=dynamic_size:bool,default=false; attr=clear_after_read:bool,default=true; attr=tensor_array_name:string,default=""; is_stateful=true>; NodeDef: Preprocessor/map/TensorArray = TensorArrayV3[clear_after_read=true, dtype=DT_FLOAT, dynamic_size=false, element_shape=<unknown>, identical_element_shapes=true, tensor_array_name="", _device="/job:localhost/replica:0/task:0/cpu:0"](Preprocessor/map/strided_slice). (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).
     [[Node: Preprocessor/map/TensorArray = TensorArrayV3[clear_after_read=true, dtype=DT_FLOAT, dynamic_size=false, element_shape=<unknown>, identical_element_shapes=true, tensor_array_name="", _device="/job:localhost/replica:0/task:0/cpu:0"](Preprocessor/map/strided_slice)]]

以上是关于tensorflow 模型不兼容的主要内容,如果未能解决你的问题,请参考以下文章

TensorFlow:ValueError:形状不兼容

模型预测:不兼容的形状

请问下tensorflow2.0没有placeholder了吗,为啥我用1.9也有不兼容问题

TensorFlow 和 Cuda 不兼容

tensorflow兼容处理 tensorflow.compat.v1及module ‘tensorflow‘ has no attribute ‘reset_default_graph‘等问题汇总(

Colab 中的 TensorFlow 错误 - ValueError: Shapes (None, 1) 和 (None, 10) 不兼容