Import Keras Tensorflow Model into Simulink
28 ビュー (過去 30 日間)
古いコメントを表示
I've got a trained model from Python, which I need to run on Simulink for my application.
Is it possible to import trained Tensorflow Keras models and implement them in Simulink?
Cheers,
Lucas
0 件のコメント
採用された回答
sruthi gundeti
2020 年 9 月 12 日
Hi,
You can import your keras network using
net = importKerasNetwork(modelfile)
net = importKerasNetwork(modelfile,Name,Value)
model file can .h5 format ot json format with weights
Then write a entry level function for the imported network
function out = resnetFun(in)
persistent mynet;
if isempty(mynet)
mynet = coder.loadDeepLearningNetwork('resnet50', 'myresnet');
end
out = predict(mynet,in);
You can execute your MATLAB code from within the model to read the input data from your sensor and then pass this data into your Simulink block.
2 件のコメント
sruthi gundeti
2021 年 6 月 7 日
VxNet=importKerasNetwork('Network.json','WeightFile','Network.h5','OutputLayerType','regression')
This can import a regression network
その他の回答 (1 件)
Fernando Liozzi
2021 年 6 月 5 日
Hi,
Is it possible to use this method to generate code for a microcontroller in c / c ++? Thank you.
2 件のコメント
Fernando Liozzi
2021 年 6 月 5 日
Thanks, yes, is possible, my keras NN is working perfectly in a STM32!
Jie Li
2021 年 10 月 13 日
Hi, Fernando, Could you post how you put it in the simulink? My code says the importKerasNetwork cannot be used when complie.Thanks
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!