def setup(self, stage=None): # MiraBest test samples # mb_test = MB_nohybrids( path_dict["mb"], train=False, transform=test_transforms["mb"] ) self.test = mb_test # Labelled MiraBest samples # mb_l = MB_nohybrids(path_dict["mb"], train=True, transform=transforms["mb"]) if self.fraction != 1: mb_l, _ = d_split(mb_l, self.fraction) self.train_l = mb_l # Cut unlabelled RGZ samples and define unlabelled training set # mb_u = RGZ20k(path_dict["rgz"], train=True, transform=transforms["mb"]) size_cut(config["data"]["cut_threshold"], mb_u) mb_cut(mb_u) self.train_u = mb_u # Combine labelled and unlabelled datasets # self.train = torch.utils.data.ConcatDataset([mb_u, mb_l]) # Flip a number of targets randomly # if config["train"]["flip"]: mb_l = flip_targets(mb_l, config["train"]["flip"]) self.save_hparams()
def setup(self, stage=None): mb_train = MB_nohybrids(self.path, train=True, transform=transforms["mb"]) mb_test = MB_nohybrids(self.path, train=False, transform=test_transforms["mb"]) self.test_dataset = mb_test if self.fraction != 1: mb_train, _ = d_split(mb_train, self.fraction) self.train_dataset = mb_train mb_l, mb_u = d_split(mb_train, self.split) # Flip a number of targets randomly if config["train"]["flip"]: mb_u = flip_targets(mb_u, config["train"]["flip"]) self.train_dataset_u = mb_u self.train_dataset_l = mb_l self.f_u = label_fraction(mb_u, 0) self.f_l = label_fraction(mb_l, 0)
def prepare_data(self): MB_nohybrids(path_dict["mb"], train=True, download=True) MB_nohybrids(path_dict["mb"], train=False, download=True) RGZ20k(path_dict["rgz"], train=True, download=True)
def prepare_data(self): MB_nohybrids(self.path, train=True, download=True) MB_nohybrids(self.path, train=False, download=True)