1. torchvision.transforms.
Compose
(transforms)
Composes several transforms together.组合多个转换操作。
Parameters: | transforms (list of Transform objects) – list of transforms to compose. |
---|
Example
>>> transforms.Compose([ >>> transforms.CenterCrop(10), >>> transforms.ToTensor(), >>> ])
2.transforms.ToTensor()
将数据转换成torch的张量格式。
3.torchvision.transforms.
Normalize
(mean, std, inplace=False)
Normalize a tensor image with mean and standard deviation. Given mean: (M1,...,Mn)
and std: (S1,..,Sn)
for n
channels, this transform will normalize each channel of the input torch.*Tensor
i.e. input[channel] =(input[channel] - mean[channel]) / std[channel]
归一化一个张量图像,n通道的mean均值和std标准差。
NOTE
This transform acts out of place, i.e., it does not mutates the input tensor.
Parameters: |
|
---|
__call__
(tensor)
Parameters: | tensor (Tensor) – Tensor image of size (C, H, W) to be normalized. |
---|---|
Returns: | Normalized Tensor image. |
Return type: | Tensor |