How can we convert SeriesNetwork to Network?

3 views (last 30 days)
Qilonz
Qilonz on 12 Jan 2019
Answered: Akshat on 29 Jan 2025
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

Answers (1)

Akshat
Akshat on 29 Jan 2025
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.

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!