Transforms are common image transformations. They can be chained together using Compose
. Additionally, there is the torchvision.transforms.functional
module. Functional transforms give fine-grained control over the transformations. This is useful if you have to build a more complex transformation pipeline (e.g. in the case of segmentation tasks).
class torchvision.transforms.Compose
(transforms)[source]
Composes several transforms together.
Parameters
transforms (list of Transform
objects) – list of transforms to compose.
Example
>>> transforms.Compose([
>>> transforms.CenterCrop(10),
>>> transforms.ToTensor(),
>>> ])