- 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!