from pathlib import Path
from typing import List
from typing import Tuple


def load_dataset_paths(dataset_root: Path, img_extensions: set) -> List[Tuple[Path, Path]]:
    """ loads dataset paths

    Args:
        dataset_root (Path): path to the data
        img_extensions (set): set of image extensions

    Returns:
        List[Tuple[Path, Path]]: list of tuples of image paths and ground truth paths
    """
    images_path = dataset_root / "images"
    gt_path = dataset_root / "gt"

    img_paths = [p for p in images_path.iterdir() if p.suffix in img_extensions]
    gt_paths = [gt_path / f"{img_path.stem}.txt" for img_path in img_paths]
    return list(zip(img_paths, gt_paths))