I understand that you want to achieve incremental training of an already trained “segnetLayers” 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 “lgraph” from 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:
- This link will give you information about “segnetLayers” function, https://www.mathworks.com/help/vision/ref/segnetlayers.html
- This link describes about “layerGraph” that will help in building lost connections, https://www.mathworks.com/help/deeplearning/ref/nnet.cnn.layergraph.html
Since MATLAB does not recommend using “LayerGraph” and “segnetLayers” as they would be deprecated in the future, you can explore “dlnetwork”.
Hope this helps you!
