No pixel label data found - using the pixelLabelTrainingData function...

Hello!
I am working an image semantic segmentation project; I am using the pixelLabelTrainingData function to generate two datastores - one image datastore and the second a pixel datastore.
These are the steps I'm taking:
  1. Using the Image Labeler app to manually define pixel labels on a few images; output from this step is a gTruth object
  2. Use the gTruth object as input into pixelLabelTrainingData; output are two datastores - imds and pxdsTruth
  3. Here I will partition data, then create, train network.
BUT - I am stuck at step 2!
Error using pixelLabelTrainingData>sampleDataSource (line 175)
Unrecognized function or variable 'Error'.
No pixel label data found in any of the input ground truth objects.
Error in pixelLabelTrainingData (line 124)
sampleIndices = sampleDataSource(gTruth, labelDefs, samplingFactor);
Attached is the gTruth object I am using.... any help would be greatly appreciated!!

2 Kommentare

My guess would be that at line 175 of pixelLabelTrainingData that there is a call to Error() that should have been a call to error()
The error that it is trying to show would be
No pixel label data found in any of the input ground truth objects.
and the corrected line would be
error(message('vision:pixelLabelTrainingData:NoPixelLabelsInGroundTruth'));
This is line 193 for R2021b but could well be earlier for your R2020a.
Thank you for this. Any suggestion as to how I can use this information to solve my issue?
The error indicates that there is...
NoPixelLabelsInGroundTruth
... but the attached gTruthTraining.mat file DOES contain PixelLabel. Thanks again.

Melden Sie sich an, um zu kommentieren.

Antworten (3)

yes,sir,when load the mat file,all field is empty, please check,such as
a = load('gTruthSeq.mat');
Warning: The data source points to a directory that cannot be found.
'C:\CFP\building'
Update the DataSource using changeFilePaths method.
a.gTruth.LabelDefinitions
ans = 3×5 table
Name Type PixelLabelID Group Description ____________ __________ ____________ ________ ___________ {'Sky' } PixelLabel {[ 1]} {'None'} {0×0 char} {'Lawn' } PixelLabel {[ 2]} {'None'} {0×0 char} {'Building'} Rectangle {0×0 double} {'None'} {0×0 char}

6 Kommentare

Thank you for the response, I followed your advice and this is what I get:
>> load('gTruthTraining.mat')
>> a = load('gTruthTraining.mat');
>> a.gTruth.LabelDefinitions
ans =
2×6 table
Name Type LabelColor PixelLabelID Group Description
_______________ __________ _____________________________ ____________ ________________________ ___________
{'Part' } PixelLabel 0.46667 0.67451 0.18824 {[1]} {'AM_build_environment'} {0×0 char}
{'Build_plate'} PixelLabel 0.92941 0.69412 0.12549 {[2]} {'AM_build_environment'} {0×0 char}
Doesn't this table indicate that there IS pixel label data? - I don't quite understand what I am missing... :(
yes,sir,please use
a.gTruth.DataSource
get the label folder,such as
dataDir = fullfile(toolboxdir('vision'),'visiondata');
pxDir = fullfile(dataDir,'buildingPixelLabels');
winopen(pxDir);
then check the label file
Thank you. But what exactly do you mean by "then check the label file"? What exactly am I checking?
yes,sir,may be we check the label file,just make sure the label is valid,such as value 1--->label 1,value 2--->lablel 2
Okay:
View exported pixel label data
unlabeledImg = readimage(imdsTrain,1); % Unlabeled
imshow(unlabeledImg);
Define categories for each pixel value in labeledImg.
labelIDs = [gTruth.LabelDefinitions.PixelLabelID{1},gTruth.LabelDefinitions.PixelLabelID{2}];
labelCats = ["Part", "Build_plate"];
Construct a categorical matrix using the image and the definitions.
buildLabelCats = categorical(pixelLabeledImg,labelIDs,labelCats);
Display the categories overlaid on the image.
figure;
imshow(labeloverlay(unlabeledImg,buildLabelCats))
Doesn't all of this look "normal"? - I don't understand why the below function is not working?
[imds,pxdsTruth] = pixelLabelTrainingData(gTruth,'SamplingFactor',5,'WriteLocation','TrainingData\');
No pixel label data found in any of the input ground truth objects.
sampleIndices = sampleDataSource(gTruth, labelDefs, samplingFactor);
yes,sir,i think the gTruth.LabelData , labelDefs may be empty,please debug,such as

Melden Sie sich an, um zu kommentieren.

Chong Kian Chee
Chong Kian Chee am 5 Jan. 2022
Bearbeitet: Chong Kian Chee am 9 Jan. 2022

0 Stimmen

Hi, may I know if the issue is resolved? I am facing the same issue here!
%%%Updated on 8 January 2022%%
I hope this is stil helpful, the problem is due to the rectangle ROI which does not have PixelLabelID. This might due to the non-pixel labelling ROI that you had used to label ur dataset in the ImageLabeller. To convert this rectangle ROI into a pixel label with a pixel ID, refer to the link below:
https://www.mathworks.com/help/vision/ug/label-objects-using-polygons.html
Hope this resolve your issue , cheers :)
Jose Agustin Barrachina
Jose Agustin Barrachina am 28 Apr. 2022

0 Stimmen

Same issue here... Any insight? What is exactly the issue? My LabelData looks like the attached image. I only labeled one of the 3 images (because I only care about that one). Is that the issue?

Produkte

Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by