Fetch the repository succeeded.
tf.keras.preprocessing.image.random_shift(
x,
wrg,
hrg,
row_axis=1,
col_axis=2,
channel_axis=0,
fill_mode='nearest',
cval=0.0,
interpolation_order=1
)
For more information, see tf.keras.preprocessing.image.random_shift.
class mindspore.dataset.vision.RandomAffine(
degrees,
translate=None,
scale=None,
shear=None,
resample=Inter.NEAREST,
fill_value=0
)
For more information, see mindspore.dataset.vision.RandomAffine.
TensorFlow: Randomly shift the image. The index of axis for rows, columns and channels can be specified by input parameters.
MindSpore: Perform random affine transformation on the image, including random shift. The image needs to be arranged in the order of rows, columns, and channels.
# The following implements RandomAffine with MindSpore.
import numpy as np
import mindspore.dataset as ds
from mindspore.dataset.vision import Inter
image = np.random.random((28, 28, 3))
result = ds.vision.RandomAffine(0, translate=(0.2, 0.3), resample=Inter.NEAREST)(image)
print(result.shape)
# (28, 28, 3)
# The following implements random_shift with TensorFlow.
import tensorflow as tf
image = np.random.random((28, 28, 3))
result = tf.keras.preprocessing.image.random_shift(
image, wrg=0.2, hrg=0.3, row_axis=0, col_axis=1, channel_axis=2, fill_mode='nearest')
print(result.shape)
# (28, 28, 3)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。