read - Read data from label datastore - MATLAB (original) (raw)
Read data from label datastore
Syntax
Description
[C](#budsyj6-1-data) = read([ds](#d126e240924))
returns data from a pixel label datastore or box label datastore. Subsequent calls to the read
function continue reading from the endpoint of the previous call.
[[C](#budsyj6-1-data),[info](#budsyj6-1-info)] = read([ds](#d126e240924))
also returns information about the extracted data in info
, including metadata.
Input Arguments
Output Arguments
Output data, returned as an _M_-by-2 cell array, cell array of categorical matrices, or a table.
Datastore | Output Description |
---|---|
PixelLabelDatastore | Table with MiniBatchSize number of rows. For the last batch of data in the datastore,numObservations must be divisible by MiniBatchSize orread returns a partial batch containing all the remaining observations in the datastore. |
boxLabelDatastore | _N_-by-2 or_N_-by-3 cell matrix.N must be less than or equal toReadSize(ds).The first column can contain data, such as point cloud data for point cloud detectors, or images for object detectors.The second column must be a cell vector that contains _M_-by-5 matrices of bounding boxes in the format[xcenter,ycenter,width,height,_yaw_].The third column must be a cell vector that contains the label names corresponding to each bounding box. Label names are represented as an_M_-by-1 categorical vector. |
You can use the combine function to create a datastore to use for training.
combine(imds,blds)
— Combine images in animageDatastore with bounding boxes and labels in a boxLabelDatastore.combine(pxds,blds)
— Combine pixel data in a PixelLabelDatastore with bounding boxes and labels in a boxLabelDatastore.
For more information, see Datastores for Deep Learning (Deep Learning Toolbox).
Information about read data, returned as a structure array. The structure array can contain the following fields.
Datastore | Field Name | Description |
---|---|---|
PixelLabelDatastore | Filename | Fully resolved path containing the path string, name of the file, and file extension. ForPixelLabelDatastore objects whoseReadSize property is greater than 1, Filename is a cell array of file names corresponding to each image. |
FileSize | Total file size, in bytes. For MAT-files,FileSize is the total number of key-value pairs in the file. ForPixelLabelDatastore objects whose ReadSize property is greater than 1, FileSize is a vector of file sizes corresponding to each image. | |
boxLabelDatastore | CurrentIndex | Starting position of each read operation of the label data. |
ReadSize | ReadSize property of the datastore. |
Tips
read(ds)
returns an error if there is no more data in the input datastore,ds
. Usehasdata(ds)
withread(ds)
to avoid the error.
Version History
Introduced in R2017b