salesforce/CoMatch

Codes for Dataloader of STL Dataset

QiushiYang opened this issue · 4 comments

Thanks a lot for sharing your clear codes. I try to train the models on STL dataset but don't find the dataloader of STL suitable for SSL setting. Would you like to share the codes of STL Dataloader with randomly splitting labeled&unlabeled data?

Hi, I use torchvision.datasets.STL10 to load the train split and unlabeled split.

Thank you for your replys. I wonder whether the data pre-processing (including data augmentation methods) for STL dataset is the same as CIFAR-10/100 ?

This is the transformations I used for STL:
mean = (0.44671062, 0.43980984, 0.40664645)
std = (0.26034098, 0.25657727, 0.27126738)
trans_weak = transforms.Compose([
transforms.RandomResizedCrop(96, scale=(0.2, 1.)),
transforms.RandomHorizontalFlip(p=0.5),
transforms.ToTensor(),
transforms.Normalize(mean, std),
])
trans_strong0 = transforms.Compose([
transforms.RandomResizedCrop(96, scale=(0.2, 1.)),
transforms.RandomHorizontalFlip(p=0.5),
RandomAugment(2, 10, isPIL=True),
T.Normalize(mean, std),
T.ToTensor(),
])
trans_strong1 = transforms.Compose([
transforms.RandomResizedCrop(96, scale=(0.2, 1.)),
transforms.RandomHorizontalFlip(p=0.5),
transforms.RandomApply([
transforms.ColorJitter(0.4, 0.4, 0.4, 0.1)
], p=0.8),
transforms.RandomGrayscale(p=0.2),
transforms.ToTensor(),
transforms.Normalize(mean, std),
])

Many thanks! I will have a try :-)