def subsample_regions(regions: dict[str, torch.Tensor], indices: torch.Tensor) -> dict[str, torch.Tensor]:
        """Subsample the items in a region dictionary based on a Tensor of indices.

        Args:
            regions (dict[str, torch.Tensor]): Region detections for a single image in
                the batch.
            indices (torch.Tensor): Indices of region detections that should be kept.

        Returns:
            dict[str, torch.Tensor]: Subsampled region detections containing only the
                specified indices.
        """
        new_regions_dict = {}
        for key, value in regions.items():
            new_regions_dict[key] = value[indices]
        return new_regions_dict
Subsample the items in a region dictionary based on a Tensor of indices.

        Args:
            regions (dict[str, torch.Tensor]): Region detections for a single image in
                the batch.
            indices (torch.Tensor): Indices of region detections that should be kept.

        Returns:
            dict[str, torch.Tensor]: Subsampled region detections containing only the
                specified indices.
        
src/anomalib/models/video/ai_vad/regions.py