禁用keras中的日志

禁用keras中的日志,keras,Keras,每当我运行keras脚本时,总是会得到以下日志: Using TensorFlow backend. 2017-06-22 21:54:17.148220: 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

每当我运行keras脚本时,总是会得到以下日志:

Using TensorFlow backend.
2017-06-22 21:54:17.148220: 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.
2017-06-22 21:54:17.148242: 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.
2017-06-22 21:54:17.148246: 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.
2017-06-22 21:54:17.148249: W 
tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow 
library wasn't compiled to use AVX2 instructions, but these are 
available on your machine and could speed up CPU computations.
2017-06-22 21:54:17.148252: W 
tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow 
library wasn't compiled to use FMA instructions, but these are 
available on your machine and could speed up CPU computations.
2017-06-22 21:54:17.257119: I 
tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:901] successful 
NUMA node read from SysFS had negative value (-1), but there must be 
at least one NUMA node, so returning NUMA node zero
2017-06-22 21:54:17.257513: I 
tensorflow/core/common_runtime/gpu/gpu_device.cc:887] Found device 0 
with properties: 
name: GeForce GTX 850M
major: 5 minor: 0 memoryClockRate (GHz) 0.9015
pciBusID 0000:0a:00.0
Total memory: 3.95GiB
Free memory: 3.66GiB
2017-06-22 21:54:17.257528: I 
tensorflow/core/common_runtime/gpu/gpu_device.cc:908] DMA: 0 
2017-06-22 21:54:17.257533: I 
tensorflow/core/common_runtime/gpu/gpu_device.cc:918] 0:   Y 
2017-06-22 21:54:17.257539: I 
tensorflow/core/common_runtime/gpu/gpu_device.cc:977] Creating 
TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 850M, 
pci bus id: 0000:0a:00.0)
如何禁用这些日志?我在方法中添加了
verbose=0
,但似乎没有解决问题。这有什么办法可以解决吗
是否已解决?

您可以使用以下行

import os
import tensorflow as tf
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'

这是来自Tensorflow。你看过这个@rjmessibarca吗?上面的几行对我很有用。你能检查它的帮助并接受答案吗。你能提供你的tensorflow版本吗?我使用的是tensorflow gpu版本1.6.0,更多信息,我使用的是Keras 2.1.5上述解决方案是在tensorflow cpu版本1.4上测试的。请寻找gpu版本的解决方案。