Add mini-batch support to datastore
MiniBatchable is an abstract mixin class that adds support for
mini-batches to your custom datastore for use with Neural Network
Toolbox™. A mini-batch datastore contains training and test data sets for use in
network training, prediction, and classification.
To use this mixin class, you must inherit from the
class in addition to inheriting from the
base class. Type the following syntax as the first line of your class definition
classdef MyDatastore < matlab.io.Datastore & ... matlab.io.datastore.MiniBatchable ... end
To add support for mini-batches to your datastore:
Inherit from an additional class
Define two additional properties:
For more details and steps to create your custom mini-batch datastore to optimize performance during training, prediction, and classification, see Develop Custom Mini-Batch Datastore.
MiniBatchSize— Number of observations in each batch
NumObservations— Total number of observations in the datastore
Total number of observations contained within the datastore. This number of observations is the length of one training epoch.
For information on class attributes, see Class Attributes (MATLAB).
Handle. To learn how handle classes affect copy operations, see Copying Objects (MATLAB).
You can use built-in mini-batch datastores to perform specific image preprocessing operations on each batch of data. For more information, see Advanced Image Preprocessing.