def _load_categories(cvat_anno): categories = {} label_categories = datumaro.LabelCategories() for _, label in cvat_anno.meta['task']['labels']: label_categories.add(label['name']) for _, attr in label['attributes']: label_categories.attributes.add(attr['name']) categories[datumaro.AnnotationType.label] = label_categories return categories
def _generate_categories(self): categories = {} label_categories = datumaro.LabelCategories() db_labels = self._db_task.label_set.all() for db_label in db_labels: db_attributes = db_label.attributespec_set.all() label_categories.add(db_label.name) for db_attr in db_attributes: label_categories.attributes.add(db_attr.name) categories[datumaro.AnnotationType.label] = label_categories return categories