更新时间:2022-11-02 18:46:13
解决方案是上述解决方法,它可以将后端导入为"k":
Solution was the workaround as described, which was to import backend as 'k':
train.py:
from keras import backend as K
#Other stuff...
model = Sequential()
model.add(Lambda(lambda x: K.tf.image.resize_images(x, (80, 160)), \
input_shape=(160, 320, 3))) #Resize 80x160x3
#Rest of model and training...
model.save('model.h5')
eval.py:
from keras import backend as K
#Other stuff...
model = load_model('model.h5') #Error is here