class_docstr: Read images of label and prediciton from bytes to numpy array.
docstr: Initialize the preprocessor for image reading.
  
  Args:
    ground_truth_key: the key for storing the ground truth of encoded image
      with class ids.
    prediction_key: the key for storing the predictions of encoded image with
      class ids.
    decode_ground_truth: If true, the ground truth is assumed to be bytes of
      images and will be decoded.
    decode_prediction: If true, the prediction is assumed to be bytes of
      images and will be decoded.
    name: (Optional) name for the preprocessor.
    model_name: (Optional) model name (if multi-model evaluation).
docstr_tok: ["Initialize","the","preprocessor","for","image","reading",".","Args",":","ground_truth_key",":","the","key","for","storing","the","ground","truth","of","encoded","image","with","class","ids",".","prediction_key",":","the","key","for","storing","the","predictions","of","encoded","image","with","class","ids",".","decode_ground_truth",":","If","true",",","the","ground","truth","is","assumed","to","be","bytes","of","images","and","will","be","decoded",".","decode_prediction",":","If","true",",","the","prediction","is","assumed","to","be","bytes","of","images","and","will","be","decoded",".","name",":","(","Optional",")","name","for","the","preprocessor",".","model_name",":","(","Optional",")","model","name","(","if","multi-model","evaluation",")","."]
code: def __init__(
      self,
      ground_truth_key: str,
      prediction_key: str,
      decode_ground_truth: bool = True,
      decode_prediction: bool = True,
      name: Optional[str] = None,
      model_name: str = "",
  ):
      """Initialize the preprocessor for image reading.
  
      Args:
        ground_truth_key: the key for storing the ground truth of encoded image
          with class ids.
        prediction_key: the key for storing the predictions of encoded image with
          class ids.
        decode_ground_truth: If true, the ground truth is assumed to be bytes of
          images and will be decoded.
        decode_prediction: If true, the prediction is assumed to be bytes of
          images and will be decoded.
        name: (Optional) name for the preprocessor.
        model_name: (Optional) model name (if multi-model evaluation).
      """
      if not name:
          name = metric_util.generate_private_name_from_arguments(
              _DECODE_IMAGE_PREPROCESSOR_BASE_NAME,
              ground_truth_key=ground_truth_key,
              prediction_key=prediction_key,
          )
      super().__init__(name=name)
      self._ground_truth_key = ground_truth_key
      self._prediction_key = prediction_key
      self._model_name = model_name
      self._decode_ground_truth = decode_ground_truth
      self._decode_prediction = decode_prediction
  
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 1 to create a new DecodeImagePreprocessor object from inherited base classes: metric_types with example: obj = DecodeImagePreprocessor(ground_truth_key, prediction_key, decode_ground_truth, decode_prediction, name, model_name)