Skip to content

Commit adeca57

Browse files
committed
Introduce background_class83422 so that class names index from 1
1 parent f108f85 commit adeca57

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

rfdetr/detr.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ def train_from_config(self, config: TrainConfig, **kwargs):
130130
) as f:
131131
anns = json.load(f)
132132
num_classes = len(anns["categories"])
133-
class_names = [c["name"] for c in anns["categories"] if c["supercategory"] != "none"]
133+
class_names = [c["name"] for c in anns["categories"] if c["supercategory"] != "none" and c["name"] != "background_class83422"]
134+
class_names.insert(0, "background_class83422")
135+
num_classes = len(class_names)
134136
self.model.class_names = class_names
135137
elif config.dataset_file == "coco":
136138
class_names = COCO_CLASSES

0 commit comments

Comments
 (0)