- 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?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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,
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1597191/image.png)
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 )
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1597196/image.png)
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 Kommentare
Akzeptierte Antwort
Shubh
am 25 Jan. 2024
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 Kommentare
Shubh
am 27 Jan. 2024
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!
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Data Workflows finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!