- which -all subset
This problem related to Image processing and Deep learning using matlab.io.datastore.PixelLabelDatastor
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (1개)
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!
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!