Loading saved model from keras importer

12 ビュー (過去 30 日間)
Khang
Khang 2023 年 4 月 6 日
編集済み: Nihal Reddy 2023 年 4 月 10 日
I tried to importing my model from a different computer using Matlab R022b. And then I got this error:
Error using nnet.internal.cnn.tensorflow.tf2mex
Invalid MEX-file
'C:\ProgramData\MATLAB\SupportPackages\R2022b\toolbox\nnet\supportpackages\keras_importer\+nnet\+internal\+cnn\+tensorflow\tf2mex.mexw64':
The file cannot be accessed by the system.
I used the same Matlab version with the same Deep learning toolbox

回答 (1 件)

Nihal Reddy
Nihal Reddy 2023 年 4 月 10 日
編集済み: Nihal Reddy 2023 年 4 月 10 日
I understand you are getting an error while trying to import model using Keras importer in MATLAB R2022b.
The error message is mostly likely due the model missing a file called 'keras_metadata.pb', it is caused by inappropiate way when saving the model in TensorFlow.
This is because the model is not a Saved Model (https://www.tensorflow.org/guide/saved_model). Please regenerate model and save model using
model.save
instead of
tf.saved_model.save
Thus, the 'keras_metadata.pb' will be included, and MATLAB should import the model successfully.
Currently, "importKerasNetwork"supports TensorFlow-Keras versions as follows:
  • The function fully supports TensorFlow-Keras versions up to 2.2.4.
  • The function offers limited support for TensorFlow-Keras versions 2.2.5 to 2.4.0.
Refer to the following documentation link for more information and examples-

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by