mindspore.dataset.vision

This module is to support vision augmentations. It includes two parts: c_transforms and py_transforms. C_transforms is a high performance image augmentation module which is developed with c++ opencv. Py_transforms provide more kinds of image augmentations which are developed with Python PIL.

Common imported modules in corresponding API examples are as follows:

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

mindspore.dataset.vision.c_transforms

mindspore.dataset.vision.c_transforms.AutoContrast

Apply automatic contrast on input image.

mindspore.dataset.vision.c_transforms.BoundingBoxAugment

Apply a given image transform on a random selection of bounding box regions of a given image.

mindspore.dataset.vision.c_transforms.CenterCrop

Crop the input image at the center to the given size.

mindspore.dataset.vision.c_transforms.ConvertColor

Change the color space of the image.

mindspore.dataset.vision.c_transforms.Crop

Crop the input image at a specific location.

mindspore.dataset.vision.c_transforms.CutMixBatch

Apply CutMix transformation on input batch of images and labels.

mindspore.dataset.vision.c_transforms.CutOut

Randomly cut (mask) out a given number of square patches from the input image array.

mindspore.dataset.vision.c_transforms.Decode

Decode the input image in RGB mode(default) or BGR mode(deprecated).

mindspore.dataset.vision.c_transforms.Equalize

Apply histogram equalization on input image.

mindspore.dataset.vision.c_transforms.GaussianBlur

Blur input image with the specified Gaussian kernel.

mindspore.dataset.vision.c_transforms.HorizontalFlip

Flip the input image horizontally.

mindspore.dataset.vision.c_transforms.HWC2CHW

Transpose the input image from shape (H, W, C) to shape (C, H, W).

mindspore.dataset.vision.c_transforms.Invert

Apply invert on input image in RGB mode.

mindspore.dataset.vision.c_transforms.MixUpBatch

Apply MixUp transformation on input batch of images and labels.

mindspore.dataset.vision.c_transforms.Normalize

Normalize the input image with respect to mean and standard deviation.

mindspore.dataset.vision.c_transforms.NormalizePad

Normalize the input image with respect to mean and standard deviation then pad an extra channel with value zero.

mindspore.dataset.vision.c_transforms.Pad

Pad the image according to padding parameters.

mindspore.dataset.vision.c_transforms.RandomAffine

Apply Random affine transformation to the input image.

mindspore.dataset.vision.c_transforms.RandomColor

Adjust the color of the input image by a fixed or random degree.

mindspore.dataset.vision.c_transforms.RandomColorAdjust

Randomly adjust the brightness, contrast, saturation, and hue of the input image.

mindspore.dataset.vision.c_transforms.RandomCrop

Crop the input image at a random location.

mindspore.dataset.vision.c_transforms.RandomCropDecodeResize

A combination of Crop, Decode and Resize.

mindspore.dataset.vision.c_transforms.RandomCropWithBBox

Crop the input image at a random location and adjust bounding boxes accordingly.

mindspore.dataset.vision.c_transforms.RandomHorizontalFlip

Randomly flip the input image horizontally with a given probability.

mindspore.dataset.vision.c_transforms.RandomHorizontalFlipWithBBox

Flip the input image horizontally randomly with a given probability and adjust bounding boxes accordingly.

mindspore.dataset.vision.c_transforms.RandomPosterize

Reduce the number of bits for each color channel to posterize the input image randomly with a given probability.

mindspore.dataset.vision.c_transforms.RandomResize

Resize the input image using a randomly selected interpolation mode.

mindspore.dataset.vision.c_transforms.RandomResizedCrop

Crop the input image to a random size and aspect ratio.

mindspore.dataset.vision.c_transforms.RandomResizedCropWithBBox

Crop the input image to a random size and aspect ratio and adjust bounding boxes accordingly.

mindspore.dataset.vision.c_transforms.RandomResizeWithBBox

Tensor operation to resize the input image using a randomly selected interpolation mode and adjust bounding boxes accordingly.

mindspore.dataset.vision.c_transforms.RandomRotation

Rotate the input image randomly within a specified range of degrees.

mindspore.dataset.vision.c_transforms.RandomSelectSubpolicy

Choose a random sub-policy from a policy list to be applied on the input image.

mindspore.dataset.vision.c_transforms.RandomSharpness

Adjust the sharpness of the input image by a fixed or random degree.

mindspore.dataset.vision.c_transforms.RandomSolarize

Randomly selects a subrange within the specified threshold range and sets the pixel value within the subrange to (255 - pixel).

mindspore.dataset.vision.c_transforms.RandomVerticalFlip

Randomly flip the input image vertically with a given probability.

mindspore.dataset.vision.c_transforms.RandomVerticalFlipWithBBox

Flip the input image vertically, randomly with a given probability and adjust bounding boxes accordingly.

mindspore.dataset.vision.c_transforms.Rescale

Rescale the input image with the given rescale and shift.

mindspore.dataset.vision.c_transforms.Resize

Resize the input image to the given size with a given interpolation mode.

mindspore.dataset.vision.c_transforms.ResizeWithBBox

Resize the input image to the given size and adjust bounding boxes accordingly.

mindspore.dataset.vision.c_transforms.Rotate

Rotate the input image by specified degrees.

mindspore.dataset.vision.c_transforms.SlicePatches

Slice Tensor to multiple patches in horizontal and vertical directions.

mindspore.dataset.vision.c_transforms.SoftDvppDecodeRandomCropResizeJpeg

A combination of Crop, Decode and Resize using the simulation algorithm of Ascend series chip DVPP module.

mindspore.dataset.vision.c_transforms.SoftDvppDecodeResizeJpeg

Decode and resize JPEG image using the simulation algorithm of Ascend series chip DVPP module.

mindspore.dataset.vision.c_transforms.UniformAugment

Perform randomly selected augmentation on input image.

mindspore.dataset.vision.c_transforms.VerticalFlip

Flip the input image vertically.

mindspore.dataset.vision.py_transforms

mindspore.dataset.vision.py_transforms.AutoContrast

Automatically maximize the contrast of the input PIL Image.

mindspore.dataset.vision.py_transforms.CenterCrop

Crop the central region of the input PIL Image with the given size.

mindspore.dataset.vision.py_transforms.Cutout

Randomly apply a given number of square patches of zeros to a location within the input numpy.ndarray image of shape (C, H, W).

mindspore.dataset.vision.py_transforms.Decode

Decode the input raw image to PIL Image format in RGB mode.

mindspore.dataset.vision.py_transforms.Equalize

Apply histogram equalization on the input PIL Image.

mindspore.dataset.vision.py_transforms.FiveCrop

Crop the given image into one central crop and four corners.

mindspore.dataset.vision.py_transforms.Grayscale

Convert the input PIL Image to grayscale.

mindspore.dataset.vision.py_transforms.HsvToRgb

Convert one or more numpy.ndarray images from HSV to RGB.

mindspore.dataset.vision.py_transforms.HWC2CHW

Transpose the input numpy.ndarray image of shape (H, W, C) to (C, H, W).

mindspore.dataset.vision.py_transforms.Invert

Invert the colors of the input PIL Image.

mindspore.dataset.vision.py_transforms.LinearTransformation

Transform the input numpy.ndarray image with a given square transformation matrix and a mean vector.

mindspore.dataset.vision.py_transforms.MixUp

Randomly mix up a batch of images together with its labels.

mindspore.dataset.vision.py_transforms.Normalize

Normalize the input numpy.ndarray image of shape (C, H, W) with the specified mean and standard deviation.

mindspore.dataset.vision.py_transforms.NormalizePad

Normalize the input numpy.ndarray image of shape (C, H, W) with the specified mean and standard deviation, then pad an extra channel filled with zeros.

mindspore.dataset.vision.py_transforms.Pad

Pad the input image on all sides with the given padding parameters.

mindspore.dataset.vision.py_transforms.RandomAffine

Apply random affine transformation to the input PIL Image.

mindspore.dataset.vision.py_transforms.RandomColor

Adjust the color balance of the input PIL Image by a random degree.

mindspore.dataset.vision.py_transforms.RandomColorAdjust

Randomly adjust the brightness, contrast, saturation, and hue of the input PIL Image.

mindspore.dataset.vision.py_transforms.RandomCrop

Crop the input PIL Image at a random location with the specified size.

mindspore.dataset.vision.py_transforms.RandomErasing

Randomly erase the pixels within a random selected rectangle region with a given probability.

mindspore.dataset.vision.py_transforms.RandomGrayscale

Randomly convert the input image into grayscale with a given probability.

mindspore.dataset.vision.py_transforms.RandomHorizontalFlip

Randomly flip the input image horizontally with a given probability.

mindspore.dataset.vision.py_transforms.RandomPerspective

Randomly apply perspective transformation to the input PIL Image with a given probability.

mindspore.dataset.vision.py_transforms.RandomResizedCrop

Randomly crop the image and resize it to a given size.

mindspore.dataset.vision.py_transforms.RandomRotation

Rotate the input PIL Image by a random angle.

mindspore.dataset.vision.py_transforms.RandomSharpness

Adjust the sharpness of the input PIL Image by a random degree.

mindspore.dataset.vision.py_transforms.RandomVerticalFlip

Randomly flip the input image vertically with a given probability.

mindspore.dataset.vision.py_transforms.Resize

Resize the input PIL Image to the given size.

mindspore.dataset.vision.py_transforms.RgbToHsv

Convert one or more numpy.ndarray images from RGB to HSV.

mindspore.dataset.vision.py_transforms.TenCrop

Crop the given image into one central crop and four corners plus the flipped version of these.

mindspore.dataset.vision.py_transforms.ToPIL

Convert the input decoded numpy.ndarray image to PIL Image.

mindspore.dataset.vision.py_transforms.ToTensor

Convert the input PIL Image or numpy.ndarray of shape (H, W, C) in the range [0, 255] to numpy.ndarray of shape (C, H, W) in the range [0.0, 1.0] with the desired dtype.

mindspore.dataset.vision.py_transforms.ToType

Convert the input numpy.ndarray image to the desired dtype.

mindspore.dataset.vision.py_transforms.UniformAugment

Uniformly select a number of transformations from a sequence and apply them sequentially and randomly, which means that there is a chance that a chosen transformation will not be applied.

mindspore.dataset.vision.utils

mindspore.dataset.vision.Border

Padding Mode, Border Type.

mindspore.dataset.vision.ImageBatchFormat

Data Format of images after batch operation.

mindspore.dataset.vision.Inter

Interpolation Modes.

mindspore.dataset.vision.SliceMode

Mode to Slice Tensor into multiple parts.