Description
🚀 Feature
The requested/proposed feature is a close analog of torchvision.datasets.ImageFolder
for regression tasks. The target values could be in a dict or an external JSON file.
Motivation
Thanks to torchvision.models
and torchvision.datasets
, the workflow for using transfer learning from alexnet, resnet, etc. to custom image classification tasks is very streamlined and polished. Datasets can be handled directly in the file system, which makes it easy to use a number of labeling tools that don't necessarily understand PyTorch, but are able to place images in folders like data/train/class1
, data/val/class1
, etc.
It's not as easy to do this for regression tasks, despite these being useful variations (e.g. for NSFW scoring rather than binary classification) of popular transfer learning tasks.
Pitch
Ideally, there would be a drop-in replacement for ImageFolder
accepting the same arguments (such as transform callables) and an additional target_scores
variable accepting a JSON filename or a dict. The method __getitem__
would return a (sample, score) pair.
To facilitate switching from classification to regression tasks, this RegressionImageFolder
would ignore the directory structure that's used for target classes in ImageFolder
.
Alternatives
It's possible that there's no rationale for having ImageFolder
and RegressionImageFolder
as separate dataset loaders and the functionality can be folded into what already exists.
cc @pmeier