class_docstr: Computes confusion matrices for semantic segmentation.
class_docstr_tok: ["Computes","confusion","matrices","for","semantic","segmentation","."]
code: def _metric_computations(
      self,
      class_ids: List[int],
      ground_truth_key: str,
      prediction_key: str,
      decode_ground_truth: bool = True,
      decode_prediction: bool = False,
      ignore_ground_truth_id: Optional[int] = None,
      name: Optional[str] = None,
      eval_config: Optional[config_pb2.EvalConfig] = None,
      model_name: str = "",
      output_name: str = "",
      example_weighted: bool = False,
      **kwargs,
  ) -> metric_types.MetricComputations:
      preprocessor = preprocessors.DecodeImagePreprocessor(
          ground_truth_key=ground_truth_key,
          prediction_key=prediction_key,
          decode_ground_truth=decode_ground_truth,
          decode_prediction=decode_prediction,
          name=name,
          model_name=model_name,
      )
      # The model output is the key to store images and other informations.
      # The output name should not be set.
      # sub_key should not be set. The class_id info will be encoded in sub_key
      # in the combiners.
      key = metric_types.MetricKey(
          name=name,
          model_name=model_name,
          output_name="",
          sub_key=None,
          example_weighted=example_weighted,
      )
  
      return [
          metric_types.MetricComputation(
              keys=[key],
              preprocessors=[preprocessor],
              combiner=_SemanticSegmentationConfusionMatrixCombiner(
                  key=key,
                  class_ids=class_ids,
                  ignore_ground_truth_id=ignore_ground_truth_id,
              ),
          )
      ]
  
imports: import abc
  from typing import Any, Dict, Iterable, List, Optional, Union
  import apache_beam
  import numpy
  from tensorflow_model_analysis.contrib.aggregates import binary_confusion_matrices
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.metrics import preprocessors
  from tensorflow_model_analysis.proto import config_pb2
label_desc: Use image node_id 3 for calling the SemanticSegmentationConfusionMatrix obj's underlying member method code with example usage: obj._metric_computations(class_ids, ground_truth_key, prediction_key, decode_ground_truth, decode_prediction, ignore_ground_truth_id, name, eval_config, model_name, output_name, example_weighted) and returns: list