Error using trainNetwork (line 184) Invalid network. Error in one (line 38) trainedNet = trainNetwork(imdsTrain,layers,opts)
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to use the predefiend function of googlenet for image classification. But I am getting this error. please can anyone help me out of this.
numClasses = numel(categories(imdsTrain.Labels));
layers = [
layers
fullyConnectedLayer(numClasses,'WeightLearnRateFactor',20,'BiasLearnRateFactor',20)
softmaxLayer
classificationLayer];
%
% Create augmentedImageDatastore from training and test sets to resize
% images in imds to the size required by the network.
imageSize = net.Layers(1).InputSize;
augmentedTrainingSet = augmentedImageDatastore(imageSize, imdsTrain);
augmentedTestSet = augmentedImageDatastore(imageSize, imdsValidation);
%
opts = trainingOptions('sgdm','Plots','training-progress','ValidationData',augmentedTestSet, 'InitialLearnRate', 0.001, 'MaxEpochs', 10, 'MiniBatchSize', 64);
%trainedNet = trainNetwork(imdsTrain,layers,opts);
net = trainNetwork(augmentedTrainingSet, layers, opts);
predictedLabels = classify(net, augmentedTestSet);
testLabels = imdsValidation.Labels;
Error using trainNetwork (line 184)
Invalid network.
Error in one (line 38)
trainedNet = trainNetwork(imdsTrain,layers,opts);
Caused by:
Network: Too many output layers. The network must have one output layer.
Detected output layers:
layer 'output'
layer 147
Layer 'inception_3a-3x3_reduce': Input size mismatch. Size of input to this
layer is different from the expected input size.
Inputs to this layer:
from layer 'inception_3a-relu_1x1' (size 28(S) × 28(S) × 64(C) × 1(B))
Layer 'inception_3a-output': Unconnected input. Each layer input must be
connected to the output of another layer.
Detected unconnected inputs:
0 Kommentare
Antworten (1)
Divya Gaddipati
am 10 Mai 2021
You can refer to this example to know more about how to define a network for training:
0 Kommentare
Siehe auch
Kategorien
Mehr zu Image Data Workflows finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!