Error forming mini-batch for network input “input”. Data interpreted with format “SSCB”. To specify a different format, use the InputDataFormats option.
I am working on a binary classification of images.the code i am using is as follows.
In short, the ‘data’ file contains an image as 320*100*2 in its cell. 320 is width, 100 is height and 2 is channel (gmti is a name for channel 1, ref is a name for channel 2).
I have 290 images in total so ‘data’ is a 290*1 cell. 290 as batch, 320*100 as spece, 2 as channel. (SSCB)
For labels, I simply labeled then as double 0 or 1, and used num2str and converted it into categorical.
the error message is as such.
trainnet:
Error forming mini-batch for network input "input". Data interpreted with format "SSCB". To specify a different format, use the InputDataFormats option.
net_trained = trainnet(data,labels_cat, net,’crossentropy’,options);
Cause:
Cell array input supports sequence data only.
I tried changing input layer as sequence and making data format as 320*100*2*290 double. Did not work.
Exactly what is the proper data format should i use?
———————————————————————————————————-
clear
close all
for i = 1 : size(gmti, 1)
data{i,1}(:,:,1) = [gmti{i}];
data{i,1}(:,:,2) = [ref{i}];
end
mm = 1;
for i = size(gmti, 1) + 1 : size(gmti, 1) + size(gmti2, 1)
data{i,1}(:,:,1) = [gmti2{mm}];
data{i,1}(:,:,2) = [ref2{mm}];
mm = mm+1;
end
data2 = zeros(320, 100, 2, 290);
for i = 1 : size(data,1)
data2(:,:,:, i)=data{i, 1};
end
labels = [label; label2];
labels_cat = {};
for i =1 : size(labels, 1)
labels_cat{i, 1} = num2str(labels(i, 1));
end
labels_cat = categorical(labels_cat);
%%
% imds = imageDatastore(data, ‘Labels’,labels_cat);
%%
imageSize = [320 100 2];
numClasses = 2;
stackDepth = [3 4 23 3];
numFilters = [64 128 256 512];
net = resnetNetwork(imageSize,numClasses, …
StackDepth=stackDepth, …
NumFilters=numFilters);
% analyzeNetwork(net)
% net = replaceLayer(net, ‘input’, sequenceInputLayer(imageSize));
options = trainingOptions("sgdm", …
InitialLearnRate=0.01, …
MaxEpochs=100, …
Shuffle="every-epoch", …
Plots="training-progress", …
Verbose=false);
% InputDataFormats = "SSCB", …
%%
%%
net_trained = trainnet(data,labels_cat, net,’crossentropy’,options);I am working on a binary classification of images.the code i am using is as follows.
In short, the ‘data’ file contains an image as 320*100*2 in its cell. 320 is width, 100 is height and 2 is channel (gmti is a name for channel 1, ref is a name for channel 2).
I have 290 images in total so ‘data’ is a 290*1 cell. 290 as batch, 320*100 as spece, 2 as channel. (SSCB)
For labels, I simply labeled then as double 0 or 1, and used num2str and converted it into categorical.
the error message is as such.
trainnet:
Error forming mini-batch for network input "input". Data interpreted with format "SSCB". To specify a different format, use the InputDataFormats option.
net_trained = trainnet(data,labels_cat, net,’crossentropy’,options);
Cause:
Cell array input supports sequence data only.
I tried changing input layer as sequence and making data format as 320*100*2*290 double. Did not work.
Exactly what is the proper data format should i use?
———————————————————————————————————-
clear
close all
for i = 1 : size(gmti, 1)
data{i,1}(:,:,1) = [gmti{i}];
data{i,1}(:,:,2) = [ref{i}];
end
mm = 1;
for i = size(gmti, 1) + 1 : size(gmti, 1) + size(gmti2, 1)
data{i,1}(:,:,1) = [gmti2{mm}];
data{i,1}(:,:,2) = [ref2{mm}];
mm = mm+1;
end
data2 = zeros(320, 100, 2, 290);
for i = 1 : size(data,1)
data2(:,:,:, i)=data{i, 1};
end
labels = [label; label2];
labels_cat = {};
for i =1 : size(labels, 1)
labels_cat{i, 1} = num2str(labels(i, 1));
end
labels_cat = categorical(labels_cat);
%%
% imds = imageDatastore(data, ‘Labels’,labels_cat);
%%
imageSize = [320 100 2];
numClasses = 2;
stackDepth = [3 4 23 3];
numFilters = [64 128 256 512];
net = resnetNetwork(imageSize,numClasses, …
StackDepth=stackDepth, …
NumFilters=numFilters);
% analyzeNetwork(net)
% net = replaceLayer(net, ‘input’, sequenceInputLayer(imageSize));
options = trainingOptions("sgdm", …
InitialLearnRate=0.01, …
MaxEpochs=100, …
Shuffle="every-epoch", …
Plots="training-progress", …
Verbose=false);
% InputDataFormats = "SSCB", …
%%
%%
net_trained = trainnet(data,labels_cat, net,’crossentropy’,options); I am working on a binary classification of images.the code i am using is as follows.
In short, the ‘data’ file contains an image as 320*100*2 in its cell. 320 is width, 100 is height and 2 is channel (gmti is a name for channel 1, ref is a name for channel 2).
I have 290 images in total so ‘data’ is a 290*1 cell. 290 as batch, 320*100 as spece, 2 as channel. (SSCB)
For labels, I simply labeled then as double 0 or 1, and used num2str and converted it into categorical.
the error message is as such.
trainnet:
Error forming mini-batch for network input "input". Data interpreted with format "SSCB". To specify a different format, use the InputDataFormats option.
net_trained = trainnet(data,labels_cat, net,’crossentropy’,options);
Cause:
Cell array input supports sequence data only.
I tried changing input layer as sequence and making data format as 320*100*2*290 double. Did not work.
Exactly what is the proper data format should i use?
———————————————————————————————————-
clear
close all
for i = 1 : size(gmti, 1)
data{i,1}(:,:,1) = [gmti{i}];
data{i,1}(:,:,2) = [ref{i}];
end
mm = 1;
for i = size(gmti, 1) + 1 : size(gmti, 1) + size(gmti2, 1)
data{i,1}(:,:,1) = [gmti2{mm}];
data{i,1}(:,:,2) = [ref2{mm}];
mm = mm+1;
end
data2 = zeros(320, 100, 2, 290);
for i = 1 : size(data,1)
data2(:,:,:, i)=data{i, 1};
end
labels = [label; label2];
labels_cat = {};
for i =1 : size(labels, 1)
labels_cat{i, 1} = num2str(labels(i, 1));
end
labels_cat = categorical(labels_cat);
%%
% imds = imageDatastore(data, ‘Labels’,labels_cat);
%%
imageSize = [320 100 2];
numClasses = 2;
stackDepth = [3 4 23 3];
numFilters = [64 128 256 512];
net = resnetNetwork(imageSize,numClasses, …
StackDepth=stackDepth, …
NumFilters=numFilters);
% analyzeNetwork(net)
% net = replaceLayer(net, ‘input’, sequenceInputLayer(imageSize));
options = trainingOptions("sgdm", …
InitialLearnRate=0.01, …
MaxEpochs=100, …
Shuffle="every-epoch", …
Plots="training-progress", …
Verbose=false);
% InputDataFormats = "SSCB", …
%%
%%
net_trained = trainnet(data,labels_cat, net,’crossentropy’,options); deep learning, resnet, input, data, format, input format MATLAB Answers — New Questions