def parse_image_classification_dir_tree(dataset_dir):
    """Parses the contents of the given image classification dataset directory
    tree, which should have the following format::

        <dataset_dir>/
            <classA>/
                <image1>.<ext>
                <image2>.<ext>
                ...
            <classB>/
                <image1>.<ext>
                <image2>.<ext>
                ...

    Args:
        dataset_dir: the dataset directory

    Returns:
        samples: a list of ``(image_path, target)`` pairs
        classes: a list of class label strings
    """
    samples = []
    for filepath in etau.list_files(dataset_dir, recursive=True):
        chunks = pathlib.PurePath(filepath).parts

        if any(c.startswith(".") for c in chunks):
            continue

        samples.append((filepath, chunks[0]))

    classes = sorted(set(s[1] for s in samples))
    labels_map_rev = {c: i for i, c in enumerate(classes)}

    samples = [
        (os.path.join(dataset_dir, f), labels_map_rev[c]) for f, c in samples
    ]

    return samples, classes
Parses the contents of the given image classification dataset directory
    tree, which should have the following format::

        <dataset_dir>/
            <classA>/
                <image1>.<ext>
                <image2>.<ext>
                ...
            <classB>/
                <image1>.<ext>
                <image2>.<ext>
                ...

    Args:
        dataset_dir: the dataset directory

    Returns:
        samples: a list of ``(image_path, target)`` pairs
        classes: a list of class label strings
    
fiftyone/utils/data/base.py