PyTorch Dataloader and training

Hello everyone,

I am brand new to using PyTorch and just trying to implement some older computer vision white papers to get a hang of how this all works. I had two main questions which I will ask and then elaborate on below, any guidance would be much appreciated.

  1. How to use the PyTorch DataSet class and Data loader to train my network if the data set is a folder containing a few thousand images.

  2. How do the images get passed to the model class I create?

I am implemented the semantic segmentation model known as SegNet. I have been able to figure out how to build my model at least in terms of building the constructor and forward definition. I am now trying to build my train.py, but am really struggling with using the PyTorch data loader for image data sets contained in a folder directory and not a csv setup. Can anyone point me to an example that shows me how this works? And possibly an explanation? All the examples I find use CSV files where as I just have a few thousand .png files for training and testing.

I am also confused on how the images are passed to the forward function in my class “class SegNet(nn.Module):”. I never see a direct pass of the images to the network model in most examples and just wondered how they get there. What I mean is most examples I see call the class in the the train.py script and then load the data but is there some method to passing the data directly to the forward definition? I never see a directly call to the forward function where some variable storing the dataset is passed. I’m pretty new to all this so any help would be much appreciated cause I might be thinking about this all wrong.

Hi,
this tutorial https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html have a example for such a dataloader which you are sreaching.

Greets