Commit a32e189 1 parent a8d2568 commit a32e189 Copy full SHA for a32e189
File tree 1 file changed +22
-1
lines changed
detectionmetrics/datasets
1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,28 @@ def append(self, new_dataset: Self):
44
44
:param new_dataset: Dataset to be appended
45
45
:type new_dataset: Self
46
46
"""
47
- assert self .ontology == new_dataset .ontology , "Ontologies don't match"
47
+ if not self .has_label_count :
48
+ assert self .ontology == new_dataset .ontology , "Ontologies don't match"
49
+ else :
50
+ # Check if classes match
51
+ assert (
52
+ self .ontology .keys () == new_dataset .ontology .keys ()
53
+ ), "Ontologies don't match"
54
+ for class_name in self .ontology :
55
+ # Check if indices, and RGB values match
56
+ assert (
57
+ self .ontology [class_name ]["idx" ]
58
+ == new_dataset .ontology [class_name ]["idx" ]
59
+ ), "Ontologies don't match"
60
+ assert (
61
+ self .ontology [class_name ]["rgb" ]
62
+ == new_dataset .ontology [class_name ]["rgb" ]
63
+ ), "Ontologies don't match"
64
+
65
+ # Accumulate label count
66
+ self .ontology [class_name ]["label_count" ] += new_dataset .ontology [
67
+ class_name
68
+ ]["label_count" ]
48
69
49
70
# Global filenames to avoid dealing with each dataset relative location
50
71
self .make_fname_global ()
You can’t perform that action at this time.
0 commit comments