read

Read data from randomPatchExtractionDatastore

Syntax

data = read(patchds)
[data,info] = read(patchds)

Description

data = read(patchds) returns a batch of data from a random patch extraction datastore, patchds. Subsequent calls to the read function continue reading from the endpoint of the previous call.

[data,info] = read(patchds) also returns information about the extracted data, including metadata, in info.

Input Arguments

collapse all

Random patch extraction datastore, specified as a randomPatchExtractionDatastore object. The datastore specifies a MiniBatchSize number of observations in each batch, and a numObservations total number of observations.

Output Arguments

collapse all

Output data, returned as a table with MiniBatchSize number of rows. The first variable is InputImage, which contains input image patches. If the network responses are images in an image datastore, then the second variable is ResponseImage. If the network responses are pixel label images in a pixel label datastore, then the second variable is ResponsePixelLabelImage.

For the last batch of data in the datastore patchds, if numObservations is not cleanly divisible by MiniBatchSize, then read returns a partial batch containing all the remaining observations in the datastore.

Information about read data, returned as a structure array. The structure array can contain the following fields.

Field NameDescription
RandomPatchRectanglesMiniBatchSize-by-4 numeric matrix. Each row specifies the size and position of the patch in the format [xywidthheight]. The elements define the x- and y-coordinate of the top left corner, and the width and height of the patch.
ImageIndicesMiniBatchSize-by-1 numeric vector that specifies the indices of the read images in the input datastores.
InputImageFilenameMiniBatchSize-by-1 cell array that specifies the fully resolved path containing the path string, name of the file, and file extension of each input image.
ResponseImageFilenameMiniBatchSize-by-1 cell array that specifies the fully resolved path containing the path string, name of the file, and file extension of each response image or pixel label image.

Introduced in R2018b