def strongTransform(parameters, data=None, target=None): assert ((data is not None) or (target is not None)) data, target = transformsgpu.mix(mask = parameters["Mix"], data = data, target = target) data, target = transformsgpu.colorJitter(colorJitter = parameters["ColorJitter"], img_mean = torch.from_numpy(IMG_MEAN.copy()).cuda(), data = data, target = target) data, target = transformsgpu.gaussian_blur(blur = parameters["GaussianBlur"], data = data, target = None) data, target = transformsgpu.flip(flip = parameters["flip"], data = data, target = target) return data, target
def weakTransform(parameters, data=None, target=None): data, target = transformsgpu.flip(flip=parameters["flip"], data=data, target=target) return data, target
def augmentationTransform(parameters, data=None, target=None, probs=None, jitter_vale=0.4, min_sigma=0.2, max_sigma=2., ignore_label=255): """ Args: parameters: dictionary with the augmentation configuration data: BxCxWxH input data to augment target: BxWxH labels to augment probs: BxWxH probability map to augment jitter_vale: jitter augmentation value min_sigma: min sigma value for blur max_sigma: max sigma value for blur ignore_label: value for ignore class Returns: augmented data, target, probs """ assert ((data is not None) or (target is not None)) if "Mix" in parameters: data, target, probs = transformsgpu.mix(mask=parameters["Mix"], data=data, target=target, probs=probs) if "RandomScaleCrop" in parameters: data, target, probs = transformsgpu.random_scale_crop( scale=parameters["RandomScaleCrop"], data=data, target=target, probs=probs, ignore_label=ignore_label) if "flip" in parameters: data, target, probs = transformsgpu.flip(flip=parameters["flip"], data=data, target=target, probs=probs) if "ColorJitter" in parameters: data, target, probs = transformsgpu.colorJitter( colorJitter=parameters["ColorJitter"], data=data, target=target, probs=probs, s=jitter_vale) if "GaussianBlur" in parameters: data, target, probs = transformsgpu.gaussian_blur( blur=parameters["GaussianBlur"], data=data, target=target, probs=probs, min_sigma=min_sigma, max_sigma=max_sigma) if "Grayscale" in parameters: data, target, probs = transformsgpu.grayscale( grayscale=parameters["Grayscale"], data=data, target=target, probs=probs) if "Solarize" in parameters: data, target, probs = transformsgpu.solarize( solarize=parameters["Solarize"], data=data, target=target, probs=probs) return data, target, probs