Hi, everyone!
I’m pretty new on PyTorch, and until now I’ve done several tutorials in which I think they download the data from torchvision but at the moment I never loaded my own data.
I am trying to do a classification task with three labels, and I have several png’s distributed in three different folders depending on the label.
I have the folder ‘dataset’ in the same folder where the .py file I’m working on is, and the path from here is ‘/dataset/train/each label’.
So there are two questions:
How do I get to the png files, upload them and transform them to tensors? It seems that it’s not looking inside the same folder where my PyTorch file is…
And second, once I get to the files, how do I label the files in each folder? Usually, as long as I made models, label and sample are in the same file…
The code I have for now is this:
import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
train_path = './dataset/train/Covid'
train_dataset = torchvision.datasets.ImageFolder(
root=train_path,
transform=transforms.ToTensor()
)
It doesn’t even find the directory…
Thanks in advance!