问题

今天执行一个大牛的代码,报了好几个错误,然后有出现一个警告,然后我开始寻找解决办法。

Using TensorFlow backend.
WARNING: Logging before flag parsing goes to stderr.
W0802 12:33:26.441805 67068 deprecation_wrapper.py:119] From D:\tools\_virtualenv_dir\myproject_2_quchumasaike\env2_py36_quchumasaike\lib\site-packages\keras\backend\tensorflow_backend.py:74: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.

W0802 12:33:26.454814 67068 deprecation_wrapper.py:119] From D:\tools\_virtualenv_dir\myproject_2_quchumasaike\env2_py36_quchumasaike\lib\site-packages\keras\backend\tensorflow_backend.py:517: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

W0802 12:33:26.458796 67068 deprecation_wrapper.py:119] From D:\tools\_virtualenv_dir\myproject_2_quchumasaike\env2_py36_quchumasaike\lib\site-packages\keras\backend\tensorflow_backend.py:4138: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.

W0802 12:33:26.539761 67068 deprecation_wrapper.py:119] From D:\tools\_virtualenv_dir\myproject_2_quchumasaike\env2_py36_quchumasaike\lib\site-packages\keras\backend\tensorflow_backend.py:174: The name tf.get_default_session is deprecated. Please use tf.compat.v1.get_default_session instead.

W0802 12:33:26.539761 67068 deprecation_wrapper.py:119] From D:\tools\_virtualenv_dir\myproject_2_quchumasaike\env2_py36_quchumasaike\lib\site-packages\keras\backend\tensorflow_backend.py:181: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

W0802 12:33:26.585739 67068 deprecation_wrapper.py:119] From D:\tools\_virtualenv_dir\myproject_2_quchumasaike\env2_py36_quchumasaike\lib\site-packages\keras\backend\tensorflow_backend.py:1834: The name tf.nn.fused_batch_norm is deprecated. Please use tf.compat.v1.nn.fused_batch_norm instead.

W0802 12:33:27.051462 67068 deprecation_wrapper.py:119] From D:\tools\_virtualenv_dir\myproject_2_quchumasaike\env2_py36_quchumasaike\lib\site-packages\keras\backend\tensorflow_backend.py:2018: The name tf.image.resize_nearest_neighbor is deprecated. Please use tf.compat.v1.image.resize_nearest_neighbor instead.

W0802 12:33:27.818015 67068 deprecation_wrapper.py:119] From D:\tools\_virtualenv_dir\myproject_2_quchumasaike\env2_py36_quchumasaike\lib\site-packages\keras\optimizers.py:790: The name tf.train.Optimizer is deprecated. Please use tf.compat.v1.train.Optimizer instead.

在这里插入图片描述

解决方法

我找到一个问题连接:
https://github.com/keras-team/keras/issues/13004

先按里面有个说版本不对,测试换个tensorflow版本,
卸载已经安装的版本(我是已经为这个项目创建个虚拟环境,window系统,如果不会可以看我之前的博客,关于window虚拟环境的)

1、先卸载
pip uninstall tensorflow

2、安装1.5.0版本
pip install tensorflow==1.5.0

然后问题解决了,看看效果:

在这里插入图片描述
在这里插入图片描述