transforms--图像变换
1.pad
transforms.Pad(#对图片边缘进行填充
padding,
#设置填充大小
#当为a时,上下左右均填充a个像素
#当为(a, b)时,上下填充b个像素,左右填充a个像素
#当为(a, b, c, d)时,左,上,右,下分别填充a, b, c, d
padding_mode='constant',#填充模式,有4种模式,constant、edge、reflect和symmetric
fill=0#constant时,设置填充的像素值,(R, G, B) or (Gray)
)
2.ColorJitter
transforms.ColorJitter(#调整亮度、对比度、饱和度和色相
brightness=0,
#亮度调整因子
#当为a时,从[max(0, 1-a), 1+a]中随机选择
#当为(a, b)时,从[a, b]中
contrast=0, #对比度参数,同brightness
saturation=0, #饱和度参数,同brightness
hue=0
#色相参数
#当为a时,从[-a, a]中选择参数,注: 0<= a <= 0.5
#当为(a, b)时,从[a, b]中选择参数,注:-0.5 <= a <= b <= 0.5
)
3.RandomGrayscale和Grayscale
RandomGrayscale(#依概率将图片转换为灰度图
num_output_channels,#输出通道数,只能设1或3
p=0.1#概率值,图像被转换为灰度图的概率
)
Grayscale(
num_outpu