How to extract a new/truncated Ground Truth Object based only on a subset of the original pixel labeled images (simply by image sequential number, not Type or Group)

3 views (last 30 days)
We started pixel labeling 1000 images using the Image Labeler app, but ran out of resources after labeling only 500 images
So now our exported outputs include an exported Ground Truth object based nominally on 1000 images, but with pixel label data for only the first 500 images, and also a PixelLabelData exported folder based on data for just the first 500 images
We want to use a truncated Ground Truth object, and an associated truncated PixelLabelData folder, and a truncated image data folder (with only the first 500 images), for subsequent semantic segmentation work
How do we extract/export a new truncated Ground Truth object, and its associated truncated PixelLabelData folder, based only on the first 500 images?

Accepted Answer

Sanjana
Sanjana on 27 Oct 2023
Hi Ben,
I understand that you are trying to truncate the “GroundTruth” object and associated “PixelLabelData” folder so that they contain the information with respect to only the first 500 Images.
To achieve the above, you can truncate the “groundTruthDataSource” and the “LabelDefintions” objects in the groundTruth object obtained upon exporting labelled data from Image Labeler app.
Please refer to the following code to achieve the above,
%gTruth is the exported GroundTruth Object from the Image Labeler App
truncatedDataSource = groundTruthDataSource(gTruth.DataSource.Source(gTruth.DataSource(1:requiredNumberOfImages,:)));
truncatedLabelData = gTruth.LabelData(1:requiredNumberofImages,:);
truncatedgTruth = groundTruth(truncatedDataSource,gTruth.LabelDefinitions,truncatedLabelData)
Please refer to the following documentation for further information,
Hope this helps!
  1 Comment
Ben
Ben on 27 Oct 2023
Thank you so much Sanjana, this is a great answer and it works perfectly. Thanks for the additional links as well, you've been a great help
Ben

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!