Semantic Segmentation without Data Store Object

Hi everyone, I have a problem using categorical response. I dont want to use data store object to prepare data. I have Itrn NxNx3XM image store and trn_gnd NxNx1xM pixel label matrix which each elements are 0 and 1; I translated numerical [0,1] to string "b","c" labels.
classNames = ["b","c"];
pxLayer = pixelClassificationLayer('Name','labels','ClassNames',classNames, 'ClassWeights', [1 20]);
lgraph = removeLayers(lgraph, 'pixelLabels');
lgraph = addLayers(lgraph, pxLayer);
lgraph = connectLayers(lgraph, 'softmax' ,'labels');
%%options specifications %%
trn_gnd_categ = categorical( trn_gnd,[0 1],{'b','c'});
net = trainNetwork(Itrn , trn_gnd_categ , lgraph, options)
But I get "Invalid training data. Y must be a vector of categorical responses. " error. I cant find where I'm wrong...

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Get Started with Statistics and Machine Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by