pytorch learning (1): twenty-two the method transforms

The blog of transforms.py various pretreatment methods are described and summarized. They came up with a total of four categories, to facilitate Index:

1. Cut --Crop

Center cut: transforms.CenterCrop
random cutting: transforms.RandomCrop
random aspect ratio crop: transforms.RandomResizedCrop
up and down the center cut: transforms.FiveCrop
up and down the center flipped after cutting, transforms.TenCrop

2. Flip and Rotate --Flip and Rotation

Probability p inversion levels: transforms.RandomHorizontalFlip (p = 0.5)
by a vertical flip probability p: transforms.RandomVerticalFlip (p = 0.5)
random rotation: transforms.RandomRotation

3. The image transformation

resize: transforms.Resize
Standardization: transforms.Normalize
into Tensor, and normalized to [0-1]: transforms.ToTensor
filling: transforms.Pad
modify brightness, contrast, and saturation: transforms.ColorJitter
grayscale: transforms .Grayscale
linear transformation: transforms.LinearTransformation ()
affine transformation: transforms.RandomAffine
converted to grayscale with probability p: transforms.RandomGrayscale
converting the data to PILImage: transforms.ToPILImage
transforms.Lambda: A User-defined the Apply the lambda aS A transform.

4. operation transforms the data to enhance flexibility

transforms.RandomChoice (transforms), to a series of transforms selected from a predetermined operating
transforms.RandomApply (transforms, p = 0.5) , to add a probability transform, operating in probability
transforms.RandomOrder, the operation of random transforms upset

Guess you like

Origin blog.csdn.net/j879159541/article/details/91627277