参考自tf2.1
官方文档:
https://www.tensorflow.org/api_docs/python/tf/image/random_contrast
Adjust the contrast of an image or images by a random factor.
该函数用于随机调整RGB图像的对比度。
tf.image.random_contrast(
image, lower, upper, seed=None
)
Equivalent to adjust_contrast() but uses a contrast_factor randomly picked in the interval [lower, upper].
在区间[lower, upper]
上随机选择contrast_factor,更改图片对比度。
Args:
-
image: RGB image or images. Size of the last dimension must be 3.
-
image: 单张RGB图片或多张RGB图片,最后一维必须为3
-
lower: float. Lower bound for the random contrast factor.
-
lower: 浮点数,指定随机contrast factor的下限
-
upper: float. Upper bound for the random contrast factor.
-
upper: 浮点数,指定随机contrast factor的上限
-
seed: A Python integer. Used to create a random seed. See
tf.compat.v1.set_random_seed
for behavior. -
seed: Python整型数字。用于创建随机数种子
Returns:
- The contrast-adjusted image(s).
- 返回对比度调整过后的图片
Raises:
- ValueError: if
upper <= lower
or iflower < 0
. - 如果
upper <= lower
或者lower < 0
,将 raise ValueError