필터 지우기
필터 지우기

How to save SeriesNetwork variables to file for quick loading next time?

조회 수: 2 (최근 30일)
I am using 'importKerasNetwork' to import my keras models for next step in MATLAB. However, I have tens of thousands of small models.
Can I have an approach to save the loaded variables (SeriesNetwork objects) to a file like .mat, so that I could load those models faster?
I have tried to save the workspace directly. But MATLAB 'save' seems only support variables in 'double' style.
Any ideas? Thank you for any help!
  댓글 수: 1
Kun Yang
Kun Yang 2022년 3월 21일
Absolutely I can import them every time when I need. But it takes me about 20 mins. I just wondering whether there is a faster way or not.

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

채택된 답변

yanqi liu
yanqi liu 2022년 3월 22일
yes,sir,may be use save to get mat file for target variable,such as
warning off all
modelfile = 'digitsDAGnet.h5';
net = importKerasNetwork(modelfile)
net =
DAGNetwork with properties: Layers: [13×1 nnet.cnn.layer.Layer] Connections: [13×2 table] InputNames: {'input_1'} OutputNames: {'ClassificationLayer_activation_1'}
save('net_for_load.mat', 'net')
d2 = load('net_for_load.mat');
d2.net
ans =
DAGNetwork with properties: Layers: [13×1 nnet.cnn.layer.Layer] Connections: [13×2 table] InputNames: {'input_1'} OutputNames: {'ClassificationLayer_activation_1'}
  댓글 수: 1
Kun Yang
Kun Yang 2022년 3월 22일
Thank you very much. I used right click to save the workspace but failed before. The command line 'save('xxx.mat', variable name)' works.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Gaussian Process Regression에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by