def split_penn_fudan(
    n_experiences: int,
    train_transform=None,
    eval_transform=None,
    shuffle=True,
    root_path: Union[str, Path] = None,
):
    """
    Creates an example benchmark based on the Penn-Fudan Pedestrian dataset.

    This is a toy benchmark created only to show how a detection benchmark can
    be created. It was not meant to be used for research purposes!

    :param n_experiences: The number of train experiences to create.
    :param train_transform: The train transformation.
    :param eval_transform: The eval transformation.
    :param shuffle: If True, the dataset will be split randomly
    :param root_path: The root path of the dataset. Defaults to None,
        which means that the default path will be used.
    :return: A :class:`DetectionScenario` instance.
    """

    dataset = PennFudanDataset(root=root_path)
    # The test size of 50 is used here:
    # https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html
    test_size = 50
    train_size = len(dataset) - test_size
    if shuffle:
        train_dataset, test_dataset = random_split(dataset, [train_size, test_size])
    else:
        indices = list(range(len(dataset)))
        train_dataset = Subset(dataset, indices[:-test_size])
        test_dataset = Subset(dataset, indices[-test_size:])

    return split_detection_benchmark(
        n_experiences=n_experiences,
        train_dataset=train_dataset,
        test_dataset=test_dataset,
        n_classes=1,  # There is only one class: pedestrian
        train_transform=train_transform,
        eval_transform=eval_transform,
        shuffle=shuffle,
    )

    Creates an example benchmark based on the Penn-Fudan Pedestrian dataset.

    This is a toy benchmark created only to show how a detection benchmark can
    be created. It was not meant to be used for research purposes!

    :param n_experiences: The number of train experiences to create.
    :param train_transform: The train transformation.
    :param eval_transform: The eval transformation.
    :param shuffle: If True, the dataset will be split randomly
    :param root_path: The root path of the dataset. Defaults to None,
        which means that the default path will be used.
    :return: A :class:`DetectionScenario` instance.
    
examples/detection.py