bug1:
with tf.gfile.Open(image, "rb") as binfile:
AttributeError: module 'tensorflow' has no attribute 'gfile'
这里是因为tf.gfile.Open是1.x版本的,2.1版本的可以用:
with tf.io.gfile.GFile(image, "rb") as binfile:
bug2:
tf.placeholder()
tf.session()
等等
2.1版本下如果想继续使用可以修改为:
tf.compat.v1.placeholder()
tf.compat.v1.session()
注:即在tf. 后添加compat.v1.
但有些函数已经被Tensorflow弃用了^ -^,详见:https://tensorflow.google.cn/api_docs/python/tf/compat/v1