For further clarification i dont believe my layers are the real issue as i have run it before without the weighted classes and got no issue it occurs when i try to add class weights to the classification layer and i am unsure why if i am using the function wrong
Using Weighted Classes in CNN
3 ビュー (過去 30 日間)
古いコメントを表示
In trying to set up my CNN layers with weighted classes I am getting an error that states:
"Error using classificationLayer>iParseInputArguments (line 58)
'ClassWeights' is not a recognized parameter. For a list of valid name-value pair arguments, see the
documentation for this function."
I am unsure if I'm using the class weights incorrectly. The following are the layers of my network:
classes = ["0","1"];
classWeights = 1./countcats(train_output);
classWeights = classWeights'/mean(classWeights);
layers = [
imageInputLayer([480 1 1])
convolution2dLayer([102 1],3,'Stride',1)
batchNormalizationLayer
leakyReluLayer
maxPooling2dLayer(2,'Stride',2,'Padding',[0 0 0 1])
convolution2dLayer([24 1],10,'Stride',1)
batchNormalizationLayer
leakyReluLayer
maxPooling2dLayer(2,'Stride',2,'Padding',[0 0 0 1])
convolution2dLayer([11 1],10,'Stride',1)
batchNormalizationLayer
leakyReluLayer
maxPooling2dLayer(2,'Stride',2,'Padding',[0 0 0 1])
convolution2dLayer([9 1],10,'Stride',1)
batchNormalizationLayer
leakyReluLayer
maxPooling2dLayer(2,'Stride',2,'Padding',[0 0 0 1])
fullyConnectedLayer(30)
fullyConnectedLayer(10)
fullyConnectedLayer(2)
softmaxLayer
classificationLayer('Classes',classes,'ClassWeights',classWeights)];
This error occurs with and without classes present in the brackets.
採用された回答
Rishik Ramena
2021 年 3 月 21 日
The 'ClassWeights' property for the classificationLayer has been introduced in MATLAB R2021a. So if you are running a version prior to this, you are supposed to get this error. Please find the documentation for your installed MATLAB version here.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Deep Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!