def _load_categories(self):
    label_cat = LabelCategories()
    path = osp.join(self._dataset_dir, VggFace2Path.LABELS_FILE)
    if osp.isfile(path):
        with open(path, encoding='utf-8') as labels_file:
            lines = [s.strip() for s in labels_file]
        for line in lines:
            objects = line.split()
            label = objects[0]
            class_name = None
            if (1 < len(objects)):
                class_name = objects[1]
            label_cat.add(label, parent=class_name)
    else:
        for subset in self._subsets:
            subset_path = osp.join(self._dataset_dir, subset)
            if osp.isdir(subset_path):
                for images_dir in sorted(os.listdir(subset_path)):
                    if (osp.isdir(osp.join(subset_path, images_dir)) and (images_dir != VggFace2Path.IMAGES_DIR_NO_LABEL)):
                        label_cat.add(images_dir)
    self._categories[AnnotationType.label] = label_cat
def _load_categories(self):
    label_cat = LabelCategories()
    path = osp.join(self._dataset_dir, VggFace2Path.LABELS_FILE)
    if osp.isfile(path):
        with open(path, encoding='utf-8') as labels_file:
            lines = [s.strip() for s in labels_file]
        for line in lines:
            objects = line.split()
            label = objects[0]
            class_name = None
            if (1 < len(objects)):
                class_name = objects[1]
            label_cat.add(label, parent=class_name)
    else:
        for subset in self._subsets:
            subset_path = osp.join(self._dataset_dir, subset)
            if osp.isdir(subset_path):
                for images_dir in sorted(os.listdir(subset_path)):
                    if (osp.isdir(osp.join(subset_path, images_dir)) and (images_dir != VggFace2Path.IMAGES_DIR_NO_LABEL)):
                        label_cat.add(images_dir)
    self._categories[AnnotationType.label] = label_cat