How to set a variable network name for CNNs with trainNetwork

1 回表示 (過去 30 日間)
Sven Windau
Sven Windau 2017 年 9 月 18 日
編集済み: Ramnarayan Krishnamurthy 2017 年 9 月 21 日
Hello everybody,
I'm building a CNN with Matlab and everything works just fine.
Is there any possibility though to set the name of the SeriesNetwork element from a variable?
Something like this:
networkName = 'myNetwork';
[networkName, trainInfo] = trainNetwork(myData, layers, options);
This would be very helpful since I could reuse the variable networkName globally in different scripts.
Hope I made my problem clear, thanks for your help.
Sven

回答 (1 件)

Ramnarayan Krishnamurthy
Ramnarayan Krishnamurthy 2017 年 9 月 21 日
編集済み: Ramnarayan Krishnamurthy 2017 年 9 月 21 日
When you use:
[networkName, trainInfo] = trainNetwork(myData, layers, options);
the networkName can be any variable you choose. For example:
[myNetwork, trainInfo] = trainNetwork(myData, layers, options);
Here, myNetwork is the trained network, returned as a SeriesNetwork object or a DAGNetwork object.
To re-use this variable, I would suggest saving the trained network as a MAT file. To do so:
save('filename','myNetwork');
The trained networked can then be reloaded and leveraged in other scripts by loading the saved MAT file:
load filename
Hope this helps!

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by