megengine.data#

>>> import megengine.data as data
>>> import megengine.data.transform as T

DataLoader#

DataLoader

Provides a convenient way to iterate on a given dataset.

Dataset#

Dataset

An abstract base class for all map-style datasets.

ArrayDataset

ArrayDataset is a dataset for numpy array data.

StreamDataset

An abstract class for stream data.

Vision Dataset#

VisionDataset

ImageFolder

ImageFolder is a class for loading image data and labels from a organized folder.

MNIST

MNIST dataset.

CIFAR10

Dataset for CIFAR10 meta data.

CIFAR100

Dataset for CIFAR100 meta data.

PascalVOC

Pascal VOC Dataset.

COCO

MS COCO Dataset.

Cityscapes

Cityscapes Dataset.

Objects365

Objects365 Dataset.

ImageNet

Load ImageNet from raw files or folder.

Sampler#

Sampler

An abstract base class for all Sampler

MapSampler

Sampler for map dataset.

StreamSampler

Sampler for stream dataset.

SequentialSampler

Sample elements sequentially.

RandomSampler

Sample elements randomly without replacement.

ReplacementSampler

Sample elements randomly with replacement.

Infinite

Infinite Sampler warper for basic sampler.

Transform#

Transform

Rewrite apply method in subclass.

PseudoTransform

Vision Transform#

VisionTransform

Base class of all transforms used in computer vision.

Compose

Composes several transfomations together.

TorchTransformCompose

Compose class used for transforms in torchvision, only support PIL image, some transforms with tensor in torchvision are not supported, such as Normalize and ToTensor in torchvision.

ToMode

Change input data to a target mode.

Pad

Pad the input data.

Resize

Resize the input data.

ShortestEdgeResize

Resize the input data with specified shortset edge.

RandomResize

Resize the input data randomly.

RandomCrop

Crop the input data randomly.

RandomResizedCrop

Crop the input data to random size and aspect ratio.

CenterCrop

Crops the given the input data at the center.

RandomHorizontalFlip

Horizontally flip the input data randomly with a given probability.

RandomVerticalFlip

Vertically flip the input data randomly with a given probability.

Normalize

Normalize the input data with mean and standard deviation.

GaussianNoise

Add random gaussian noise to the input data.

BrightnessTransform

Adjust brightness of the input data.

SaturationTransform

Adjust saturation of the input data.

ContrastTransform

Adjust contrast of the input data.

HueTransform

Adjust hue of the input data.

ColorJitter

Randomly change the brightness, contrast, saturation and hue of an image.

Lighting

Apply AlexNet-Style "lighting" augmentation to input data.

Collator#

Collator

Used for merging a list of samples to form a mini-batch of Tensor(s).