@@ -162,6 +162,24 @@ def _apply_image_or_video_transform(
162
162
163
163
164
164
class AutoAugment (_AutoAugmentBase ):
165
+ r"""[BETA] AutoAugment data augmentation method based on
166
+ `"AutoAugment: Learning Augmentation Strategies from Data" <https://arxiv.org/pdf/1805.09501.pdf>`_.
167
+
168
+ .. betastatus:: AutoAugment transform
169
+
170
+ If the image is torch Tensor, it should be of type torch.uint8, and it is expected
171
+ to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions.
172
+ If img is PIL Image, it is expected to be in mode "L" or "RGB".
173
+
174
+ Args:
175
+ policy (AutoAugmentPolicy): Desired policy enum defined by
176
+ :class:`torchvision.transforms.autoaugment.AutoAugmentPolicy`. Default is ``AutoAugmentPolicy.IMAGENET``.
177
+ interpolation (InterpolationMode): Desired interpolation enum defined by
178
+ :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.NEAREST``.
179
+ If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
180
+ fill (sequence or number, optional): Pixel fill value for the area outside the transformed
181
+ image. If given a number, the value is used for all bands respectively.
182
+ """
165
183
_v1_transform_cls = _transforms .AutoAugment
166
184
167
185
_AUGMENTATION_SPACE = {
@@ -318,6 +336,27 @@ def forward(self, *inputs: Any) -> Any:
318
336
319
337
320
338
class RandAugment (_AutoAugmentBase ):
339
+ r"""[BETA] RandAugment data augmentation method based on
340
+ `"RandAugment: Practical automated data augmentation with a reduced search space"
341
+ <https://arxiv.org/abs/1909.13719>`_.
342
+
343
+ .. betastatus:: RandAugment transform
344
+
345
+ If the image is torch Tensor, it should be of type torch.uint8, and it is expected
346
+ to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions.
347
+ If img is PIL Image, it is expected to be in mode "L" or "RGB".
348
+
349
+ Args:
350
+ num_ops (int): Number of augmentation transformations to apply sequentially.
351
+ magnitude (int): Magnitude for all the transformations.
352
+ num_magnitude_bins (int): The number of different magnitude values.
353
+ interpolation (InterpolationMode): Desired interpolation enum defined by
354
+ :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.NEAREST``.
355
+ If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
356
+ fill (sequence or number, optional): Pixel fill value for the area outside the transformed
357
+ image. If given a number, the value is used for all bands respectively.
358
+ """
359
+
321
360
_v1_transform_cls = _transforms .RandAugment
322
361
_AUGMENTATION_SPACE = {
323
362
"Identity" : (lambda num_bins , height , width : None , False ),
@@ -379,6 +418,24 @@ def forward(self, *inputs: Any) -> Any:
379
418
380
419
381
420
class TrivialAugmentWide (_AutoAugmentBase ):
421
+ r"""[BETA] Dataset-independent data-augmentation with TrivialAugment Wide, as described in
422
+ `"TrivialAugment: Tuning-free Yet State-of-the-Art Data Augmentation" <https://arxiv.org/abs/2103.10158>`_.
423
+
424
+ .. betastatus:: TrivialAugmentWide transform
425
+
426
+ If the image is torch Tensor, it should be of type torch.uint8, and it is expected
427
+ to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions.
428
+ If img is PIL Image, it is expected to be in mode "L" or "RGB".
429
+
430
+ Args:
431
+ num_magnitude_bins (int): The number of different magnitude values.
432
+ interpolation (InterpolationMode): Desired interpolation enum defined by
433
+ :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.NEAREST``.
434
+ If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
435
+ fill (sequence or number, optional): Pixel fill value for the area outside the transformed
436
+ image. If given a number, the value is used for all bands respectively.
437
+ """
438
+
382
439
_v1_transform_cls = _transforms .TrivialAugmentWide
383
440
_AUGMENTATION_SPACE = {
384
441
"Identity" : (lambda num_bins , height , width : None , False ),
@@ -430,6 +487,29 @@ def forward(self, *inputs: Any) -> Any:
430
487
431
488
432
489
class AugMix (_AutoAugmentBase ):
490
+ r"""[BETA] AugMix data augmentation method based on
491
+ `"AugMix: A Simple Data Processing Method to Improve Robustness and Uncertainty" <https://arxiv.org/abs/1912.02781>`_.
492
+
493
+ .. betastatus:: AugMix transform
494
+
495
+ If the image is torch Tensor, it should be of type torch.uint8, and it is expected
496
+ to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions.
497
+ If img is PIL Image, it is expected to be in mode "L" or "RGB".
498
+
499
+ Args:
500
+ severity (int): The severity of base augmentation operators. Default is ``3``.
501
+ mixture_width (int): The number of augmentation chains. Default is ``3``.
502
+ chain_depth (int): The depth of augmentation chains. A negative value denotes stochastic depth sampled from the interval [1, 3].
503
+ Default is ``-1``.
504
+ alpha (float): The hyperparameter for the probability distributions. Default is ``1.0``.
505
+ all_ops (bool): Use all operations (including brightness, contrast, color and sharpness). Default is ``True``.
506
+ interpolation (InterpolationMode): Desired interpolation enum defined by
507
+ :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.NEAREST``.
508
+ If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
509
+ fill (sequence or number, optional): Pixel fill value for the area outside the transformed
510
+ image. If given a number, the value is used for all bands respectively.
511
+ """
512
+
433
513
_v1_transform_cls = _transforms .AugMix
434
514
435
515
_PARTIAL_AUGMENTATION_SPACE = {
0 commit comments