This problem related to Image processing and Deep learning using matlab.io.​datastore.​PixelLabel​Datastor

2 ビュー (過去 30 日間)
Chaymae
Chaymae 2025 年 7 月 24 日
回答済み: Aryan 2025 年 8 月 6 日
In fact, I'm trying to download the spectrogram images (as input data, collected in a folder) and their labels for each pixel (collected in another folder). This work is to train a deep learning model.
after compilation, an error is displayed.
the code:
clear
clc
imds = imageDatastore('....data\trainingSet\input','IncludeSubfolders',false,'FileExtensions','.png');
classNames = ["NR" "LTE" "Noise"];
pixelLabelID = [127 255 0];
pxdsTruth = pixelLabelDatastore('....\data\trainingSet\label',classNames,pixelLabelID,...
'IncludeSubfolders',false,'FileExtensions','.png');
tbl = countEachLabel(pxdsTruth);
frequency = tbl.PixelCount/sum(tbl.PixelCount);
figure
bar(1:numel(classNames),frequency)
grid on
xticks(1:numel(classNames))
xticklabels(tbl.Name)
xtickangle(45)
ylabel('Frequency')
[imdsTrain,pxdsTrain,imdsVal,pxdsVal] = helperSpecSensePartitionData(imds,pxdsTruth,[80 20]);
cdsTrain = combine(imdsTrain,pxdsTrain);
cdsVal = combine(imdsVal,pxdsVal);
imageSize = [256 256];
cdsTrain = transform(cdsTrain, @(data)preprocessTrainingData(data,imageSize));
cdsVal = transform(cdsVal, @(data)preprocessTrainingData(data,imageSize));
The Errror:
Error using matlab.io.datastore.PixelLabelDatastore/subset
Cannot access method 'subset' in class 'matlab.io.datastore.PixelLabelDatastore'.
Error in helperSpecSensePartitionData (line 25)
pxdsTrain = subset(pxds, shuffledIndices(1:numTrain));
Error in mainProgramSRNet (line 25)
[imdsTrain,pxdsTrain,imdsVal,pxdsVal] = helperSpecSensePartitionData(imds,pxdsTruth,[80 20]);
  3 件のコメント
Chaymae
Chaymae 2025 年 7 月 30 日
Thank you for the response,,,i tried with "Run as administrator" the error still the same.....and with commend do you mean "which -all subset" ?? can you tell me please when should i add it ?
Anjaneyulu Bairi
Anjaneyulu Bairi 2025 年 7 月 31 日
Run the command "which -all subset", in your MATLAB Command Window.

サインインしてコメントする。

回答 (1 件)

Aryan
Aryan 2025 年 8 月 6 日
Hi!
I understand that you are running into an error with the "subset" method in your code.
The issue is because the "subset" method for "PixelLabelDatastore" only exists in MATLAB R2021a and newer. If you are using an older version, that function just isn’t available.
Kindly refer to the following MathWorks documentation links for better understanding the functions used above:
Hope it helps!

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!