Error using trainNetwork (line 183) Invalid validation data. The output size (10) of the last layer does not match the number of classes (1).

조회 수: 2 (최근 30일)
layers = [
imageInputLayer([28 28 1]) %¹Ï¼h¿é¤Jpixel RGB or Grayscale
convolution2dLayer(3,8,'Padding','same') %²Ä¤@¼hconvolution pooling
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,16,'Padding','same') %²Ä¤G¼hconvolution pooling
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,32,'Padding','same')
batchNormalizationLayer
reluLayer
fullyConnectedLayer(10)
softmaxLayer
classificationLayer];

답변 (1개)

Anshika Chaurasia
Anshika Chaurasia 2021년 6월 16일
Hi,
This error can occur because the number of classes defined in the neural network layers is not equal to the number of classes (categories) of the validation data.
I would suggest you to match the outputSize of fullyConnectedLayer with the number of classes of the dataset.
Hope it helps!

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by