virtex.data.transforms
- class virtex.data.transforms.HorizontalFlip(always_apply: bool = False, p: float = 0.5)[source]
Bases:
albumentations.core.transforms_interface.BasicTransform
Flip the image horizontally randomly (equally likely) and replace the word “left” with “right” in the caption.
Note
This transform can also work on images only (without the captions). Its behavior will be same as albumentations
HorizontalFlip
.Examples
>>> flip = HorizontalFlip(p=0.5) >>> out1 = flip(image=image, caption=caption) # keys: {"image", "caption"} >>> # Also works with images (without caption). >>> out2 = flip(image=image) # keys: {"image"}
- class virtex.data.transforms.RandomResizedSquareCrop(size: int, *args, **kwargs)[source]
Bases:
albumentations.augmentations.crops.transforms.RandomResizedCrop
A variant of
albumentations.augmentations.transforms.RandomResizedCrop
which assumes a square crop (width = height). Everything else is same.- Parameters
size – Dimension of the width and height of the cropped image.
- class virtex.data.transforms.CenterSquareCrop(size: int, *args, **kwargs)[source]
Bases:
albumentations.augmentations.crops.transforms.CenterCrop
A variant of
albumentations.augmentations.transforms.CenterCrop
which assumes a square crop (width = height). Everything else is same.- Parameters
size – Dimension of the width and height of the cropped image.
- class virtex.data.transforms.SquareResize(size: int, *args, **kwargs)[source]
Bases:
albumentations.augmentations.geometric.resize.Resize
A variant of
albumentations.augmentations.transforms.Resize
which assumes a square resize (width = height). Everything else is same.- Parameters
size – Dimension of the width and height of the cropped image.
- virtex.data.transforms.IMAGENET_COLOR_MEAN = (0.485, 0.456, 0.406)
ImageNet color normalization mean in RGB format (values in 0-1).
- virtex.data.transforms.IMAGENET_COLOR_STD = (0.229, 0.224, 0.225)
ImageNet color normalization std in RGB format (values in 0-1).
- virtex.data.transforms.DEFAULT_IMAGE_TRANSFORM = Compose([ SmallestMaxSize(always_apply=False, p=1.0, max_size=256, interpolation=1), CenterSquareCrop(always_apply=False, p=1.0, height=224, width=224), Normalize(always_apply=False, p=1.0, mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225), max_pixel_value=255.0), ], p=1.0, bbox_params=None, keypoint_params=None, additional_targets={})
Default transform without any data augmentation (during pretraining).