<reponame>xaggi/OGNet
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torch
def load_data(opt):
    dataset = dset.ImageFolder(root=opt.data_path,  # opt.data_path
                               transform=transforms.Compose([
                                   transforms.Grayscale(),
                                   transforms.Resize((45, 45)),
                                   transforms.ToTensor(),
                                   transforms.Normalize([0.5], [0.5]),
                               ]))
    dataloader = torch.utils.data.DataLoader(dataset,
                                             batch_size=opt.batch_size,
                                             shuffle=True,
                                             num_workers=opt.n_threads,
                                             drop_last=opt.drop_last)
    return dataloader

def load_data_train(opt):
    dataset = dset.ImageFolder(root=opt.data_path+'/'+ opt.normal_class,  # opt.data_path
                               transform=transforms.Compose([
                                   transforms.Grayscale(),
                                   transforms.Resize((45, 45)),
                                   transforms.ToTensor(),
                                   transforms.Normalize([0.5], [0.5]),
                               ]))
    dataloader = torch.utils.data.DataLoader(dataset,
                                             batch_size=opt.batch_size,
                                             shuffle=True,
                                             num_workers=opt.n_threads,
                                             drop_last=opt.drop_last)
    return dataloader
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torch
def load_data(opt):
    dataset = dset.ImageFolder(root=opt.data_path,  # opt.data_path
                               transform=transforms.Compose([
                                   transforms.Grayscale(),
                                   transforms.Resize((45, 45)),
                                   transforms.ToTensor(),
                                   transforms.Normalize([0.5], [0.5]),
                               ]))
    dataloader = torch.utils.data.DataLoader(dataset,
                                             batch_size=opt.batch_size,
                                             shuffle=True,
                                             num_workers=opt.n_threads,
                                             drop_last=opt.drop_last)
    return dataloader

def load_data_train(opt):
    dataset = dset.ImageFolder(root=opt.data_path+'/'+ opt.normal_class,  # opt.data_path
                               transform=transforms.Compose([
                                   transforms.Grayscale(),
                                   transforms.Resize((45, 45)),
                                   transforms.ToTensor(),
                                   transforms.Normalize([0.5], [0.5]),
                               ]))
    dataloader = torch.utils.data.DataLoader(dataset,
                                             batch_size=opt.batch_size,
                                             shuffle=True,
                                             num_workers=opt.n_threads,
                                             drop_last=opt.drop_last)
    return dataloader
# opt.data_path # opt.data_path