我一直在使用 imgaug 来增强我的项目的数据。当然,我会使用仿射变换,所以我知道我们使用 order
参数来选择插值方法。不过,选择插值的方式看起来相当晦涩,至少对我来说是这样。
假设这是我的增强器(它是 Sequential()
增强器的一部分):
iaa.Affine(scale = {"x": (+0.8, +1.0), "y": (+0.8, +1.0)},
translate_percent = {"x": (-0.2, +0.2), "y": (-0.2, +0.2)},
rotate = (-5, +5),
shear = ( -5, +5),
order = [1, 2], #interpolation
cval = 255,
)
据我所知,order = [1,2]
代表双二次插值,order = [0,1]
代表线性插值。这是什么意思?如何获得其他插值,例如双三次插值或 Lanczos 插值?
最佳答案
“使用来源,卢克”。要么 directly ,或来自带有 help
函数的文档字符串。
order : int or iterable of int or ia.ALL or StochasticParameter, optional(default=1)
Interpolation order to use. Same meaning as in
skimage:
* 0: Nearest-neighbor
* 1: Bi-linear (default)
* 2: Bi-quadratic (not recommended by skimage)
* 3: Bi-cubic
* 4: Bi-quartic
* 5: Bi-quintic
Method 0 and 1 are fast, 3 is a bit slower, 4 and 5 are very
slow.
* If a single int, then that order will be used for all images.
* If an iterable, then for each image a random value will be sampled
from that iterable (i.e. list of allowed order values).
* If ia.ALL, then equivalant to list [0, 1, 3, 4, 5].
* If StochasticParameter, then that parameter is queried per image
to sample the order value to use.
关于python-3.x - imgaug.augmenters.Affine 中的 'order' 参数到底是如何工作的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48191585/