def subsample(self, indices: Sequence[int], inplace: bool = False) -> "AnomalibDataset":
        """Create a subset of the dataset using the provided indices.

        Args:
            indices (Sequence[int]): Indices at which the dataset is to be subsampled.
            inplace (bool, optional): When true, modify the instance itself. Defaults to
                ``False``.

        Returns:
            AnomalibDataset: Subsampled dataset.

        Raises:
            ValueError: If duplicate indices are provided.

        Example:
            >>> dataset = AnomalibDataset()
            >>> subset = dataset.subsample([0, 1, 2])
            >>> len(subset)
            3
        """
        if len(set(indices)) != len(indices):
            msg = "No duplicates allowed in indices."
            raise ValueError(msg)
        dataset = self if inplace else copy.deepcopy(self)
        dataset.samples = self.samples.iloc[indices].reset_index(drop=True)
        return dataset
Create a subset of the dataset using the provided indices.

        Args:
            indices (Sequence[int]): Indices at which the dataset is to be subsampled.
            inplace (bool, optional): When true, modify the instance itself. Defaults to
                ``False``.

        Returns:
            AnomalibDataset: Subsampled dataset.

        Raises:
            ValueError: If duplicate indices are provided.

        Example:
            >>> dataset = AnomalibDataset()
            >>> subset = dataset.subsample([0, 1, 2])
            >>> len(subset)
            3
        
src/anomalib/data/datasets/base/image.py