Skip to content

Attribute 'feature' error in finetuning RT-DETRv2 #9

@Jorge-RM

Description

@Jorge-RM

When I run RT_DETR_v2_finetune_on_a_custom_dataset.ipynb, I get this error:

AttributeError                            Traceback (most recent call last)
[/tmp/ipython-input-86719368.py](https://localhost:8080/#) in <cell line: 0>()
      3 
      4 # Get mapping from category id to category name
----> 5 categories = dataset["train"].features["objects"].feature["category"].names
      6 id2label = {index: x for index, x in enumerate(categories, start=0)}
      7 label2id = {v: k for k, v in id2label.items()}

AttributeError: 'dict' object has no attribute 'feature'

I solved it by changing the line 5 like this:
categories = dataset["train"].features["objects"]["category"].feature.names

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions