def METHOD_NAME(
    self,
) -> Tuple[List[str], List[str], List[str], List[str], Optional[str]]:
    """Parses the given directory to generate a list of image and annotation paths.
    Returns:
        A tuple with, respectively, list of supported images, list of encountered invalid files, list of encountered extensions and the most frequent extension
    """
    supported_image_extensions = tuple(
        "." + fmt for fmt in HTYPE_SUPPORTED_COMPRESSIONS["image"] + ["jpg"]
    )
    supported_images = []
    supported_annotations = []
    invalid_files = []
    image_extensions: DefaultDict[str, int] = defaultdict(int)
    if self.separate_annotations:
        for file in self.provider_annotations:
            if file.lower().endswith(".txt"):
                supported_annotations.append(file)
            else:
                invalid_files.append(file)
        for file in self.provider:
            if file.endswith(supported_image_extensions):
                supported_images.append(file)
                ext = file.rsplit(".", 1)[1]
                image_extensions[ext] += 1
            else:
                invalid_files.append(file)
    else:
        for file in self.provider:
            if file.endswith(".txt"):
                supported_annotations.append(file)
            elif file.endswith(supported_image_extensions):
                supported_images.append(file)
                ext = pathlib.Path(file).suffix[
                    1:
                ]  # Get extension without the . symbol
                image_extensions[ext] += 1
            else:
                invalid_files.append(file)
    if len(invalid_files) > 0:
        logger.warning(
            f"Encountered {len(invalid_files)} unsupported files in the data folders and annotation folders (if specified)."
            + "\nUp to first 10 invalid files are:\n"
            + "\n".join(invalid_files[0:10])
        )
    most_frequent_image_extension = max(
        image_extensions, key=lambda k: image_extensions[k], default=None
    )
    return (
        supported_images,
        supported_annotations,
        invalid_files,
        list(image_extensions.keys()),
        most_frequent_image_extension,
    )