class_docstr: Read images of label and prediciton from bytes to numpy array.
docstr: Reads images from extracts.
docstr_tok: ["Reads","images","from","extracts","."]
code: def _read_image_in_mutliple_dicts(
      self,
      key: str,
      label_or_prediction: str,
      decode_image: bool,
      extracts: util.StandardExtracts,
  ):
      """Reads images from extracts."""
      if label_or_prediction not in ["label", "prediction"]:
          raise ValueError(
              "The function could only search in the lables or predictions."
          )
      if label_or_prediction == "label":
          one_dict_to_search = (
              extracts.get_labels(self._model_name) or {}
          )
      else:
          one_dict_to_search = (
              extracts.get_predictions(self._model_name) or {}
          )
      dict_to_search = collections.ChainMap(
          one_dict_to_search,
          extracts.get_features() or {},
          extracts.get_transformed_features(self._model_name) or {},
      )
      if not dict_to_search or key not in dict_to_search:
          raise ValueError(
              f"{key} is not found in {list(dict_to_search.keys())}"
          )
      if decode_image:
          result = _image_bytes_to_numpy_array(dict_to_search[key])
      else:
          result = dict_to_search[key]
      return 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 2 for calling the DecodeImagePreprocessor obj's underlying member method code with example usage: obj._read_image_in_mutliple_dicts(key, label_or_prediction, decode_image, extracts) and returns: result