Table Of Contents
Table Of Contents

ImageFolderDataset

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

A dataset for loading image files stored in a folder structure like:

root/car/0001.jpg
root/car/xxxa.jpg
root/car/yyyb.jpg
root/bus/123.jpg
root/bus/023.jpg
root/bus/wwww.jpg
Parameters:
  • root (str) – Path to root directory.
  • flag ({0, 1}, default 1) – If 0, always convert loaded images to greyscale (1 channel). If 1, always convert loaded images to colored (3 channels).
  • transform (callable, default None) – A function that takes data and label and transforms them:

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

synsets

List of class names. synsets[i] is the name for the integer label i

Type:list
items

List of all images in (filename, label) pairs.

Type:list of tuples
__init__(root, flag=1, transform=None)[source]

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

Methods

__init__(root[, 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.