1.为了对比别人的方法,需要配置的环境为:Python 3.6.4,Keras 2.1.6,Tensorflow 1.7.0
在自己电脑上,anaconda3, 直接用原环境下的 tensorflow-gpu1.13.1 发现最开始的部分代码段可以运行,但无法保存model 的代码段不起作用,造成错误。
callbacks=[ModelCheckpoint(filepath=filepath_INCV, monitor='val_acc', verbose=1, save_best_only=INCV_save_best),
只好寻求安装虚拟环境,准备一模一样的设置。
2. 新开了一个虚拟环境,tf1.7.0, 刚开始没有安装成功,似乎是选用的python版本没有完全对应,删除环境后又重新开始,成功了。似乎如果用 conda install tensorflow-gpu=1.7.0 命令在线安装tensorflow 时,会自动安装所需的 cuda9.0 toolkit 以及 cudadnn 包。
然后运行 import tensorflow as tf 会报缺少 numpy 和 pandas 等包,依次是用 conda install 安装就好,其会自动安装对应可用的版本。
import tensorflow 时,还会报
/home/guixj/anaconda3/envs/tf1.7.0/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:458: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8= np.dtype([("qint8", np.int8, 1)])/home/guixj/anaconda3/envs/tf1.7.0/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:459: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8= np.dtype([("quint8", np.uint8, 1)])/home/guixj/anaconda3/envs/tf1.7.0/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:460: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16= np.dtype([("qint16", np.int16, 1)])/home/guixj/anaconda3/envs/tf1.7.0/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:461: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16= np.dtype([("quint16", np.uint16, 1)])/home/guixj/anaconda3/envs/tf1.7.0/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:462: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32= np.dtype([("qint32", np.int32, 1)])/home/guixj/anaconda3/envs/tf1.7.0/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:465: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource= np.dtype([("resource", np.ubyte, 1)])
不过这个不是太大问题,可以修改,也可以不改。
2019-12-24 10:12:41.915407: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2019-12-24 10:12:41.915435: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2019-12-24 10:12:41.915442: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2019-12-24 10:12:41.915447: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compi