class_docstr: ``SemanticSegmentation`` is a :class:`~flash.Task` for semantic segmentation of images. For more details, see
  :ref:`semantic_segmentation`.
  
  Args:
      num_classes: Number of classes to classify.
      backbone: A string or model to use to compute image features.
      backbone_kwargs: Additional arguments for the backbone configuration.
      head: A string or (model, num_features) tuple to use to compute image features.
      head_kwargs: Additional arguments for the head configuration.
      pretrained: Use a pretrained backbone.
      loss_fn: Loss function for training.
      optimizer: Optimizer to use for training.
      lr_scheduler: The LR scheduler to use during training.
      metrics: Metrics to compute for training and evaluation. Can either be an metric from the `torchmetrics`
          package, a custom metric inherenting from `torchmetrics.Metric`, a callable function or a list/dict
          containing a combination of the aforementioned. In all cases, each metric needs to have the signature
          `metric(preds,target)` and return a single scalar tensor. Defaults to :class:`torchmetrics.IOU`.
      learning_rate: Learning rate to use for training. If ``None`` (the default) then the default LR for your chosen
          optimizer will be used.
      multi_label: Whether the targets are multi-label or not.
      output: The :class:`~flash.core.data.io.output.Output` to use when formatting prediction outputs.
      output_transform: :class:`~flash.core.data.io.output_transform.OutputTransform` use for post processing samples.
code: def validation_step(self, batch: Any, batch_idx: int) -> Any:
      batch = (batch[DataKeys.INPUT], batch[DataKeys.TARGET])
      return super().validation_step(batch, batch_idx)
  
imports: from typing import Any, Dict, List, Optional, Type, Union
  from torch import Tensor, nn
  from torch.nn import functional
  from flash.core.classification import ClassificationTask
  from flash.core.data.io.input import DataKeys, ServeInput
  from flash.core.data.io.output import Output
  from flash.core.data.io.output_transform import OutputTransform
  from flash.core.model import Task
  from flash.core.registry import FlashRegistry
  from flash.core.serve import Composition
  from flash.core.utilities.imports import _TM_GREATER_EQUAL_0_10_0, _TORCHVISION_AVAILABLE, _TORCHVISION_GREATER_EQUAL_0_9, requires
  from flash.core.utilities.isinstance import _isinstance
  from flash.core.utilities.types import INPUT_TRANSFORM_TYPE, LOSS_FN_TYPE, LR_SCHEDULER_TYPE, METRICS_TYPE, OPTIMIZER_TYPE, OUTPUT_TRANSFORM_TYPE
  from flash.image.data import ImageDeserializer
  from flash.image.segmentation.backbones import SEMANTIC_SEGMENTATION_BACKBONES
  from flash.image.segmentation.heads import SEMANTIC_SEGMENTATION_HEADS
  from flash.image.segmentation.input_transform import SemanticSegmentationInputTransform
  from flash.image.segmentation.output import SEMANTIC_SEGMENTATION_OUTPUTS
label_desc: Use image node_id 3 for calling the SemanticSegmentation obj's underlying member method code with example usage: obj.validation_step(batch, batch_idx) and returns: super