how to copy layers and connections from an existing neural network?

19 ビュー (過去 30 日間)
Jack Xiao
Jack Xiao 2018 年 7 月 11 日
編集済み: Jack Xiao 2018 年 7 月 12 日
just installed the latest version and find the support for deep learning is better and better. here, i have a question. I want to create a new network, but i do not want to write from scratch. take googlenet for example, I want to create a new network which can be a little like googlenet. but not all the same. maybe I need to refer some layers or structure. so how to copy layers and connections from an existing neural network?

回答 (1 件)

Von Duesenberg
Von Duesenberg 2018 年 7 月 11 日
Something along the lines (I had an exemple withe Alexnet, but the basic principle should be identical; here, I just resize the input layers because I have gray, not RGB, images, and I have 45 classes):
net = alexnet;
layers = net.Layers;
layers(1) = imageInputLayer([227, 227,1]);
layers(2) = convolution2dLayer([11, 11], 96,'Padding',0, 'Stride', 4, 'BiasLearnRateFactor',2);
layers(23) = fullyConnectedLayer(45);
layers(24) = softmaxLayer();
layers(25) = classificationLayer();
  1 件のコメント
Jack Xiao
Jack Xiao 2018 年 7 月 12 日
編集済み: Jack Xiao 2018 年 7 月 12 日
thanks, I make a mistake previously. my copy operation makes a struct not a Layer. maybe it is a common operation in matlab. take " layersKept = net.Layers(1:25) ; " for example, it is for copying. and for connection copy: connectionKept = net.Connections(1:27,1:2) ;

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by