把
from keras.utils import plot_model
改为
from keras.utils.vis_utils import plot_model
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
将scipy.imsc
改为
1 import imageio
2 content_image = imageio.imread
1. from keras.optimizers import adam_v2
2. adam_v2.Adam(lr=0.001, beta_1=XX, beta_2=XX, epsilon=XX)
tf.contrib.layers.xavier_initializer()
替换成
tf.keras.initializers.glorot_normal()
from keras.utils import to_categorical
替换为
from tensorflow.keras.utils import to_categorical
model = load_model('./models/tr_model.h5')
替换为
import tensorflow.compat.v1 as tf
tf.compat.v1.disable_v2_behavior() # model trained in tf1
model = tf.compat.v1.keras.models.load_model('./models/tr_model.h5')
# coding: UTF-8
或者
# coding: gkb
pip install Pillow
替代scipy.imread
content_image = imageio.imread
添加
import imageio