How to load own images dataset

how to load my own images data. and how i can modify this code for loading images. i have 3064 images data,with image dimensions [512x512]

training_data= (15.000,224*224*3)
training_labels= (15.000,)
traindir = os.path.join(, 'train')
  train_dataset = datasets.ImageFolder(
            transforms.RandomSizedCrop(size[0]), #224 , 299
labels = len(train_dataset.classes)

   train_loader =
        train_dataset, batch_size=args.batch_size, shuffle=(train_sampler is None),
num_workers=args.workers,  sampler=train_sampler)
    for i, (input, target) in enumerate(train_loader):
        if cuda:
            input, target = input.cuda(async=True), target.cuda(async=True)

        input_var = torch.autograd.Variable(input)
        target_var = torch.autograd.Variable(target)

I think you are already halfway there. Only thing that seems missing is connecting your images with the right class labels if this is supposed to be a supervised task. i have some examples here if helpful:

1 Like