Skip to content

Support training on a selected subset of classes #1354

Description

@K-saif

Search before asking

  • I have searched the RF-DETR issues and found no similar feature requests.

Description

Add an option to select specific dataset classes to use during training, without requiring users to create a separate filtered dataset.

For example:

model.train(
    dataset_dir="dataset",
    only_classes=[0, 4],        # new feature
)

Original classes:
0 → person
1 → car
2 → bicycle
3 → dog
4 → cat
5 → truck

only_classes = [0, 4]

After filtering/remapping:
0 → person
1 → cat

Use case

I'm working with a very large multi-class dataset and sometimes need to train a model on only a subset of the available classes. Creating a separate filtered copy of the dataset for each experiment can be time- and storage-consuming.

Being able to select the required classes directly during training would make this workflow much more convenient.

Additional

I couldn't find an existing training parameter that provides this functionality, so I believe this could be a useful addition to RF-DETR.

I'm happy to work on the implementation and tests if the maintainers think this would be a good fit.

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions