pixelLabelDatastore
Datastore for pixel label data
Description
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.
Creation
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
Syntax
Description
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 ReadSize
or
AlternateFileSystemRoots
properties. For image file
input, you can also use name-value pair arguments to set the
ReadFcn
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.
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.
Input Arguments
Properties
Object Functions
combine | Combine data from multiple datastores |
countEachLabel | Count occurrence of pixel or box labels |
hasdata | Determine if data is available to read from label datastore |
numpartitions | Number of partitions for label datastore |
partition | Partition label datastore |
preview | Read first row of data in datastore |
read | Read data from label datastore |
readall | Read all data in label datastore |
readimage | Read specified pixel label data file |
reset | Reset label datastore to initial state |
shuffle | Return shuffled version of label datastore |
transform | Transform datastore |
subset | Create subset of datastore or FileSet |
isPartitionable | Determine whether datastore is partitionable |
isShuffleable | Determine whether datastore is shuffleable |
Examples
Tips
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 thepixelLabelTrainingData
function.
Version History
Introduced in R2017b
See Also
Apps
- Image Labeler | Video Labeler | Medical Image Labeler (Medical Imaging Toolbox)