next - Obtain next mini-batch of data from minibatchqueue - MATLAB (original) (raw)

Main Content

Obtain next mini-batch of data from minibatchqueue

Since R2020b

Syntax

Description

[[x1,...,xN]](#mw%5Fc8955962-56a0-4a34-9cde-35e7ce217114) = next([mbq](#mw%5F20bf032b-172b-4668-8896-9017402c8b3c%5Fsep%5Fmw%5F1052debc-abad-4547-9b2c-423b954fdb8a)) returns a mini-batch of data prepared using the minibatchqueue objectmbq. The function returns as many variables as the number of outputs ofmbq.

Examples

collapse all

Obtain Mini-Batch

Create a minibatchqueue object and obtain a mini-batch.

Create a minibatchqueue object from a datastore. Set theMiniBatchSize property to 2.

auimds = augmentedImageDatastore([100 100],digitDatastore); mbq = minibatchqueue(auimds,MiniBatchSize=2,MiniBatchFormat={'SSBC','BC'})

mbq = minibatchqueue with 2 outputs and properties:

Mini-batch creation: MiniBatchSize: 2 PartialMiniBatch: 'return' MiniBatchFcn: 'collate' PreprocessingEnvironment: 'serial'

Outputs: OutputCast: {'single' 'single'} OutputAsDlarray: [1 1] MiniBatchFormat: {'SSBC' 'BC'} OutputEnvironment: {'auto' 'auto'}

Use next to obtain a mini-batch. mbq has two outputs.

X is a mini-batch containing two images from the datastore.Y contains the classification labels of those images. Check the size and data format of the mini-batch variables.

size(X) dims(X) size(Y) dims(Y)

ans = 1×4
100 100 1 2 ans = 'SSCB' ans = 1×2
1 2 ans = 'CB'

Output Arguments

collapse all

[x1,...,xN] — Mini-batch

numeric array | cell array

Mini-batch, returned as a numeric array or cell array.

The number and type of variables returned by next depends on the configuration of mbq. The function returns as many variables as the number of outputs of mbq.

Version History

Introduced in R2020b