Import Keras network From Python to Matlab

42 次查看(过去 30 天)
Hi,
I want to import a trained TensorFlow Keras model from Python to Matlab. I already have a '.h5' file with this model, but I keep getting the error 'Keras network with multiple inputs or multiple outputs is not supported when one of the network inputs is sequential' when I use the function ImportKerasNetwork or ImportKerasLayers.
Is there any way in solving this? Or is there any other way to import this model into Matlab?

回答(1 个)

Sivylla Paraskevopoulou
You can try to import your TensorFlow model by using the importTensorFlowNetwork function, which is a newer function than importKerasNetwork and supports more options.
You have to save your .h5 model in the SavedModel format to import it by using the importTensorFlowNetwork function.
  6 个评论
Tristan Milleville
Tristan Milleville 2022-11-18
It seems that my network is bit too complicated to insert into Matlab. I will connect Matlab with Python and call the Python script from Matlab to run this model. This will be the easiest solution. Thank you for the support!
Sivylla Paraskevopoulou
编辑:Sivylla Paraskevopoulou 2022-11-18
You are welcome! For this workflow, you might find this GitHub example helpful: Image Classification in MATLAB Using TensorFlow.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Call Python from MATLAB 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by