pytorch / pytorch/vision

ImageFolder work-a-like for regression tasks

Open
#2,930 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

module: datasets needs discussion
Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with torchvision.datasets.ImageFolder and its getitem behavior. Compare the proposed target_scores dict or JSON input with the requirement to ignore class-directory structure. Done means an agreed regression dataset API, a documented target format, and coverage for returning sample-score pairs.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.