更新tensorflow版本
pip install --upgrade --ignore-installed tensorflow==x.x.x
旧版本0.x自动更新升级到2.0
https://blog.youkuaiyun.com/u012223913/article/details/79097297
tf_upgrade_v2 --infile ***.py --outfile ***_update.py #高版本自带
python tf_upgrade.py --intree InputDir --outtree OutputDir
tf_upgrade.py --intree InputDir --outtree OutputDir --copyotherfiles True
if __name__ == '__main__':
fileHandler = open('../report.html', mode='r', encoding='UTF-8')
report_lines = fileHandler.readlines()
for line in report_lines:
print(line.rstrip())
http://dljz.nicethemes.cn/news/show-241321.html
# import tensorflow.contrib.slim as slim
import tf_slim as slim
from tf_slim import losses
from tf_slim.nets import resnet_utils
from tf_slim.nets import resnet_v1
from tf_slim.nets.resnet_v1 import resnet_v1_block
问题:
tensorflow.python.framework.errors_impl.AlreadyExistsError: Another metric with the same name already exists.
#解决:安装指定版本的keras包,我安装的版本是2.6.0
#module 'tensorflow.python.pywrap_tensorflow' has no attribute 'NewCheckpointReader'
#解决:Use tf.compat.v1.train.NewCheckpointReader and it works.
AttributeError: module 'tensorflow' has no attribute 'ConfigProto'
config = tf.compat.v1.ConfigProto()
#AttributeError: module 'tensorflow' has no attribute 'reset_default_graph'
# tf.reset_default_graph()
tf.compat.v1.disable_v2_behavior()
#报错ValueError: Variable resnet_v1_101/conv1/weights already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope?
#AttributeError: module 'tensorflow' has no attribute 'Session'
tf.compat.v1.Session()
#AttributeError: module 'tensorflow._api.v2.train' has no attribute 'import_meta_graph'
#raise RuntimeError(“tf.placeholder() is not compatible with “ RuntimeError: tf.placeholder() is not
tf.compat.v1.disable_eager_execution()