方法一:
vim ~/.keras/keras.json
修改 -backend:tensorflow/theano
若没有该文件,则添加如下内容:
"floatx": "float32",
"epsilon": 1e-07,
"backend": "TensorFlow",
"image_data_format": "channels_last"
方法二:
import os
os.environ['KERAS_BACKEND'] = 'tensorflow'
import keras.backend as K
K.set_image_dim_ordering('tf')