Skip to content

Commit

Permalink
added background class
Browse files Browse the repository at this point in the history
  • Loading branch information
nkaenzig committed Nov 14, 2024
1 parent 08a3c8a commit f382733
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,15 @@ def get_filename(path: str) -> str:
is_subset = all(name in all_classes for name in self._classes)
if not is_subset:
raise ValueError("Provided class names are not subset of the original ones.")
return sorted(self._classes)
classes = sorted(self._classes)
elif self._class_mappings:
is_subset = all(name in all_classes for name in self._class_mappings.keys())
if not is_subset:
raise ValueError("Provided class names are not subset of the original ones.")
return sorted(set(self._class_mappings.values()))
return all_classes
classes = sorted(set(self._class_mappings.values()))
else:
classes = all_classes
return ["background"] + classes

@property
@override
Expand Down Expand Up @@ -195,7 +197,7 @@ def validate(self) -> None:
_validators.check_dataset_integrity(
self,
length=self._expected_dataset_lengths.get(f"{self._split}_{self._version}", 0),
n_classes=n_classes,
n_classes=n_classes+1,
first_and_last_labels=first_and_last_labels,
)

Expand Down

0 comments on commit f382733

Please sign in to comment.