ndarray.image¶
Image NDArray API of MXNet.
Functions
|
Adjust the lighting level of the input. |
|
Crop an image NDArray of shape (H x W x C) or (N x H x W x C) to the given size. |
|
Defined in src/operator/image/image_random.cc:L195 |
|
Defined in src/operator/image/image_random.cc:L205 |
|
Normalize an tensor of shape (C x H x W) or (N x C x H x W) with mean and standard deviation. |
|
Defined in src/operator/image/image_random.cc:L215 |
|
Defined in src/operator/image/image_random.cc:L246 |
|
Defined in src/operator/image/image_random.cc:L222 |
|
Defined in src/operator/image/image_random.cc:L200 |
|
Defined in src/operator/image/image_random.cc:L210 |
|
Defined in src/operator/image/image_random.cc:L238 |
|
Randomly add PCA noise. |
|
Defined in src/operator/image/image_random.cc:L230 |
|
Resize an image NDArray of shape (H x W x C) or (N x H x W x C) to the given size .. |
|
Converts an image NDArray of shape (H x W x C) or (N x H x W x C) |
-
mxnet.ndarray.image.
adjust_lighting
(data=None, alpha=_Null, out=None, name=None, **kwargs)¶ Adjust the lighting level of the input. Follow the AlexNet style.
Defined in src/operator/image/image_random.cc:L254
-
mxnet.ndarray.image.
crop
(data=None, x=_Null, y=_Null, width=_Null, height=_Null, out=None, name=None, **kwargs)¶ Crop an image NDArray of shape (H x W x C) or (N x H x W x C) to the given size. .. rubric:: Example
Defined in src/operator/image/crop.cc:L66
- Parameters
data (NDArray) – The input.
x (int, required) – Left boundary of the cropping area.
y (int, required) – Top boundary of the cropping area.
width (int, required) – Width of the cropping area.
height (int, required) – Height of the cropping area.
out (NDArray, optional) – The output NDArray to hold the result.
- Returns
out – The output of this function.
- Return type
NDArray or list of NDArrays
-
mxnet.ndarray.image.
flip_left_right
(data=None, out=None, name=None, **kwargs)¶ Defined in src/operator/image/image_random.cc:L195
-
mxnet.ndarray.image.
flip_top_bottom
(data=None, out=None, name=None, **kwargs)¶ Defined in src/operator/image/image_random.cc:L205
-
mxnet.ndarray.image.
normalize
(data=None, mean=_Null, std=_Null, out=None, name=None, **kwargs)¶ - Normalize an tensor of shape (C x H x W) or (N x C x H x W) with mean and
standard deviation.
Given mean (m1, …, mn) and std (s:sub:`1, …, sn)` for n channels, this transform normalizes each channel of the input tensor with:
\[ \begin{align}\begin{aligned} output[i] = (input[i] - m\ :sub:`i`\ ) / s\ :sub:`i`\\If mean or std is scalar, the same value will be applied to all channels.\\Default value for mean is 0.0 and stand deviation is 1.0.\end{aligned}\end{align} \]Example
Defined in src/operator/image/image_random.cc:L167
- Parameters
data (NDArray) – Input ndarray
mean (tuple of <float>, optional, default=[0,0,0,0]) – Sequence of means for each channel. Default value is 0.
std (tuple of <float>, optional, default=[1,1,1,1]) – Sequence of standard deviations for each channel. Default value is 1.
out (NDArray, optional) – The output NDArray to hold the result.
- Returns
out – The output of this function.
- Return type
NDArray or list of NDArrays
-
mxnet.ndarray.image.
random_brightness
(data=None, min_factor=_Null, max_factor=_Null, out=None, name=None, **kwargs)¶ Defined in src/operator/image/image_random.cc:L215
-
mxnet.ndarray.image.
random_color_jitter
(data=None, brightness=_Null, contrast=_Null, saturation=_Null, hue=_Null, out=None, name=None, **kwargs)¶ Defined in src/operator/image/image_random.cc:L246
- Parameters
data (NDArray) – The input.
brightness (float, required) – How much to jitter brightness.
contrast (float, required) – How much to jitter contrast.
saturation (float, required) – How much to jitter saturation.
hue (float, required) – How much to jitter hue.
out (NDArray, optional) – The output NDArray to hold the result.
- Returns
out – The output of this function.
- Return type
NDArray or list of NDArrays
-
mxnet.ndarray.image.
random_contrast
(data=None, min_factor=_Null, max_factor=_Null, out=None, name=None, **kwargs)¶ Defined in src/operator/image/image_random.cc:L222
-
mxnet.ndarray.image.
random_flip_left_right
(data=None, out=None, name=None, **kwargs)¶ Defined in src/operator/image/image_random.cc:L200
-
mxnet.ndarray.image.
random_flip_top_bottom
(data=None, out=None, name=None, **kwargs)¶ Defined in src/operator/image/image_random.cc:L210
-
mxnet.ndarray.image.
random_hue
(data=None, min_factor=_Null, max_factor=_Null, out=None, name=None, **kwargs)¶ Defined in src/operator/image/image_random.cc:L238
-
mxnet.ndarray.image.
random_lighting
(data=None, alpha_std=_Null, out=None, name=None, **kwargs)¶ Randomly add PCA noise. Follow the AlexNet style.
Defined in src/operator/image/image_random.cc:L262
-
mxnet.ndarray.image.
random_saturation
(data=None, min_factor=_Null, max_factor=_Null, out=None, name=None, **kwargs)¶ Defined in src/operator/image/image_random.cc:L230
-
mxnet.ndarray.image.
resize
(data=None, size=_Null, keep_ratio=_Null, interp=_Null, out=None, name=None, **kwargs)¶ Resize an image NDArray of shape (H x W x C) or (N x H x W x C) to the given size .. rubric:: Example
Defined in src/operator/image/resize.cc:L71
- Parameters
data (NDArray) – The input.
size (Shape(tuple), optional, default=[]) – Size of new image. Could be (width, height) or (size)
keep_ratio (boolean, optional, default=0) – Whether to resize the short edge or both edges to size, if size is give as an integer.
interp (int, optional, default='1') – Interpolation method for resizing. By default uses bilinear interpolationOptions are INTER_NEAREST - a nearest-neighbor interpolationINTER_LINEAR - a bilinear interpolationINTER_AREA - resampling using pixel area relationINTER_CUBIC - a bicubic interpolation over 4x4 pixel neighborhoodINTER_LANCZOS4 - a Lanczos interpolation over 8x8 pixel neighborhoodNote that the GPU version only support bilinear interpolation(1) and the result on cpu would be slightly different from gpu.It uses opencv resize function which tend to align center on cpuwhile using contrib.bilinearResize2D which aligns corner on gpu
out (NDArray, optional) – The output NDArray to hold the result.
- Returns
out – The output of this function.
- Return type
NDArray or list of NDArrays
-
mxnet.ndarray.image.
to_tensor
(data=None, out=None, name=None, **kwargs)¶ Converts an image NDArray of shape (H x W x C) or (N x H x W x C) with values in the range [0, 255] to a tensor NDArray of shape (C x H x W) or (N x C x H x W) with values in the range [0, 1]
Example
Defined in src/operator/image/image_random.cc:L92