(directory: str)
return classes, class_to_idx
Finds the class folders in a dataset.

    See :class:`DatasetFolder` for details.
Finds the class folders in a dataset.
Finds the class folders in a dataset .
def find_classes(directory: str) -> Tuple[List[str], Dict[str, int]]:
    """Finds the class folders in a dataset.

    See :class:`DatasetFolder` for details.
    """
    classes = sorted(
        entry.name for entry in os.scandir(directory) if entry.is_dir())
    if not classes:
        raise FileNotFoundError(
            f"Couldn't find any class folder in {directory}.")

    class_to_idx = {cls_name: i for i, cls_name in enumerate(classes)}
    return classes, class_to_idx
def find_classes ( directory : str ) -> Tuple [ List [ str ] , Dict [ str , int ] ] : classes = sorted ( entry . name for entry in os . scandir ( directory ) if entry . is_dir ( ) ) if not classes : raise FileNotFoundError ( f"Couldn't find any class folder in {directory}." ) class_to_idx = { cls_name : i for i , cls_name in enumerate ( classes ) } return classes , class_to_idx