class_docstr: Read images of label and prediciton from bytes to numpy array.
docstr: Reads and decodes images from extracts.
  
  It will search in labels/predictions, features and transformed features. It
  also support decoding image from bytes.
  
  Args:
    extracts: A tfma extract contains the image data.
  
  Yields:
    A standard metric input contains the following key and values:
     - {'labels'}: A numpy array represents the image of labels.
     - {'predictions'}: A numpy array represents the image of predictions.
     - {'example_weights'}: (Optional) A numpy array represents the example
       weights.
docstr_tok: ["Reads","and","decodes","images","from","extracts",".","It","will","search","in","labels\/predictions",",","features","and","transformed","features",".","It","also","support","decoding","image","from","bytes",".","Args",":","extracts",":","A","tfma","extract","contains","the","image","data",".","Yields",":","A","standard","metric","input","contains","the","following","key","and","values",":","-","{","'labels","'","}",":","A","numpy","array","represents","the","image","of","labels",".","-","{","'predictions","'","}",":","A","numpy","array","represents","the","image","of","predictions",".","-","{","'example_weights","'","}",":","(","Optional",")","A","numpy","array","represents","the","example","weights","."]
code: def process(
      self, extracts: types.Extracts
  ) -> Iterator[metric_types.StandardMetricInputs]:
      """Reads and decodes images from extracts.
  
      It will search in labels/predictions, features and transformed features. It
      also support decoding image from bytes.
  
      Args:
        extracts: A tfma extract contains the image data.
  
      Yields:
        A standard metric input contains the following key and values:
         - {'labels'}: A numpy array represents the image of labels.
         - {'predictions'}: A numpy array represents the image of predictions.
         - {'example_weights'}: (Optional) A numpy array represents the example
           weights.
      """
      extracts = util.StandardExtracts(extracts)
      extracted_result = {}
  
      extracted_result[
          constants.LABELS_KEY
      ] = self._read_image_in_mutliple_dicts(
          self._ground_truth_key,
          "label",
          self._decode_ground_truth,
          extracts,
      )
  
      extracted_result[
          constants.PREDICTIONS_KEY
      ] = self._read_image_in_mutliple_dicts(
          self._prediction_key,
          "prediction",
          self._decode_prediction,
          extracts,
      )
  
      if (
          extracted_result[constants.LABELS_KEY].shape
          != extracted_result[constants.PREDICTIONS_KEY].shape
      ):
          raise ValueError(
              "The image size of ground truth "
              f"{extracted_result[constants.LABELS_KEY].shape} does not match "
              "with the image size of prediction "
              f"{extracted_result[constants.PREDICTIONS_KEY]}"
          )
  
      if constants.EXAMPLE_WEIGHTS_KEY in extracts.keys():
          extracted_result = extracts[constants.EXAMPLE_WEIGHTS_KEY]
  
      yield metric_util.to_standard_metric_inputs(extracted_result)
  
file_path: model-analysis/tensorflow_model_analysis/metrics/preprocessors/image_preprocessors.py
imports: import collections
  import io
  from typing import Iterator, Optional, Union
  import numpy
  from PIL import Image
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.utils import util
label_desc: Use image node_id 3 for calling the DecodeImagePreprocessor obj's underlying member method code with example usage: obj.process(extracts) without return types