Resnet for Image Classification

I am working on the resnet-18 model on PyTorch. I have separate data in a folder. I want to load the dataset but I tried many options and failed. Can anyone provide some link or code where I can load separate data in PyTorch for further analysis?

Hi @Nehhar,

there is a chapter in Deep Learning for Coders that might be perfect for your plans: chapter 14 ResNet. ResNet-18 and ResNet-50 are built from scratch.


Hello @JackByte. I tried all the steps. I am trying some images that I had taken while photography. Now how should I load the image in the dataset format or in a CSV file to execute further steps?

This is the error that I am getting :

All the images that I have here are in ‘jpg’ format

Hi @Nehhar,

you could choose what is more convenient for your

a) Create a folder “train” another folder “valid”, then add one folder with the class name for each class under each of them. Then you could use ImageDataLoaders.from_folder



b) Create a csv with the columns “filename”, “class”, and “is_valid” and use ImageDataLoaders.from_csv

c) … Have a look at the other ImageDataLoaders.

1 Like

Thank you for the solution

1 Like

Thanks for the information. I’ll be sure to keep an eye on this thread. Looking for the same issue.

myccpay account