My trained network only shows 4 layers, Why can't I see the whole architecture?
2 次查看(过去 30 天)
显示 更早的评论
I am using following code to train inception V3 on my data
fpath='E:\Research Data\thesis';
data=fullfile(fpath,'E229A');
tdata=imageDatastore(data,'IncludeSubfolders',true,'LabelSource','foldernames');
net= inceptionv3;
layers=[imageInputLayer([229 229 3])
net(2:end-3)
fullyConnectedLayer(2)
softmaxLayer
classificationLayer
];
opt=trainingOptions("sgdm","MaxEpochs",30,'InitialLearnRate',0.001);
Incepv3=trainNetwork(tdata,layers,opt);
save('Incepv3.mat', 'Incepv3');
But when I load the trained network it only shows 4 layers as follows
load('Incepv3.mat', 'Incepv3');
>> fullLayers = Incepv3.Layers;
>> disp(fullLayers);
4×1 Layer array with layers:
1 'imageinput' Image Input 229×229×3 images with 'zerocenter' normalization
2 'fc' Fully Connected 5 fully connected layer
3 'softmax' Softmax softmax
4 'classoutput' Classification Output crossentropyex with 'BrownP' and 1 other classe
0 个评论
回答(1 个)
Jayant
2023-7-6
It seems that you are fine-tuning the Inception V3 network by replacing the last few layers with your own layers for classification. This modification might have caused the discrepancy in the displayed layers.
To verify the complete architecture, you can try accessing the layers of the original Inception V3 network
net = inceptionv3;
disp(net.Layers);
If you have made modifications to the network structure, it's possible that the displayed layers might differ. In that case, you can manually inspect the layers you have defined in your code to ensure that the desired modifications have been applied correctly.
To see the last three modified layers along with the rest of the network architecture, you can combine the layers from the loaded network (Incepv3) with the layers of the original Inception V3 network (net).
load('Incepv3.mat', 'Incepv3');
net = inceptionv3;
% Get the modified layers from Incepv3
modifiedLayers = Incepv3.Layers(end-2:end);
% Combine the modified layers with the rest of the network layers
fullLayers = [net.Layers; modifiedLayers];
% Display the complete network architecture
disp(fullLayers);
Hope this helps.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!