tensorflow.python.framework.errors_impl.AlreadyExistsError解决方案

tensorflow.python.framework.errors_impl.AlreadyExistsError: Another metric with the same name already exists.
这是tensorflow.keras和keras和tensorflow.python.keras的兼容问题
原本跟的代码为

from keras.layers import Input, Add, Conv2D, MaxPooling2D, UpSampling2D, Reshape
from keras.models import Model

改为下面这样就解决了,注意是tensorflow.python.keras不是tensorflow.keras!

from tensorflow.python.keras.layers import Input, Add, Conv2D, MaxPooling2D, UpSampling2D, Reshape
from tensorflow.python.keras.models import Model

你可能感兴趣的:(tensorflow,python,keras)