我在Github寻找GAN代码。我找到的代码使用pytorch。在此代码中,我们首先将图像标准化为均值= 0.5,std = 0.5。通常,归一化为min = 0和max = 1.或者正态分布,均值= 0且std = 1.为什么归一化为均值= 0.5且std = 0.5?
transformtransfo = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize(mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5))
])
mean
的std
和transform.normalize
的值不是期望的平均值和标准值,而是减去和除以的值,即估计的平均值和标准值。
在你的例子中,你减去0.5,然后除以0.5得到一个平均为零的图像和范围为[-1,1]的值