Differentiable Siamese Augmentation (DSA)

DSA is one of differentiable data augmentations, first used in the dataset distillation task by DSA. Our implementation of DSA is adopted from DSA. It supports the following differentiable augmentations:

  • Random Flip
  • Random Rotation
  • Random Saturation
  • Random Brightness
  • Random Contrast
  • Random Scale
  • Random Crop
  • Random Cutout

CLASS dd_ranking.aug.DSA(params: dict, seed: int, aug_mode: str) [SOURCE]

Parameters

  • params(dict): Parameters for the DSA augmentations. We require the parameters to be in the format of {'param_name': param_value}. For example, {'flip': 0.5, 'rotate': 15.0, 'scale': 1.2, 'crop': 0.125, 'cutout': 0.5, 'brightness': 1.0, 'contrast': 0.5, 'saturation': 2.0}.
  • seed(int): Random seed. Default is -1.
  • aug_mode(str): S for randomly selecting one augmentation for each batch. M for applying all augmentations for each batch.

Example

# When intializing an evaluator with DSA augmentation, and DSA object will be constructed.
>>> self.aug_func = DSA(params={'flip': 0.5, 'rotate': 15.0, 'scale': 1.2, 'crop': 0.125, 'cutout': 0.5, 'brightness': 1.0, 'contrast': 0.5, 'saturation': 2.0}, seed=-1, aug_mode='S')

# During training, the DSA object will be used to augment the data.
>>> images = aug_func(images)