Пример #1
0
def get_jigsaw_dataloader(args):

    #Only for DA
    names, labels = _dataset_info(
        join(dirname(__file__), 'txt_lists', args.target + '.txt'))
    img_tr = get_train_transformers(args)

    train_dataset = Dataset(names,
                            labels,
                            args.path_dataset,
                            img_transformer=img_tr,
                            beta_scrambled=args.beta_scrambled,
                            beta_rotated=args.beta_rotated,
                            beta_odd=args.beta_odd,
                            rotation=False,
                            odd=False)
    dataset = ConcatDataset([train_dataset])
    loader = torch.utils.data.DataLoader(dataset,
                                         batch_size=args.batch_size,
                                         shuffle=False,
                                         num_workers=4,
                                         pin_memory=True,
                                         drop_last=False)

    return loader
Пример #2
0
def get_val_dataloader(args):

    names, labels = _dataset_info(
        join(dirname(__file__), 'txt_lists', args.target + '.txt'))
    img_tr = get_val_transformer(args)

    val_dataset = TestDataset(names,
                              labels,
                              args.path_dataset,
                              img_transformer=img_tr)
    dataset = ConcatDataset([val_dataset])
    loader = torch.utils.data.DataLoader(dataset,
                                         batch_size=args.batch_size,
                                         shuffle=False,
                                         num_workers=4,
                                         pin_memory=True,
                                         drop_last=False)

    return loader
Пример #3
0
def get_trainTargetAsSource_dataloader(args):
    #used to create dataset of target images ready for jigsaw task ( only in training da!!)
    names, labels = _dataset_info(
        join(dirname(__file__), 'txt_lists', args.target + '.txt'))
    img_transformer = get_train_transformers(args)
    train_dataset = Dataset(names,
                            labels,
                            args.path_dataset,
                            img_transformer=img_transformer,
                            betaJigen=args.betaJigen,
                            rotation=args.rotation,
                            oddOneOut=args.oddOneOut)
    #val_dataset = TestDataset(names, labels,args.path_dataset, img_transformer=img_tr,betaJigen = args.betaJigen)
    dataset = ConcatDataset([train_dataset])
    loader = torch.utils.data.DataLoader(dataset,
                                         batch_size=args.batch_size,
                                         shuffle=True,
                                         num_workers=4,
                                         pin_memory=True,
                                         drop_last=True)

    return loader