def compare_taxonomy(self, taxonomy: Taxonomy2) -> Tuple[bool, List[List[str]]]: """Ensure self labels match taxonomy.""" check = compare_taxonomy(category_path=self.labels.category, taxonomy=taxonomy) if check: return check, [["null", "null"]] else: return check, self.labels.category
def compare_taxonomy(self, taxonomy: Taxonomy2) -> Tuple[bool, List[List[str]]]: """Compare the label classes with the taxonomy.""" # Iterate over each label for label in self.labels: check_ = compare_taxonomy(label.classname, taxonomy) if not check_: return False, label.classname return True, [["null", "null"]]
def test_compare() -> None: """Test category path with simple taxonomy.""" Taxonomy1 = Taxonomy2(remote_tax=TAXONOMY1["taxonomy"]) cat_path = [["object", "car"]] assert compare_taxonomy(cat_path, Taxonomy1) cat_path2 = [["object", "not correct"]] assert not compare_taxonomy(cat_path2, Taxonomy1) cat_path3 = [["not correct", "car"]] assert not compare_taxonomy(cat_path3, Taxonomy1) cat_path4 = [["object"]] assert not compare_taxonomy(cat_path4, Taxonomy1) cat_path5 = [["object", "car", "not correct"]] assert not compare_taxonomy(cat_path5, Taxonomy1)
def compare_taxonomy(self, taxonomy: Taxonomy2) -> Tuple[bool, List[List[str]]]: """Ensure self labels match taxonomy.""" for label in self.labels: check = compare_taxonomy(category_path=label.category, taxonomy=taxonomy) if not check: return check, label.category return True, [["null", "null"]]
def compare_taxonomy(self, taxonomy: Taxonomy2) -> Tuple[bool, List[List[str]]]: """Ensure labels abide by taxonomy.""" # Iterate over each frame for label in self.labels: check = compare_taxonomy(category_path=label.classname, taxonomy=taxonomy) if not check: return check, label.classname return True, [["null", "null"]]