def data_prep_function_train(x, p_transform=p_transform, p_augmentation=p_augmentation, **kwargs): x = x.convert('RGB') x = np.array(x) x = imresize(x, (128, 128, 3), interp='lanczos') x = np.swapaxes(x, 0, 2) x = x / 255. x -= mean x /= std x = x.astype(np.float32) pert_aug = dict((k, p_augmentation[k]) for k in ('zoom_range', 'rotation_range', 'shear_range', 'translation_range', 'do_flip', 'allow_stretch') if k in p_augmentation) x = data_transforms.perturb(x, pert_aug, p_transform['patch_size'], rng, n_channels=p_transform["channels"]) losless_aug = dict((k, p_augmentation[k]) for k in ('rot90_values', 'flip') if k in p_augmentation) x = data_transforms.random_lossless(x, losless_aug, rng) return x
def data_prep_function_train(x, p_transform=p_transform, p_augmentation=p_augmentation, **kwargs): x = x.convert('RGB') x = np.array(x) x = np.swapaxes(x,0,2) x = x / 255. x = x.astype(np.float32) x = data_transforms.random_lossless(x, p_augmentation, rng) return x
def data_prep_function_train(x, p_transform=p_transform, p_augmentation=p_augmentation, **kwargs): x = np.array(x, dtype=np.float32) x = data_transforms.channel_zmuv(x, img_stats=channel_zmuv_stats, no_channels=4) x = data_transforms.random_lossless(x, p_augmentation, rng) return x
def data_prep_function_train(x, p_transform=p_transform, p_augmentation=p_augmentation, **kwargs): x = x.convert('RGB') x = np.array(x) x = np.swapaxes(x,0,2) x = x / 255. x -= mean x /= std x = x.astype(np.float32) x = data_transforms.random_lossless(x, p_augmentation, rng) x = np.pad(x,[[0,0],[22,21],[22,21]],"edge") return x
def data_prep_function_train(x, p_transform=p_transform, p_augmentation=p_augmentation, **kwargs): x = x.convert('RGB') x = np.array(x) x = np.swapaxes(x, 0, 2) x = x / 255. x -= mean x /= std x = x.astype(np.float32) x = random_crop(x, p_augmentation['aug_out_size'][0], p_augmentation['aug_out_size'][0], rng) x = data_transforms.random_lossless(x, p_augmentation, rng) random_crop return x