Change targets of torchvision dataset

Hello there.
I have some data in data folder and I read them like this
path = os.path.join(os.getcwd(),'../../kitti/dataset/sequences/',seq)
data_in_path = torchvision.datasets.ImageFolder(path)
the problem is that in my task the labels are not classification targets. each data has its own target which is a float tensor by shape (6,1).
how can I change the classification targets in the dataset i have loaded?
I also tried writing custom dataset and reading the image samples. but they were just the path of images. Is it possible for the dataloader to read images from their addresses?

I think the best approach would still be to write a custom Dataset and read the images from their path by using e.g. In fact, the ImageFolder does the same as seen here.
I don’t know how the targets are created, but I assume you could either create or load them using the same index as used for the image paths.

Thanks for answering Peter.
Yes. The indexes are the same.
I will try the solution you mentioned and write here about it.