mindspore.dataset.vision.Rescale

View Source On Gitee
class mindspore.dataset.vision.Rescale(rescale, shift)[source]

Rescale the input image with the given rescale and shift. This operation will rescale the input image with: output = image * rescale + shift.

Note

This operation is executed on the CPU by default, but it is also supported to be executed on the GPU or Ascend via heterogeneous acceleration.

Parameters
  • rescale (float) – Rescale factor.

  • shift (float) – Shift factor.

Raises
  • TypeError – If rescale is not of type float.

  • TypeError – If shift is not of type float.

Supported Platforms:

CPU GPU Ascend

Examples

>>> import mindspore.dataset as ds
>>> import mindspore.dataset.vision as vision
>>>
>>> image_folder_dataset = ds.ImageFolderDataset("/path/to/image_folder_dataset_directory")
>>> transforms_list = [vision.Decode(), vision.Rescale(1.0 / 255.0, -1.0)]
>>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list,
...                                                 input_columns=["image"])
Tutorial Examples: