Data format error with training a ResNet for semantic segmentation
이전 댓글 표시
I am trying to train a ResNet for the purpose of a pixel classification problem with two classes. The data consists of 256x256 RGB images, groundtruth is 256x256 Categorical. However there seems to be a conflict of data formats in regard to the final softmax layer of the network. Here is an excerpt from my code along with the error message.
input_size = [256 256 3];
numClasses = 2;
resNet = resnetNetwork(input_size, numClasses);
options = trainingOptions('adam', ...
'InitialLearnRate',1e-3, ...
'MaxEpochs',30, ...
'MiniBatchSize',64, ...
'Metrics','accuracy', ...
'Plots','training-progress', ...
'ValidationFrequency',25, ...
'ValidationData',validationData);
trainedResNetGreen = trainnet(trainingData,resNet,@(Y,T) modelLoss(Y,T,classWeights),options);
Error using trainnet (line 46)
Error forming mini-batch of targets for network output "softmax". Data interpreted with format "BC". To specify a different format,
use the TargetDataFormats option.
Error in ResNetGreen (line 37)
trainedLCUnetGreen = trainnet(trainingData,resNet,@(Y,T) modelLoss(Y,T,classWeights),options);
Caused by:
Batch dimension of datastore must match the format batch dimension (1).
I already tried to specify the Target Data Format as "SSBC" which corresponds to "Spatial, Spatial, Batch, Channel" but it did not fix the problem. Am I missing something?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!