How can l get my own dataset into torchvision.datasets format?

Hello,

l want to transform my data set into torchvision format.

l have a numpy array which represents training examples as follow :
l have 15,000 training examples each of224*224*3

so the dimension of my data is dimension=(15.000, 224*224*3)
and another numpy array which contains lables .Its dimension is (15.000, )

Hence

training_data= (15.000,224*224*3)
training_labels= (15.000,)

My question is as follow :

how can l transform my own data to pytorch format from

training_data= (15.000,224*224*3)
training_labels= (15.000,)

to

 traindir = os.path.join(args.data, 'train')
  train_dataset = datasets.ImageFolder(
        traindir,
        transforms.Compose([
            transforms.RandomSizedCrop(size[0]), #224 , 299
            transforms.RandomHorizontalFlip(),
            transforms.ToTensor(),
            normalize,
]))
labels = len(train_dataset.classes)

   train_loader = torch.utils.data.DataLoader(
        train_dataset, batch_size=args.batch_size, shuffle=(train_sampler is None),
num_workers=args.workers,  sampler=train_sampler)

so that to make the training in pytorch format

  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)

Thank you

Since you already have your data in numpy, I would suggest to build an own Dataset, instead of using ImageFolder.

Here is a good example how to create a Dataset.

Also your image data seems to be flat. Try to reshape it to [batch, channel, width, height].

Thanks for your answer