How to retrain segnet?

1 次查看(过去 30 天)
vipin xavior
vipin xavior 2018-2-28
编辑: Purvaja 2025-2-18
Hello there, i am trying to do an incremental training of segnet available in Matlab (train first on a small database and then use resultant net to train on larger data). This i am not able to do with segnet as resultant net is not trainable network format. Here is the code i used,
lgraph = segnetLayers(imageSize, numClasses, 4); net = trainNetwork(trainingData, lgraph, options); save seg_net net; % net = retrain(trainingData, net, options); %what to write in retrain?!

回答(1 个)

Purvaja
Purvaja 2025-2-6
编辑:Purvaja 2025-2-18
I understand that you want to achieve incremental training of an already trainedsegnetLayers model and train it on a different dataset.
We can approach this by first saving, loading and then converting it to layers since net.Layers” object does not retain the connections between layers. So, we will construct lost connections using “lgraphfrom the saved network and then use it for incremental training.
You can follow the given procedures:
  • Create the SegNet layers
lgraph = segnetLayers(imageSize,numClasses,2);
  • Train the network
net = trainNetwork(ds, lgraph, options);
  • Save the trained network
save('segnet.mat', 'net');
  • Load the saved network in another file
load('segnet.mat', 'net');
  • Reconstruct the layer graph from the loaded network
lgraph = layerGraph(net);
  • Incrementally train the network
net = trainNetwork(ds, lgraph, incrementalOptions);
For more clarification, the following documentation links would be helpful:
  1. This link will give you information about “segnetLayers” function, https://www.mathworks.com/help/vision/ref/segnetlayers.html
  2. This link describes about “layerGraphthat will help in building lost connections, https://www.mathworks.com/help/deeplearning/ref/nnet.cnn.layergraph.html
Since MATLAB does not recommend using “LayerGraph andsegnetLayers” as they would be deprecated in the future, you can exploredlnetwork.
Hope this helps you!

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by