怎么样'命令' imgaug.augmenters.Affine工作中的参数?

时间:2018-01-10 16:09:09

标签: python-3.x image-processing machine-learning computer-vision image-manipulation

我一直在使用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]代表线性插值。这是什么意思?如何获得其他插值,例如bicubic或Lanczos?

1 个答案:

答案 0 :(得分:2)

"使用Source,Luke"。 directly,或来自带help函数的docstring。

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.