def METHOD_NAME(self, annotation, prediction):
    target_height = self.dst_height or self.image_size[0]
    target_width = self.dst_width or self.image_size[1]
    if self._deprocess_predictions:
        target_height, target_width = self.image_size[:2]
    @singledispatch
    def resize_segmentation_mask(entry, height, width):
        return entry
    @resize_segmentation_mask.register(SegmentationPrediction)
    @resize_segmentation_mask.register(AnomalySegmentationPrediction)
    @resize_segmentation_mask.register(BackgroundMattingPrediction)
    @resize_segmentation_mask.register(SalientRegionPrediction)
    def _(entry, height, width):
        if len(entry.mask.shape) == 2:
            entry.mask = self.segm_resize(entry.mask, width, height)
            return entry
        entry_mask = []
        for class_mask in entry.mask:
            resized_mask = self.segm_resize(class_mask, width, height)
            entry_mask.append(resized_mask)
        entry.mask = np.array(entry_mask)
        return entry
    @resize_segmentation_mask.register(SegmentationAnnotation)
    @resize_segmentation_mask.register(AnomalySegmentationAnnotation)
    @resize_segmentation_mask.register(BackgroundMattingAnnotation)
    @resize_segmentation_mask.register(SalientRegionAnnotation)
    def _(entry, height, width):
        entry.mask = self.segm_resize(entry.mask, width, height)
        return entry
    for target in annotation:
        resize_segmentation_mask(target, target_height, target_width)
    for target in prediction:
        resize_segmentation_mask(target, target_height, target_width)
    self._deprocess_predictions = False
    return annotation, prediction