pixelLabelImageSource
(Removed) Create datastore for semantic segmentation networks
pixelLabelImageSource
has been removed.
Create a datastore for semantic segmentation networks by using the imageDatastore
and pixelLabelDatastore
objects and the combine
function instead. For more information, see Version History.
Syntax
Description
returns a pixel label image datastore for training a semantic segmentation network
based on the input array of pximds
= pixelLabelImageSource(gTruth
)groundTruth
objects. Use the output
pixelLabelImageDatastore
object with the trainnet
(Deep Learning Toolbox) function to train convolutional neural networks for
semantic segmentation.
returns a pixel label image datastore based on the input image datastore and the
pixel label datastore objects. pximds
= pixelLabelImageSource(imds
,pxds
)imds
is an ImageDatastore
object that
represents the training input to the network. pxds
is a PixelLabelDatastore
object that represents the required network
output.
sets properties of the returned pixel label image datastore using name-value pairs.
You can specify multiple name-value pairs. Enclose each argument name in
quotes.pximds
= pixelLabelImageSource(___,Name,Value
)
Examples
Augment Data While Training Using PixelLabelImageSource
Configure a pixel label image datastore to augment data while
training. This example uses the pixelLabelImageSource
function to
create a pixel label image datastore object.
Load training images and pixel labels.
dataSetDir = fullfile(toolboxdir('vision'),'visiondata','triangleImages'); imageDir = fullfile(dataSetDir,'trainingImages'); labelDir = fullfile(dataSetDir,'trainingLabels');
Create an imageDatastore
object to hold the training
images.
imds = imageDatastore(imageDir);
Define the class names and their associated label IDs.
classNames = ["triangle","background"]; labelIDs = [255 0];
Create a pixelLabelDatastore
object to hold the ground truth
pixel labels for the training
images.
pxds = pixelLabelDatastore(labelDir, classNames, labelIDs);
Create an imageDataAugmenter
object to randomly rotate and
mirror image
data.
augmenter = imageDataAugmenter('RandRotation',[-10 10],'RandXReflection',true)
augmenter = imageDataAugmenter with properties: FillValue: 0 RandXReflection: 1 RandYReflection: 0 RandRotation: [-10 10] RandScale: [1 1] RandXScale: [1 1] RandYScale: [1 1] RandXShear: [0 0] RandYShear: [0 0] RandXTranslation: [0 0] RandYTranslation: [0 0]
Use the pixelLabelImageSource
function to create a
pixelLabelImageDatastore
object that can be used to train the
network with augmented
data.
plimds = pixelLabelImageSource(imds,pxds,'DataAugmentation',augmenter)
plimds = pixelLabelImageDatastore with properties: Images: {200x1 cell} PixelLabelData: {200x1 cell} ClassNames: {2x1 cell} DataAugmentation: [1x1 imageDataAugmenter] ColorPreprocessing: 'none' OutputSize: [] OutputSizeMode: 'resize' MiniBatchSize: 1 NumObservations: 200 DispatchInBackground: 0