请选择 进入手机版 | 继续访问电脑版

你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

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

[复制链接]
SeanOYZY 提问时间:2022-3-15 22:20 / 已解决


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

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

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

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

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

  9. x_Train_normalize = x_Train/255
  10. x_Test_normalize = x_Test/255

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

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

  15. model = Sequential()
  16. model.add(Dense(units=256,
  17.                 input_dim=784,
  18.                 kernel_initializer='normal',
  19.                 activation='relu'))
  20. model.add(Dense(units=10,
  21.                 kernel_initializer='normal',
  22.                 activation='softmax'))

  23. print(model.summary())

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

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

  30. model.save("C:/Users/Administrator/Desktop/model_keras.h5",save_format='keras')
复制代码
收藏 评论4 发布时间:2022-3-15 22:20

举报

4个回答
SeanOYZY 最优答案 回答时间:2022-3-18 22:44:53

已解决,keras版本应

鹿森 回答时间:2022-3-25 21:58:23
学习了!
lumos-ccc 回答时间:2022-6-23 15:42:53

SeanOYZY 发表于 2022-3-18 22:44
已解决,keras版本应

你好!我使用的是paddle模型转onnx,也遇到了这个问题,请问是onnx的版本要和cubemx对应还是什么,怎么查看对应关系啊!

SeanOYZY 回答时间:2022-7-20 19:59:29
lumos-ccc 发表于 2022-6-23 15:42
你好!我使用的是paddle模型转onnx,也遇到了这个问题,请问是onnx的版本要和cubemx对应还是什么,怎么查 ...

我没用过你这个哦,像我这个按理来说应该是keras和TensorFlow(backend)版本要兼容。
关于意法半导体
我们是谁
投资者关系
意法半导体可持续发展举措
创新和工艺
招聘信息
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
关注我们
st-img 微信公众号
st-img 手机版