Table Of Contents
Table Of Contents

mxnet.gluon.data.vision.datasets.ImageRecordDataset

class mxnet.gluon.data.vision.datasets.ImageRecordDataset(filename, flag=1, transform=None)[source]

A dataset wrapping over a RecordIO file containing images.

Each sample is an image and its corresponding label.

Parameters
  • filename (str) – Path to rec file.

  • flag ({0, 1}, default 1) – If 0, always convert images to greyscale. If 1, always convert images to colored (RGB).

  • transform (function, default None) –

    A user defined callback that transforms each sample. For example:

    transform=lambda data, label: (data.astype(np.float32)/255, label)
    

__init__(filename, flag=1, transform=None)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(filename[, flag, transform])

Initialize self.

transform(fn[, lazy])

Returns a new dataset with each sample transformed by the transformer function fn.

transform_first(fn[, lazy])

Returns a new dataset with the first element of each sample transformed by the transformer function fn.