- Extract the layer architecture from the DAGNetwork object using layerGraph.
- Open the extracted layer graph in deepNetworkDesigner.
How to return a DAGNetwork to an editable state in deepNetworkDesigner?
6 次查看(过去 30 天)
显示 更早的评论
I started with a layer graph lgraph and opened it in a deepNetworkDesigner,
deepNetworkDesigner( lgraph )
The properties of the input (and other) layers are editable at this point,
After training however, I obtain net, a DAGNetwork object, and I find that it cannot be edited. Various properties, like the Normalization, are disabled,
deepNetworkDesigner( net )
My question is whether there is a way to recover, from the trained net object, the original LayerGraph in a form that is editable in deepNetworkDesigner.
0 个评论
采纳的回答
Shubh
2024-1-25
Hi Matt,
Yes, you can convert a trained DAGNetwork object back into an editable LayerGraph object in MATLAB. The DAGNetwork object, obtained after training your network, contains the architecture and the trained weights, but as you've observed, it's not directly editable in the deepNetworkDesigner.
To convert the DAGNetwork back into an editable LayerGraph, you can use the layerGraph function provided by MATLAB. This function extracts the layer architecture (without the trained weights) from the DAGNetwork object. Here's how you can do it:
Here is the complete code for this process:
% Assuming 'net' is your trained DAGNetwork object
% Extract the layer architecture from the trained network
lgraph = layerGraph(net);
% Open the extracted layer graph in the Deep Network Designer
deepNetworkDesigner(lgraph);
This code will open the Deep Network Designer with the architecture of your trained network, where you can edit the properties of the input and other layers. Note that the trained weights are not included in the lgraph, so any changes you make and subsequent retraining will start from the beginning, unless you explicitly initialize the layers with the weights from the trained network.
Hope this helps!
3 个评论
Shubh
2024-1-27
Hi Matt,
From the given screenshot, I can see some properties faded out. There must be an option called "Unlock Layer" in the bottom right of this dialog box. Can you confirm ?
This will enable the editing for these properties and well, but will delete all the layer's learnable parameters. This is due to the constraints imposed by the pre-trained weights. For example, changing the filter size or the number of filters in a convolutional layer would invalidate the learned weights for that layer, hence these parameters are locked.
If you need to modify these non-editable parameters, one other approach is to manually reconstruct the layer graph and reinitialize the layers where changes are required. Here's a process to do this:
- Extract the layer architecture and properties from the 'DAGNetwork'.
- Manually create a new 'LayerGraph' with the desired modifications.
- If needed, transfer the weights from the original network to the new one for layers that remain unchanged.
Let me know if the above pointers are of help!
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Custom Training Loops 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!