jax.image.resize#
- jax.image.resize(image, shape, method, antialias=True, precision=Precision.HIGHEST)[原始碼]#
影像尺寸調整。
method
參數預期為下列尺寸調整方法之一ResizeMethod.NEAREST
,"nearest"
最近鄰插值。
antialias
和precision
的值會被忽略。ResizeMethod.LINEAR
,"linear"
,"bilinear"
,"trilinear"
,"triangle"
線性插值。如果
antialias
為True
,則在降採樣時使用三角形濾波器。ResizeMethod.CUBIC
,"cubic"
,"bicubic"
,"tricubic"
立方插值,使用 Keys 立方核心。
ResizeMethod.LANCZOS3
,"lanczos3"
Lanczos 重採樣,使用半徑為 3 的核心。
ResizeMethod.LANCZOS5
,"lanczos5"
Lanczos 重採樣,使用半徑為 5 的核心。
- 參數:
image – JAX 陣列。
shape (core.Shape) – 輸出形狀,為整數序列,長度等於 image 的維度數。請注意,
resize()
不區分空間維度和批次或通道維度,因此這包含影像的所有維度。若要表示批次或通道維度,只需保持形狀的該元素不變即可。method (str | ResizeMethod) – 要使用的尺寸調整方法;可以是
ResizeMethod
實例或字串。可用方法為:LINEAR、LANCZOS3、LANCZOS5、CUBIC。antialias (bool) – 降採樣時是否應使用反鋸齒濾波器?預設為
True
。升採樣時無效。
- 回傳:
已調整大小的影像。