将from keras.utils import conv_utils
改为
from tensorflow.python.keras.utils import conv_utils
ImportError: no module named 'tensorflow.keras.engine
将from keras.engine.topology import Layer
改为
from tensorflow.python.keras.layers import Layer
AttributeError: module 'keras.backend' has no attribute 'set_session'. Did you mean: 'set_epsilon'?
出现这个错误主要是因为tensorflow2.0以上的版本已经没有set_session了,需改一下:
将
import keras.backend.tensorflow.backend as KTF
KTF.set_session(tf.Session(config=tf.compat.v1.ConfigProto(device_count={'gpu':0})))
改为
import tensorflow.python.keras.backend as KTF
KTF.set_session(tf.compat.v1.Session(config=tf.compat.v1.ConfigProto(device_count={'gpu':0})))