YU1ut / MixMatch-pytorch

Code for "MixMatch - A Holistic Approach to Semi-Supervised Learning"
MIT License
633 stars 129 forks source link

wrong transform order #35

Open yuanzhanghu opened 3 years ago

yuanzhanghu commented 3 years ago

In CIFAR10_labeled class, we have: self.data = transpose(normalise(self.data)) inside the __init__(), while we do transform for each item in __get_item__()

Which means we do normalization first, then when we call labeled_train_iter.next() in train.py, we do these image transform after normalization, which I believe is not reasonable. these transforms include: dataset.RandomPadandCrop(32), dataset.RandomFlip()

sakumashirayuki commented 3 years ago

I agree with you. And if we use transforms in torchvision.transforms, we can learn that the transforms.Normalize can only be applied to tensor, which means it should be used after all image transforms