Change parameters of network from Deep Network Designer
Afficher commentaires plus anciens
Hi,
I haven't been able to find the answer to this question in the boards, but perhaps I'm using the wrong terminology.
I designed a 2D Unet using the Deep Network Designer so that I could get a better understanding of how everything links together and the different parameters of each layer. I did the "generate code" option so that I can easily run the .mlx file and get my network.
Now I want a different Unet that has the same structure, but a different number of filters in the final convolution layer. I can manually edit the network using the Deep Network Designer, but I'd rather do this programmatically, however I get a read only error:
This is the final convolution layer from the Deep Network Designer
>> lgraph.Layers(76)
ans =
Convolution2DLayer with properties:
Name: 'conv_19'
Hyperparameters
FilterSize: [3 3]
NumChannels: 'auto'
NumFilters: 2
Stride: [1 1]
DilationFactor: [1 1]
PaddingMode: 'same'
PaddingSize: []
PaddingValue: 0
Learnable Parameters
Weights: []
Bias: []
This is the error that I get when changing the NumFilters
>> lgraph.Layers(76).NumFilters=6
Unable to set the 'NumFilters' property of class
'Convolution2DLayer' because it is read-only.
Can anyone offer any suggestions? I feel like I'm missing a simple step.
Thank you!
Réponse acceptée
Plus de réponses (1)
Sina Alizad
le 6 Sep 2022
0 votes
use this trick
1-save to a temp net
2-change props in the tmp net
3-load back and assemble the network
1)
tmp_net = lgraph.saveobj;
2)
tmp_net.Layers(2,1).Weights = w1;
tmp_net.Layers(2,1).Bias = b1;
3)
convnet = lgraph.loadobj(tmp_net);
convnet=assembleNetwork(convnet);
Catégories
En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!