Ejemplo n.º 1
0
def get_img_mask_augments(pad_mode, depths_channel=False):
    if depths_channel:
        affine_aug = aug.RandomAffineWithMask(5,
                                              translate=(0.1, 0.),
                                              scale=(0.9, 1.1),
                                              shear=None)
    else:
        affine_aug = aug.RandomAffineWithMask(15,
                                              translate=(0.1, 0.1),
                                              scale=(0.9, 1.1),
                                              shear=None)

    if pad_mode == 'resize':
        img_mask_aug_train = aug.Compose(
            [aug.RandomHFlipWithMask(), affine_aug])
        img_mask_aug_val = None
    else:
        img_mask_aug_train = aug.Compose([
            aug.PadWithMask((28, 28), padding_mode=pad_mode),
            aug.RandomHFlipWithMask(), affine_aug,
            aug.RandomResizedCropWithMask(H, scale=(1., 1.), ratio=(1., 1.))
        ])
        img_mask_aug_val = aug.PadWithMask((13, 13, 14, 14),
                                           padding_mode=pad_mode)

    return img_mask_aug_train, img_mask_aug_val
Ejemplo n.º 2
0
Archivo: loader.py Proyecto: chicm/ship
def get_img_mask_transforms(img_sz):
    img_mask_transforms = aug.Compose([
        aug.RandomHFlipWithMask(),
        aug.RandomVFlipWithMask(),
        aug.RandomRotateWithMask([0, 90]),
        aug.RandomRotateWithMask(10),
        aug.RandomResizedCropWithMask(img_sz, scale=(0.9, 1))
    ])
    return img_mask_transforms