Fixed chinese API

This commit is contained in:
liu-yongqi-63 2022-04-01 11:52:43 +08:00
parent feac726ec7
commit dcd8577b24
13 changed files with 68 additions and 52 deletions

View File

@ -5,6 +5,8 @@ mindspore.dataset.transforms.c_transforms.TypeCast
将输入的Tensor转换为指定的数据类型。
.. note:: 此操作支持通过 Offload 在 Ascend 或 GPU 平台上运行。
**参数:**
- **data_type** (mindspore.dtype) - 指定要转换的数据类型。

View File

@ -7,5 +7,5 @@ mindspore.dataset.vision.SliceMode
可选枚举值为SliceMode.PAD、SliceMode.DROP。
- **SliceMode.PAD** - 当Tensor无法进行整数切分时对剩余部分进行填充
- **SliceMode.DROP** - 当Tensor无法进行整数切分时对剩余部分进行丢弃
- **SliceMode.PAD** - 当图像无法进行整数块切分时,填充最后一个图像块至指定切分尺寸大小
- **SliceMode.DROP** - 当图像无法进行整数块切分时,丢弃最后一个图像块

View File

@ -5,6 +5,8 @@ mindspore.dataset.vision.c_transforms.HWC2CHW
将输入图像的shape从 <H, W, C> 转换为 <C, H, W>。输入图像应为 3 通道图像。
.. note:: 此操作支持通过 Offload 在 Ascend 或 GPU 平台上运行。
**异常:**
- **RuntimeError** - 如果输入图像的shape不是 <H, W, C>。

View File

@ -7,6 +7,8 @@ mindspore.dataset.vision.c_transforms.Normalize
此处理将使用以下公式对输入图像进行归一化output[channel] = (input[channel] - mean[channel]) / std[channel],其中 channel 代表通道索引channel >= 1。
.. note:: 此操作支持通过 Offload 在 Ascend 或 GPU 平台上运行。
**参数:**
- **mean** (sequence) - 图像每个通道的均值组成的列表或元组。平均值必须在 [0.0, 255.0] 范围内。

View File

@ -5,6 +5,8 @@ mindspore.dataset.vision.c_transforms.RandomColorAdjust
随机调整输入图像的亮度、对比度、饱和度和色调。
.. note:: 此操作支持通过 Offload 在 Ascend 或 GPU 平台上运行。
**参数:**
- **brightness** (Union[float, list, tuple], 可选) - 亮度调整因子。不能为负,默认值:(1, 1)。

View File

@ -34,7 +34,7 @@ mindspore.dataset.vision.c_transforms.RandomCrop
- **TypeError** - 如果 `size` 不是int或Sequence[int]类型。
- **TypeError** - 如果 `padding` 不是int或Sequence[int]类型。
- **TypeError** - 如果 `pad_if_needed` 不是bool类型。
- **TypeError** - 如果 `fill_value` 不是int或Sequence[int]类型。
- **TypeError** - 如果 `fill_value` 不是int或Tuple[int]类型。
- **TypeError** - 如果 `padding_mode` 不是 :class:`mindspore.dataset.vision.Border` 的类型。
- **ValueError** - 如果 `size` 不是正数。
- **ValueError** - 如果 `padding` 为负数。

View File

@ -32,7 +32,7 @@ mindspore.dataset.vision.c_transforms.RandomCropWithBBox
- **TypeError** - 如果 `size` 不是int或Sequence[int]类型。
- **TypeError** - 如果 `padding` 不是int或Sequence[int]类型。
- **TypeError** - 如果 `pad_if_needed` 不是bool类型。
- **TypeError** - 如果 `fill_value` 不是int或Sequence[int]类型。
- **TypeError** - 如果 `fill_value` 不是int或Tuple[int]类型。
- **TypeError** - 如果 `padding_mode` 不是 :class:`mindspore.dataset.vision.Border` 的类型。
- **ValueError** - 如果 `size` 不是正数。
- **ValueError** - 如果 `padding` 为负数。

View File

@ -5,6 +5,8 @@ mindspore.dataset.vision.c_transforms.RandomHorizontalFlip
对输入图像按给定的概率进行水平随机翻转。
.. note:: 此操作支持通过 Offload 在 Ascend 或 GPU 平台上运行。
**参数:**
- **prob** (float, 可选) - 图像被翻转的概率,必须在 [0, 1] 范围内, 默认值0.5。

View File

@ -3,7 +3,7 @@ mindspore.dataset.vision.c_transforms.RandomPosterize
.. py:class:: mindspore.dataset.vision.c_transforms.RandomPosterize(bits=(8, 8))
随机减少输入图像每个RGB通道的位数。
随机减少输入图像每个颜色通道的位数。
**参数:**

View File

@ -5,6 +5,8 @@ mindspore.dataset.vision.c_transforms.RandomSharpness
在固定或随机的范围调整输入图像的锐度。度数为0.0时将返回模糊图像度数为1.0时将返回原始图像度数为2.0时将返回锐化图像。
.. note:: 此操作支持通过 Offload 在 Ascend 或 GPU 平台上运行。
**参数:**
- **degrees** (Union[list, tuple], 可选) - 锐度调整度的随机选取范围,按照(min, max)顺序排列。如果min与max相等那么它是一个单一的固定锐度调整操作默认值(0.1, 1.9)。

View File

@ -5,6 +5,8 @@ mindspore.dataset.vision.c_transforms.RandomVerticalFlip
以给定的概率对输入图像在垂直方向进行随机翻转。
.. note:: 此操作支持通过 Offload 在 Ascend 或 GPU 平台上运行。
**参数:**
- **prob** (float, 可选) - 图像被翻转的概率默认值0.5。

View File

@ -5,6 +5,8 @@ mindspore.dataset.vision.c_transforms.Rescale
基于给定的缩放和平移因子调整图像的尺寸大小。输出图像的尺寸大小为output = image * rescale + shift。
.. note:: 此操作支持通过 Offload 在 Ascend 或 GPU 平台上运行。
**参数:**
- **rescale** (float) - 缩放因子。

View File

@ -335,7 +335,7 @@ class CenterCrop(ImageTensorOperation):
The size value(s) must be larger than 0.
Raises:
TypeError: If `size` is not of type integer or sequence.
TypeError: If `size` is not of type int or sequence.
ValueError: If `size` is less than or equal to 0.
RuntimeError: If given tensor shape is not <H, W> or <H, W, C>.
@ -451,7 +451,7 @@ class Crop(ImageTensorOperation):
Raises:
TypeError: If `coordinates` is not of type sequence.
TypeError: If `size` is not of type integer or sequence.
TypeError: If `size` is not of type int or sequence.
ValueError: If `coordinates` is less than 0.
ValueError: If `size` is less than or equal to 0.
RuntimeError: If given tensor shape is not <H, W> or <H, W, C>.
@ -530,8 +530,8 @@ class CutOut(ImageTensorOperation):
num_patches (int, optional): Number of patches to be cut out of an image, must be larger than 0. (default=1).
Raises:
TypeError: If `length` is not of type integer.
TypeError: If `num_patches` is not of type integer.
TypeError: If `length` is not of type int.
TypeError: If `num_patches` is not of type int.
ValueError: If `length` is less than or equal 0.
ValueError: If `num_patches` is less than or equal 0.
RuntimeError: If given tensor shape is not <H, W, C>.
@ -633,7 +633,7 @@ class GaussianBlur(ImageTensorOperation):
is provided, the sigma will be calculated as ((kernel_size - 1) * 0.5 - 1) * 0.3 + 0.8.
Raises:
TypeError: If `kernel_size` is not of type integer or sequence of integer.
TypeError: If `kernel_size` is not of type int or sequence of int.
TypeError: If `sigma` is not of type float or sequence of float.
ValueError: If `kernel_size` is not positive and odd.
ValueError: If `sigma` is not positive.
@ -824,7 +824,7 @@ class NormalizePad(ImageTensorOperation):
Raises:
TypeError: If `mean` is not of type sequence.
TypeError: If `std` is not of type sequence.
TypeError: If `dtype` is not of type string.
TypeError: If `dtype` is not of type str.
ValueError: If `mean` is not in range [0.0, 255.0].
ValueError: If `std` is not in range (0.0, 255.0].
RuntimeError: If given tensor shape is not <H, W, C>.
@ -881,8 +881,8 @@ class Pad(ImageTensorOperation):
value of edge.
Raises:
TypeError: If `padding` is not of type integer or sequence of integer.
TypeError: If `fill_value` is not of type integer or tuple of integer.
TypeError: If `padding` is not of type int or sequence of int.
TypeError: If `fill_value` is not of type int or tuple of int.
TypeError: If `padding_mode` is not of type :class:`mindspore.dataset.vision.Border`.
ValueError: If `padding` is negative.
ValueError: If `fill_value` is not in range [0, 255].
@ -987,12 +987,12 @@ class RandomAffine(ImageTensorOperation):
(default=0, filling is performed).
Raises:
TypeError: If `degrees` is not of type integer, float or sequence.
TypeError: If `degrees` is not of type int, float or sequence.
TypeError: If `translate` is not of type sequence.
TypeError: If `scale` is not of type sequence.
TypeError: If `shear` is not of type integer, float or sequence.
TypeError: If `shear` is not of type int, float or sequence.
TypeError: If `resample` is not of type :class:`mindspore.dataset.vision.Inter`.
TypeError: If `fill_value` is not of type integer or tuple of integer.
TypeError: If `fill_value` is not of type int or tuple of int.
ValueError: If `degrees` is negative.
ValueError: If `translate` is not in range [-1.0, 1.0].
ValueError: If `scale` is negative.
@ -1070,7 +1070,7 @@ class RandomAutoContrast(ImageTensorOperation):
Raises:
TypeError: If `cutoff` is not of type float.
TypeError: If `ignore` is not of type integer or sequence of integer.
TypeError: If `ignore` is not of type int or sequence of int.
TypeError: If `prob` is not of type float.
ValueError: If `cutoff` is not in range [0.0, 50.0).
ValueError: If `ignore` is not in range [0, 255].
@ -1246,10 +1246,10 @@ class RandomCrop(ImageTensorOperation):
value of edge.
Raises:
TypeError: If `size` is not of type integer or sequence of integer.
TypeError: If `padding` is not of type integer or sequence of integer.
TypeError: If `size` is not of type int or sequence of int.
TypeError: If `padding` is not of type int or sequence of int.
TypeError: If `pad_if_needed` is not of type boolean.
TypeError: If `fill_value` is not of type integer or sequence of integer.
TypeError: If `fill_value` is not of type int or tuple of int.
TypeError: If `padding_mode` is not of type :class:`mindspore.dataset.vision.Border`.
ValueError: If `size` is not positive.
ValueError: If `padding` is negative.
@ -1321,11 +1321,11 @@ class RandomCropDecodeResize(ImageTensorOperation):
If exceeded, fall back to use center_crop instead. The max_attempts value must be positive.
Raises:
TypeError: If `size` is not of type integer or sequence of integer.
TypeError: If `size` is not of type int or sequence of int.
TypeError: If `scale` is not of type tuple or list.
TypeError: If `ratio` is not of type tuple or list.
TypeError: If `interpolation` is not of type :class:`mindspore.dataset.vision.Inter`.
TypeError: If `max_attempts` is not of type integer.
TypeError: If `max_attempts` is not of type int.
ValueError: If `size` is not positive.
ValueError: If `scale` is negative.
ValueError: If `ratio` is negative.
@ -1407,10 +1407,10 @@ class RandomCropWithBBox(ImageTensorOperation):
value of edge.
Raises:
TypeError: If `size` is not of type integer or sequence of integer.
TypeError: If `padding` is not of type integer or sequence of integer.
TypeError: If `size` is not of type int or sequence of int.
TypeError: If `padding` is not of type int or sequence of int.
TypeError: If `pad_if_needed` is not of type boolean.
TypeError: If `fill_value` is not of type integer or sequence of integer.
TypeError: If `fill_value` is not of type int or tuple of int.
TypeError: If `padding_mode` is not of type :class:`mindspore.dataset.vision.Border`.
ValueError: If `size` is not positive.
ValueError: If `padding` is negative.
@ -1604,7 +1604,7 @@ class RandomLighting(ImageTensorOperation):
class RandomPosterize(ImageTensorOperation):
"""
Reduce the number of bits for each RGB channel to posterize the input image randomly with a given probability.
Reduce the number of bits for each color channel to posterize the input image randomly with a given probability.
Args:
bits (Union[int, Sequence[int]], optional): Range of random posterize to compress image.
@ -1614,7 +1614,7 @@ class RandomPosterize(ImageTensorOperation):
magnitude operation (default=(8, 8)).
Raises:
TypeError: If `bits` is not of type integer or sequence of integer.
TypeError: If `bits` is not of type int or sequence of int.
ValueError: If `bits` is not in range [1, 8].
RuntimeError: If given tensor shape is not <H, W> or <H, W, C>.
@ -1671,11 +1671,11 @@ class RandomResizedCrop(ImageTensorOperation):
crop_area (default=10). If exceeded, fall back to use center_crop instead.
Raises:
TypeError: If `size` is not of type integer or sequence of integer.
TypeError: If `size` is not of type int or sequence of int.
TypeError: If `scale` is not of type tuple or list.
TypeError: If `ratio` is not of type tuple or list.
TypeError: If `interpolation` is not of type :class:`mindspore.dataset.vision.Inter`.
TypeError: If `max_attempts` is not of type integer.
TypeError: If `max_attempts` is not of type int.
ValueError: If `size` is not positive.
ValueError: If `scale` is negative.
ValueError: If `ratio` is negative.
@ -1736,11 +1736,11 @@ class RandomResizedCropWithBBox(ImageTensorOperation):
crop area (default=10). If exceeded, fall back to use center crop instead.
Raises:
TypeError: If `size` is not of type integer or sequence of integer.
TypeError: If `size` is not of type int or sequence of int.
TypeError: If `scale` is not of type tuple or list.
TypeError: If `ratio` is not of type tuple or list.
TypeError: If `interpolation` is not of type Inter.
TypeError: If `max_attempts` is not of type integer.
TypeError: If `interpolation` is not of type :class:`mindspore.dataset.vision.Inter`.
TypeError: If `max_attempts` is not of type int.
ValueError: If `size` is not positive.
ValueError: If `scale` is negative.
ValueError: If `ratio` is negative.
@ -1785,7 +1785,7 @@ class RandomResize(ImageTensorOperation):
If size is a sequence of length 2, an image of size (height, width) will be cropped.
Raises:
TypeError: If `size` is not of type integer or sequence of integer.
TypeError: If `size` is not of type int or sequence of int.
ValueError: If `size` is not positive.
RuntimeError: If given tensor shape is not <H, W> or <H, W, C>.
@ -1825,7 +1825,7 @@ class RandomResizeWithBBox(ImageTensorOperation):
If size is a sequence of length 2, an image of size (height, width) will be cropped.
Raises:
TypeError: If `size` is not of type integer or sequence of integer.
TypeError: If `size` is not of type int or sequence of int.
ValueError: If `size` is not positive.
RuntimeError: If given tensor shape is not <H, W> or <H, W, C>.
@ -1883,11 +1883,11 @@ class RandomRotation(ImageTensorOperation):
The fill_value values must be in range [0, 255] (default=0).
Raises:
TypeError: If `degrees` is not of type integer, float or sequence.
TypeError: If `resample` is not of type Inter.
TypeError: If `degrees` is not of type int, float or sequence.
TypeError: If `resample` is not of type :class:`mindspore.dataset.vision.Inter`.
TypeError: If `expand` is not of type boolean.
TypeError: If `center` is not of type tuple.
TypeError: If `fill_value` is not of type integer or tuple of integer.
TypeError: If `fill_value` is not of type int or tuple of int.
ValueError: If `fill_value` is not in range [0, 255].
RuntimeError: If given tensor shape is not <H, W> or <H, W, C>.
@ -2160,8 +2160,8 @@ class Resize(ImageTensorOperation):
should be in 3 channels format.
Raises:
TypeError: If `size` is not of type integer or sequence of integer.
TypeError: If `interpolation` is not of type Inter.
TypeError: If `size` is not of type int or sequence of int.
TypeError: If `interpolation` is not of type :class:`mindspore.dataset.vision.Inter`.
ValueError: If `size` is not positive.
RuntimeError: If given tensor shape is not <H, W> or <H, W, C>.
@ -2207,8 +2207,8 @@ class ResizeWithBBox(ImageTensorOperation):
- Inter.BICUBIC, means interpolation method is bicubic interpolation.
Raises:
TypeError: If `size` is not of type integer or sequence of integer.
TypeError: If `interpolation` is not of type Inter.
TypeError: If `size` is not of type int or sequence of int.
TypeError: If `interpolation` is not of type :class:`mindspore.dataset.vision.Inter`.
ValueError: If `size` is not positive.
RuntimeError: If given tensor shape is not <H, W> or <H, W, C>.
@ -2286,11 +2286,11 @@ class Rotate(ImageTensorOperation):
The fill_value values must be in range [0, 255] (default=0).
Raises:
TypeError: If `degrees` is not of type integer or float.
TypeError: If `resample` is not of type Inter.
TypeError: If `degrees` is not of type int or float.
TypeError: If `resample` is not of type :class:`mindspore.dataset.vision.Inter`.
TypeError: If `expand` is not of type bool.
TypeError: If `center` is not of type tuple.
TypeError: If `fill_value` is not of type integer or tuple of integer.
TypeError: If `fill_value` is not of type int or tuple of int.
ValueError: If `fill_value` is not in range [0, 255].
RuntimeError: If given tensor shape is not <H, W> or <H, W, C>.
@ -2344,10 +2344,10 @@ class SlicePatches(ImageTensorOperation):
The fill_value must be in range [0, 255] (default=0).
Raises:
TypeError: If `num_height` is not of type integer.
TypeError: If `num_width` is not of type integer.
TypeError: If `slice_mode` is not of type Inter.
TypeError: If `fill_value` is not of type integer.
TypeError: If `num_height` is not of type int.
TypeError: If `num_width` is not of type int.
TypeError: If `slice_mode` is not of type :class:`mindspore.dataset.vision.Inter`.
TypeError: If `fill_value` is not of type int.
ValueError: If `num_height` is not positive.
ValueError: If `num_width` is not positive.
ValueError: If `fill_value` is not in range [0, 255].
@ -2401,10 +2401,10 @@ class SoftDvppDecodeRandomCropResizeJpeg(ImageTensorOperation):
If exceeded, fall back to use center_crop instead. The max_attempts value must be positive.
Raises:
TypeError: If `size` is not of type integer or sequence of integer.
TypeError: If `size` is not of type int or sequence of int.
TypeError: If `scale` is not of type tuple or list.
TypeError: If `ratio` is not of type tuple or list.
TypeError: If `max_attempts` is not of type integer.
TypeError: If `max_attempts` is not of type int.
ValueError: If `size` is not positive.
ValueError: If `scale` is negative.
ValueError: If `ratio` is negative.
@ -2457,7 +2457,7 @@ class SoftDvppDecodeResizeJpeg(ImageTensorOperation):
If size is a sequence of length 2, an image of size (height, width) will be cropped.
Raises:
TypeError: If `size` is not of type integer or sequence of integer.
TypeError: If `size` is not of type int or sequence of int.
ValueError: If `size` is not positive.
RuntimeError: If given tensor is not a 1D sequence.
@ -2497,7 +2497,7 @@ class UniformAugment(ImageTensorOperation):
Raises:
TypeError: If `transform` is not an image processing operation
in :class:`mindspore.dataset.vision.c_transforms`.
TypeError: If `num_ops` is not of type integer.
TypeError: If `num_ops` is not of type int.
ValueError: If `num_ops` is not positive.
Supported Platforms: