#1354·rf-detr

Support training on a selected subset of classes

Author: K-saifCreated Aug 17, 2026Updated Aug 17, 2026
Labelsquestion

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:

python
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!