def _select_targets(self, item: VideoItem) -> VideoItem:
        """Select the target frame from the clip.

        Args:
            item (VideoItem): Item containing the clip information.

        Returns:
            VideoItem: Selected item from the clip.

        Raises:
            ValueError: If the target frame is not one of the supported options.
        """
        if self.target_frame == VideoTargetFrame.FIRST:
            idx = 0
        elif self.target_frame == VideoTargetFrame.LAST:
            idx = -1
        elif self.target_frame == VideoTargetFrame.MID:
            idx = int(self.clip_length_in_frames / 2)
        else:
            msg = f"Unknown video target frame: {self.target_frame}"
            raise ValueError(msg)

        if item.gt_mask is not None:
            item.gt_mask = item.gt_mask[idx, ...]
        if item.gt_label is not None:
            item.gt_label = item.gt_label[idx]
        if item.original_image is not None:
            item.original_image = item.original_image[idx]
        if item.frames is not None:
            item.frames = item.frames[idx]
        return item
Select the target frame from the clip.

        Args:
            item (VideoItem): Item containing the clip information.

        Returns:
            VideoItem: Selected item from the clip.

        Raises:
            ValueError: If the target frame is not one of the supported options.
        
src/anomalib/data/datasets/base/video.py