def __init__(self, path):
    subset = None
    if osp.isdir(path):
        self._path = path
    elif osp.isfile(path):
        subset = osp.splitext(osp.basename(path).split('_')[2])[0]
        self._path = osp.dirname(path)
    else:
        raise Exception(("Can't read annotations from '%s'" % path))
    annotation_files = [p for p in os.listdir(self._path) if ((osp.basename(p).startswith(VggFace2Path.BBOXES_FILE) or osp.basename(p).startswith(VggFace2Path.LANDMARKS_FILE)) and p.endswith('.csv'))]
    if (len(annotation_files) < 1):
        raise Exception(("Can't find annotations in the directory '%s'" % path))
    super().__init__()
    self._dataset_dir = osp.dirname(self._path)
    self._subsets = ({subset} if subset else set((osp.splitext(f.split('_')[2])[0] for f in annotation_files)))
    self._categories = {}
    self._items = []
    self._load_categories()
    for subset in self._subsets:
        self._items.extend(list(self._load_items(subset).values()))
def __init__(self, path):
    subset = None
    if osp.isdir(path):
        self._path = path
    elif osp.isfile(path):
        subset = osp.splitext(osp.basename(path).split('_')[2])[0]
        self._path = osp.dirname(path)
    else:
        raise Exception(("Can't read annotations from '%s'" % path))
    annotation_files = [p for p in os.listdir(self._path) if ((osp.basename(p).startswith(VggFace2Path.BBOXES_FILE) or osp.basename(p).startswith(VggFace2Path.LANDMARKS_FILE)) and p.endswith('.csv'))]
    if (len(annotation_files) < 1):
        raise Exception(("Can't find annotations in the directory '%s'" % path))
    super().__init__()
    self._dataset_dir = osp.dirname(self._path)
    self._subsets = ({subset} if subset else set((osp.splitext(f.split('_')[2])[0] for f in annotation_files)))
    self._categories = {}
    self._items = []
    self._load_categories()
    for subset in self._subsets:
        self._items.extend(list(self._load_items(subset).values()))