Main Content

read

Read data fromrandomPatchExtractionDatastore

Description

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

[data,info) =阅读(patchds)also returns information about the extracted data, including metadata, ininfo.

Input Arguments

collapse all

Random patch extraction datastore, specified as arandomPatchExtractionDatastoreobject. The datastore specifies aMiniBatchSizenumber of observations in each batch, and anumObservationstotal number of observations.

Output Arguments

collapse all

Output data, returned as a table withMiniBatchSizenumber of rows.

  • The first variable isInputImageand contains input image patches.

  • If the network responses are images in an image datastore, then the second variable isResponseImage.

  • If the network responses are pixel label images in a pixel label datastore, then the second variable isResponsePixelLabelImage.

Each column contains a cell array of patches of size determined byPatchSizeand the type of image data.

  • For 2-D single-channel images, the patches are sizem-byn, wheremspecifies the number of rows andnspecifies the number of columns in the patch.

  • For 2-D multi-channel images, the patches are sizem-byn-by-c, wherecspecifies the number of color channels of the patch.cis 3 for RGB images.

  • For 3-D single-channel volumetric images, the patches are sizem-byn-by-p, wherepspecifies the number of planes of the volume.

For the last batch of data in the datastorepatchds, ifnumObservations不是克丽nly divisible byMiniBatchSize, thenreadreturns 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 Name Description
RandomPatchRectangles MiniBatchSize-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.
ImageIndices MiniBatchSize-by-1 numeric vector that specifies the indices of the read images in the input datastores.
InputImageFilename MiniBatchSize-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.
ResponseImageFilename MiniBatchSize-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.

Version History

Introduced in R2018b