read
Read data from label datastore
Description
Input Arguments
ds
— Input datastore
PixelLabelDatastore
object | boxLabelDatastore
object
Input datastore, specified as a PixelLabelDatastore
or a boxLabelDatastore
object.
Output Arguments
C
— Output data
cell array of categorical matrices | M-by-2 cell array | table
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 or
read 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 to
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 aboxLabelDatastore
.combine(pxds,blds)
— Combine pixel data in aPixelLabelDatastore
with bounding boxes and labels in aboxLabelDatastore
.
For more information, see Datastores for Deep Learning (Deep Learning Toolbox).
info
— Information about read data
structure array
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. For
PixelLabelDatastore objects whose
ReadSize 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,
| |
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
See Also
pixelLabelDatastore
| boxLabelDatastore
| readByIndex
| readall
| combine
Topics
- Datastores for Deep Learning (Deep Learning Toolbox)
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)