Table Of Contents
Table Of Contents

mxnet.io

Data iterators for common data formats and utility functions.

Iterators

NDArrayIter(data[, label, batch_size, …])

Returns an iterator for mx.nd.NDArray, numpy.ndarray, h5py.Dataset mx.nd.sparse.CSRNDArray or scipy.sparse.csr_matrix.

CSVIter(*args, **kwargs)

b”Returns the CSV file iterator.nnIn this function, the data_shape parameter is used to set the shape of each line of the input data.nIf a row in an input file is 1,2,3,4,5,6` and data_shape is (3,2), that rownwill be reshaped, yielding the array [[1,2],[3,4],[5,6]] of shape (3,2).nnBy default, the CSVIter has round_batch parameter set to True.

LibSVMIter(*args, **kwargs)

b”Returns the LibSVM iterator which returns data with csrnstorage type.

MNISTIter(*args, **kwargs)

b’Iterating on the MNIST dataset.nnOne can download the dataset from http://yann.lecun.com/exdb/mnist/nnnnDefined in src/io/iter_mnist.cc:L265’

ImageDetRecordIter(*args, **kwargs)

b’Create iterator for image detection dataset packed in recordio.’

ImageRecordIter(*args, **kwargs)

b’Iterates on image RecordIO filesnnReads batches of images from .rec RecordIO files.

ImageRecordIter_v1(*args, **kwargs)

b’Iterating on image RecordIO filesnn..

ImageRecordUInt8Iter(*args, **kwargs)

b’Iterating on image RecordIO filesnnThis iterator is identical to ImageRecordIter except for using uint8 asnthe data type instead of float.nnnnDefined in src/io/iter_image_recordio_2.cc:L777’

ImageRecordUInt8Iter_v1(*args, **kwargs)

b’Iterating on image RecordIO filesnn..

Helper classes and functions

DataBatch(data[, label, pad, index, …])

A data batch.

DataDesc

DataDesc is used to store name, shape, type and layout information of the data or the label.

DataIter([batch_size])

The base class for an MXNet data iterator.

MXDataIter(handle[, data_name, label_name])

A python wrapper a C++ data iterator.

PrefetchingIter(iters[, rename_data, …])

Performs pre-fetch for other data iterators.

ResizeIter(data_iter, size[, reset_internal])

Resize a data iterator to a given number of batches.