How can we convert SeriesNetwork to Network?

2 次查看(过去 30 天)
Dear Guys,
I already have done some customized feedfarword networks which work on sound/speech processing with 'Network' type (processed by 'train' function). Then, I have tried to use an 'trainNetwork' function to train DNN (by ignoring lstmlayer) as well as LSTM. However, I do not have any idea how to utlize this object; like how to implement as Network object on my old project.
Is there anyway to convert SeriesNetwork to Network?
Thank you in advance,
Qilonz

回答(1 个)

Akshat
Akshat 2025-1-29
As far as I know, there is no way to convert a "SeriesNetwork" to "Network" via inbuilt methods.
As a workaround, you can try extracting the weights and biases of the "SeriesNetwork" and make a custom "Network" using a script like the following:
% Assume 'trainedNet' is your SeriesNetwork object
layers = trainedNet.Layers;
% Create a new Network object
net = network;
numLayers = numel(layers);
net.numLayers = numLayers;
for i = 1:numLayers
layer = layers(i);
% Example for a fully connected layer
if isa(layer, 'nnet.cnn.layer.FullyConnectedLayer')
% Set the layer size
net.layers{i}.size = layer.OutputSize;
% Set weights and biases
net.IW{i,1} = layer.Weights;
net.b{i} = layer.Bias;
end
% Add similar logic for other layer types
end
% Configure input and output settings
net.inputs{1}.size = size(layers(1).InputSize, 1);
net.outputs{numLayers}.size = layers(end).OutputSize;
% You will need to set up connections and transfer functions manually
Hope this helps your use case.

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by