필터 지우기
필터 지우기

My trained network only shows 4 layers, Why can't I see the whole architecture?

조회 수: 4 (최근 30일)
Laraib
Laraib 2023년 7월 6일
답변: Jayant 2023년 7월 6일
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

답변 (1개)

Jayant
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.

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by