class_docstr: A :class:`.Output` which converts the model outputs to FiftyOne segmentation format.
  
  Args:
      labels_map: A dictionary that map the labels ids to pixel intensities.
      visualize: whether to visualize the image labels.
      return_filepath: Boolean determining whether to return a dict
          containing filepath and FiftyOne labels (True) or only a list of
          FiftyOne labels (False).
code: def transform(
      self, sample: Dict[str, Tensor]
  ) -> Union[Segmentation, Dict[str, Any]]:
      labels = super().transform(sample)
      fo_predictions = fol.Segmentation(mask=np.array(labels))
      if self.return_filepath:
          filepath = sample[DataKeys.METADATA]["filepath"]
          return {"filepath": filepath, "predictions": fo_predictions}
      return fo_predictions
  
imports: import random
  from typing import Any, Dict, Optional, Tuple, Union
  import numpy
  import torch
  from torch import Tensor
  import flash
  from flash.core.data.io.input import DataKeys
  from flash.core.data.io.output import Output
  from flash.core.registry import FlashRegistry
  from flash.core.utilities.imports import _FIFTYONE_AVAILABLE, _MATPLOTLIB_AVAILABLE, _TORCHVISION_AVAILABLE, lazy_import, requires
  from flash.core.utilities.providers import _FIFTYONE
label_desc: Use image node_id 2 for calling the FiftyOneSegmentationLabelsOutput obj's underlying member method code with example usage: obj.transform(sample) and returns: fo_predictions, dict