mindspore.dataset.transforms

This module is to support common augmentations. C_transforms is a high performance augmentation module which is developed by C++. Py_transforms provides an optional implementation which is developed by Python & NumPy.

Common imported modules in corresponding API examples are as follows:

import mindspore.dataset as ds
import mindspore.dataset.vision.c_transforms as c_vision
import mindspore.dataset.vision.py_transforms as py_vision
from mindspore.dataset.transforms import c_transforms
from mindspore.dataset.transforms import py_transforms

Descriptions of common data processing terms are as follows:

  • TensorOperation, the base class of all data processing operations implemented in C++.

  • PyTensorOperation, the base class of all data processing operations implemented in Python.

mindspore.dataset.transforms.c_transforms

mindspore.dataset.transforms.c_transforms.Compose

Compose a list of transforms into a single transform.

mindspore.dataset.transforms.c_transforms.Concatenate

Tensor operation that concatenates all columns into a single tensor.

mindspore.dataset.transforms.c_transforms.Duplicate

Duplicate the input tensor to output, only support transform one column each time.

mindspore.dataset.transforms.c_transforms.Fill

Tensor operation to fill all elements in the tensor with the specified value.

mindspore.dataset.transforms.c_transforms.Mask

Mask content of the input tensor with the given predicate.

mindspore.dataset.transforms.c_transforms.OneHot

Tensor operation to apply one hot encoding.

mindspore.dataset.transforms.c_transforms.PadEnd

Pad input tensor according to pad_shape, input tensor needs to have same rank.

mindspore.dataset.transforms.c_transforms.RandomApply

Randomly perform a series of transforms with a given probability.

mindspore.dataset.transforms.c_transforms.RandomChoice

Randomly select one transform from a list of transforms to perform operation.

mindspore.dataset.transforms.c_transforms.Relational

Relationship operator.

mindspore.dataset.transforms.c_transforms.Slice

Slice operation to extract a tensor out using the given n slices.

mindspore.dataset.transforms.c_transforms.TypeCast

Tensor operation to cast to a given MindSpore data type.

mindspore.dataset.transforms.c_transforms.Unique

Perform the unique operation on the input tensor, only support transform one column each time.

mindspore.dataset.transforms.py_transforms

mindspore.dataset.transforms.py_transforms.Compose

Compose a list of transforms.

mindspore.dataset.transforms.py_transforms.OneHotOp

Apply one hot encoding transformation to the input label, make label be more smoothing and continuous.

mindspore.dataset.transforms.py_transforms.RandomApply

Randomly perform a series of transforms with a given probability.

mindspore.dataset.transforms.py_transforms.RandomChoice

Randomly select one transform from a series of transforms and applies that on the image.

mindspore.dataset.transforms.py_transforms.RandomOrder

Perform a series of transforms to the input PIL image in a random order.