transform
. Thus, transforms
is composed of transform
. transforms.Compose([
transforms.CenterCrop(10),
transforms.Normalize((0.5, 0.4, 0.5), (0.5, 0.5, 0.5)),
transforms.RandomHorizontalFlip(p=0.5),
transforms.RandomRotation(),
transforms.RandomApply(random_transforms, p=0.3),
transforms.ToTensor()
])
# No contents yet
class torchvision.transforms.RandomCrop(size, padding=0)
Crop the given PIL image at a random location.
class torchvision.transforms.RandomHorizontalFlip(p=0.5)
Horizontally flip the given image randomly with a given probability.
class torchvision.transforms.RandomRotation
class torchvision.transforms.Resize(size)
Resize the input PIL image to the given size, usually used with training_testing set
class torchvision.transforms.RandomApply
class torchvision.transforms.ToTensor
class torchvision.transforms.Normalize(mean, std)
Only use Normalize
with Tensor
, not PIL.image
class torchvision.transforms.ToTensor // HWC > CHW
Convert PIL.image
to Tensor
Converts a PIL Image or numpy.ndarray (H x W x C) in the range [0, 255] to a torch.FloatTensor of shape (C x H x W) in the range [0.0, 1.0].
C: Channels, H: Heights, W: Widths
Tensor
to PIL.image