Torch ImageFolder but for regression Task

Hi Guys,

I am trying to find a solution, I am trying to perform a regression on some images.
How would I go about adapting the ImageFolder or DatasetFolder to read in the numeric values rather than the classes.

I was thinking to just include the target value in the name of the image

The best approach would be to create a custom Dataset as described here and implement the logic to create the target (e.g. by reading them from the image names etc.) manually.
ImageFolder uses the folder structure to create the class indices, so it wouldn’t be a good fit for your use case (changing the internals would most likely be equal to creating a custom dataset).

1 Like

Thank you very. I was not aware of the example you linked to. I think this will be enough for me to get it to work.