參考自tf2.1
官方文檔:
https://www.tensorflow.org/api_docs/python/tf/image/random_saturation
Adjust the saturation of RGB images by a random factor.
該函數用於隨機調整RGB圖像的飽和度。
tf.image.random_saturation(
image, lower, upper, seed=None
)
Equivalent to adjust_saturation() but uses a saturation_factor randomly picked in the interval [lower, upper].
在區間[lower, upper]
上隨機選擇saturation_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 saturation factor.
-
lower: 浮點數,隨機saturation factor的下限。
-
upper: float. Upper bound for the random saturation factor.
-
upper: 浮點數,隨機saturation factor的上限。
-
seed: An operation-specific seed.
It will be used in conjunction with the graph-level seed to determine the real seeds that will be used in this operation.
Please see the documentation of set_random_seed for its interaction with the graph-level random seed. -
seed: 特定操作的種子。(注:筆者不太明白這個種子和隨機數種子有什麼區別,只是感覺有點兒玄乎)
Returns:
- Adjusted image(s), same shape and DType as image.
- 飽和度調整過後的圖片,與輸入 image 有相同的shape和類型
Raises:
- ValueError: if upper <= lower or if lower < 0.
- 如果 upper <= lower 或者 lower < 0,將 raise ValueError