Datastore for pixel label data
You can use a PixelLabelDatastore
object to read pixel
label data for semantic segmentation.
To read pixel label data from a PixelLabelDatastore
, use the
read
function. This function returns a categorical array that contains a categorical label
assigned to every (i,j) pixel location or
(i,j,k) voxel
location.
Create a PixelLabelDatastore
object using the
pixelLabelDatastore
function described here. Once the object is
created, you can use functions that access and manage the data. You can use dot notation
to modify the
and ReadSize
properties.ReadFcn
pxds = pixelLabelDatastore(
creates a gTruth
)PixelLabelDatastore
object from a groundTruth
object or an array of
groundTruth
objects.
pxds = pixelLabelDatastore(
creates a location
,classNames
,pixelLabelIDs
)PixelLabelDatastore
object from image files that
store pixel label data, in the folder or files specified by
location
. The function creates the object using pixel
IDs that map image pixel label values to class names.
pxds = pixelLabelDatastore(___,Name,Value)
creates a PixelLabelDatastore
object using name-value pair
arguments to set one or both of the
or
ReadSize
properties. For image
file input, you can also use name-value pair arguments to set the
AlternateFileSystemRoots
property or to specify options about
files to include in the datastore. You can specify multiple name-value pairs.
Enclose each property name in quotes.ReadFcn
For example,
pixelLabelDatastore(loc,names,ids,'ReadSize',8,'FileExtensions','png')
creates a pixel label datastore that includes only PNG images and that reads
eight images during each call to the read
function.
combine | Combine data from multiple datastores |
countEachLabel | Count occurrence of pixel or box labels |
hasdata | Determine if data is available to read from datastore |
numpartitions | Number of partitions for a datastore |
partition | Partition a label datastore |
preview | Read first row of data in datastore |
read | Read data from a datastore |
readall | Read all data in datastore |
readimage | Read specified pixel label data file |
reset | Reset datastore to initial state |
shuffle | Return shuffled version of datastore |
transform | Transform datastore |
subset | Create subset of datastore or file-set |
isPartitionable | Determine whether datastore is partitionable |
isShuffleable | Determine whether datastore is shuffleable |
A pixelLabelDatastore
stores files in lexicographical
order. For example, if you have twelve files named
'file1.jpg'
, 'file2.jpg'
, … ,
'file11.jpg'
, and 'file12.jpg'
, then
the files are stored in this
order:
'file1.jpg'
'file10.jpg'
'file11.jpg'
'file12.jpg'
'file2.jpg'
'file3.jpg'
...'file9.jpg'
In contrast, an imageDatastore
stores files in the order
they are added to the datastore. If you simultaneously read a ground truth image
and pixel label data, then you may encounter a mismatch between the images and
the labels. If this occurs, then rename the pixel label files so that they have
the correct order. For example, rename 'file1.jpg'
, … ,
'file9.jpg'
to 'file01.jpg'
, …,
'file09.jpg'
.
To extract semantic segmentation data from a groundTruth
object generated by the Video
Labeler app, use the pixelLabelTrainingData
function.
groundTruth
| ImageDatastore
| pixelLabelImageDatastore
| randomPatchExtractionDatastore
| semanticSegmentationMetrics