how to import training weights from Python to Matlab?
4 次查看(过去 30 天)
显示 更早的评论
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/683578/image.png)
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
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.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!