How to use torch.utils.data.DataLoader for my custom dataset

Sorry if this question is already asked.
I am new to the whole thing.
I want to know how to use DataLoader and split my data for training and testing sets.

So let’s say I have a folder called MyImgs, which includes 100 images, images are all 25x25 and they are RGB.
So my data is 100x3x25x25.
What should I do now, should I divide them into two separate folders (testing and training) and then do something or I don’t need to do that?

I am following the steps from the training your classifier tutorial, but I do not know how to change the lines that are related to loading the data.

Thank you very much for your help in advance and sorry for the naive question.

You can use TensorDataset to create dataset from a tensor. You can split the 100x30x25x25 tensor into two and create two datasets for train and val.

Creating your dataset is also fairly transparent. Check out this tutorial: http://pytorch.org/tutorials/beginner/data_loading_tutorial.html

1 Like