[求助]使用CUBEAI导入Keras模型出错Error

1647348463(1).jpg

错误如图所示,只弹出一个Error,但没错误信息,请教大佬该如何解决。

我的keras版本为2.8.0,训练模型的代码如下:

from keras.utils import np_utils
import numpy as np
np.random.seed(10)

from keras.datasets import mnist
(x_train_image, y_train_label), \
(x_test_image, y_test_label) = mnist.load_data()

x_Train = x_train_image.reshape(60000,784).astype('float32')
x_Test = x_test_image.reshape(10000,784).astype('float32')

x_Train_normalize = x_Train/255
x_Test_normalize = x_Test/255

y_Train_OneHot = np_utils.to_categorical(y_train_label)
y_Test_OneHot = np_utils.to_categorical(y_test_label)

from keras.models import Sequential  # 建立线性堆叠模型
from keras.layers import Dense

model = Sequential()
model.add(Dense(units=256,
                input_dim=784,
                kernel_initializer='normal',
                activation='relu'))
model.add(Dense(units=10,
                kernel_initializer='normal',
                activation='softmax'))

print(model.summary())

model.compile(loss='categorical_crossentropy',
              optimizer='adam', metrics=['accuracy'])

   
train_history = model.fit(x=x_Train_normalize,
                          y=y_Train_OneHot,validation_split=0.2,
                          epochs=10,batch_size=200,verbose=2)

model.save("C:/Users/Administrator/Desktop/model_keras.h5",save_format='keras')


已邀请:

seanoy

赞同来自:

已解决,keras版本应小于等于2.6.0


要回复问题请先登录注册