def oneof_always_apply_crash(): aug = Compose( [HorizontalFlip(), Rotate(), OneOf([Blur(), MedianBlur()], p=1)], p=1) image = np.ones((8, 8)) data = aug(image=image) assert data
def test_random_rotate(): image = np.ones((192, 192, 3)) bboxes = [[78, 42, 142, 80]] aug = Rotate(limit=15, p=1.) transformed = aug(image=image, bboxes=bboxes) assert len(bboxes) == len(transformed['bboxes'])
def test_per_channel_multi(): transforms = [Blur(), Rotate()] augmentation = PerChannel(transforms, p=1) image = np.ones((8, 8, 5)) data = augmentation(image=image) assert data
0.406], [0.229, 0.224, 0.225, 0.229, 0.224, 0.225]) ratio = 273 * 6 / 256 w, h = sz, int(ratio * sz) n_epochs = int(params['n_epochs']) TTA = int(params['TTA']) balanced_sampler = bool(int(params['balanced_sampler'])) if balanced_sampler: sampler = BalanceClassSampler else: sampler = None train_aug = Compose( [ OneOf([], p=0.20), # HorizontalFlip(0.4), VerticalFlip(0.4), Rotate(limit=360, border_mode=2, p=0.4), Resize(sz, sz, p=1, always_apply=True), RandomSizedCrop(min_max_height=(int(sz * 0.8), int(sz * 0.8)), height=sz, width=sz, p=0.4), Resize(sz, sz, p=1, always_apply=True) ], ) val_aug = Compose([Resize(sz, sz, p=1, always_apply=True)]) # val_aug = None data_dir = params['data_dir'] image_path = params['image_path'] test_image_path = params['test_image_path']