解决module 'tensorflow' has no attribute '...'系列
在tensflow调试过程中遇到的报错问题,整理了一下,可能不全,参考其他博文成功解决的方法。
都是由于tensflow版本问题的差别。
解决module ‘tensorflow’ has no attribute ‘reset_default_graph’
原代码:
import tensorflow as tf
tf.reset_default_graph()
更改为:
import tensorflow as tf
tf.compat.v1.reset_default_graph()
解决module ‘tensorflow’ has no attribute ‘Session’
原代码:
import tensorflow as tf
with tf.Session(graph=detection_graph) as sess:
更改为:
import tensorflow as tf
with tf.compat.v1.Session(graph=detection_graph) as sess:
解决module ‘tensorflow’ has no attribute ‘GraphDef’
od_graph_def = tf.compat.v1.GraphDef()
原代码:
import tensorflow as tf
od_graph_def = tf.GraphDef()
更改为:
import tensorflow as tf
od_graph_def = tf.compat.v1.GraphDef()