how to import training weights from Python to Matlab?

조회 수: 9 (최근 30일)
Gülin Sayal
Gülin Sayal 2021년 7월 13일
댓글: Gülin Sayal 2021년 7월 19일
Dear all,
I trained a reinforcement learning agent in Python using tensorflow 1.15 and saved the model in 3 files : save_net.ckpt.data-00000-of-00001
save_net.ckpt.index
save_net.ckpt.meta
The files, that I have saved through Python, are available in the attachment.
In Python I can simply load this model back, then input any observation set to get the action value that the trained agent chooses. However, I need to use Simulink for a closed loop simulation so I am trying to use these weight files in Matlab.
Do you have any suggestions about how I can use these three files in Matlab or Simulink in a way that I will input something and get the result for around 2000 time steps.
This is how I imagined in Simulink, the grey box needs to give actions by using the saved files and the input from the previous simulink block.
I would really appreciate any kind of help!
Best,
Gülin
  댓글 수: 4
Mudit Chaturvedi
Mudit Chaturvedi 2021년 7월 19일
Hello!
I understand you are trying to import training weights from Python to Matlab.
To my knowledge importing Tensorflow 1 weights directly into Matlab is not possible. You can convert the model from Tensorflow 1 to Tensorflow 2. (Refer to the limitations section in this link to know more about the exact versions of Tensorflow supported by the import function.) Tensorflow 2 weights can be imported into Matlab. Refer to this link to see how to do that.
Alternatively you can use importTensorFlowNetwork function however, this function is supported from R2021a onwards for TensorFlow 2.
Gülin Sayal
Gülin Sayal 2021년 7월 19일
Hi!
Thank you for the suggestions. I solved the problem by running the python code to select the actions over a matlab block in Simulink.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Deep Learning with Simulink에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by