pytorch / pytorch/vision

[Feature_Request] datasets class_to_idx for all datasets

Open
#237 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

So I noticed that in torchvision.datasets only the ImageFolder class actually has the member called
class_to_idx.

Is there a reason why this isn’t just hard-coded for the other datasets like MNIST, CIFAR and so on, so that one could readily use it for actually getting a class-string for all sorts of visualizations + confusion matrices?

It does seem a little inconvenient to go and manually define the list of all 100 classes for e.g. CIFAR-100.
Do you think this is something that could be added?

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 by comparing ImageFolder's existing class_to_idx member with the MNIST and CIFAR dataset classes, especially CIFAR-100's 100 labels. Clarify whether all relevant visual datasets should expose a consistent class-string mapping, and verify that the mappings support visualizations and confusion matrices.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.