def find_classes(self, directory):
        """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
Finds the class folders in a dataset.
        See :class:`DatasetFolder` for details.
        
analyze/convnexts4nd/src/dataloaders/vision.py