MCPcopy Create free account
hub / github.com/OpenGVLab/UniFormerV2 / create_random_augment

Function create_random_augment

slowfast/datasets/transform.py:657–690  ·  view source on GitHub ↗

Get video randaug transform. Args: input_size: The size of the input video in tuple. auto_augment: Parameters for randaug. An example: "rand-m7-n4-mstd0.5-inc1" (m is the magnitude and n is the number of operations to apply). interpolation: I

(
    input_size,
    auto_augment=None,
    interpolation="bilinear",
)

Source from the content-addressed store, hash-verified

655
656
657def create_random_augment(
658 input_size,
659 auto_augment=None,
660 interpolation="bilinear",
661):
662 """
663 Get video randaug transform.
664
665 Args:
666 input_size: The size of the input video in tuple.
667 auto_augment: Parameters for randaug. An example:
668 "rand-m7-n4-mstd0.5-inc1" (m is the magnitude and n is the number
669 of operations to apply).
670 interpolation: Interpolation method.
671 """
672 if isinstance(input_size, tuple):
673 img_size = input_size[-2:]
674 else:
675 img_size = input_size
676
677 if auto_augment:
678 assert isinstance(auto_augment, str)
679 if isinstance(img_size, tuple):
680 img_size_min = min(img_size)
681 else:
682 img_size_min = img_size
683 aa_params = {"translate_const": int(img_size_min * 0.45)}
684 if interpolation and interpolation != "random":
685 aa_params["interpolation"] = _pil_interp(interpolation)
686 if auto_augment.startswith("rand"):
687 return transforms.Compose(
688 [rand_augment_transform(auto_augment, aa_params)]
689 )
690 raise NotImplementedError
691
692
693def random_sized_crop_img(

Callers 5

_aug_frameMethod · 0.85
_aug_frameMethod · 0.85
_aug_frameMethod · 0.85
_aug_frameMethod · 0.85
_aug_frameMethod · 0.85

Calls 2

_pil_interpFunction · 0.85
rand_augment_transformFunction · 0.85

Tested by

no test coverage detected