class_docstr: Input reader for dataset.
class_docstr_tok: ["Input","reader","for","dataset","."]
docstr: Parse data to a fixed dimension input image and learning targets.
  
  Args:
    value: a single serialized tf.Example string.
    example_decoder: TF example decoder.
    anchor_labeler: anchor box labeler.
    params: a dict of extra parameters.
  
  Returns:
    image: Image tensor that is preprocessed to have normalized value and
      fixed dimension [image_height, image_width, 3]
    cls_targets_dict: ordered dictionary with keys
      [min_level, min_level+1, ..., max_level]. The values are tensor with
      shape [height_l, width_l, num_anchors]. The height_l and width_l
      represent the dimension of class logits at l-th level.
    box_targets_dict: ordered dictionary with keys
      [min_level, min_level+1, ..., max_level]. The values are tensor with
      shape [height_l, width_l, num_anchors * 4]. The height_l and
      width_l represent the dimension of bounding box regression output at
      l-th level.
    num_positives: Number of positive anchors in the image.
    boxes: Groundtruth bounding box annotations. The box is represented in
      [y1, x1, y2, x2] format. The tensor is padded with -1 to the fixed
      dimension [self._max_instances_per_image, 4].
    classes: Groundtruth classes annotations. The tensor is padded with -1
      to the fixed dimension [self._max_instances_per_image].
docstr_tok: ["Parse","data","to","a","fixed","dimension","input","image","and","learning","targets",".","Args",":","value",":","a","single","serialized","tf.Example","string",".","example_decoder",":","TF","example","decoder",".","anchor_labeler",":","anchor","box","labeler",".","params",":","a","dict","of","extra","parameters",".","Returns",":","image",":","Image","tensor","that","is","preprocessed","to","have","normalized","value","and","fixed","dimension","[","image_height",",","image_width",",","3","]","cls_targets_dict",":","ordered","dictionary","with","keys","[","min_level",",","min_level+1",",","...",",","max_level","]",".","The","values","are","tensor","with","shape","[","height_l",",","width_l",",","num_anchors","]",".","The","height_l","and","width_l","represent","the","dimension","of","class","logits","at","l-th","level",".","box_targets_dict",":","ordered","dictionary","with","keys","[","min_level",",","min_level+1",",","...",",","max_level","]",".","The","values","are","tensor","with","shape","[","height_l",",","width_l",",","num_anchors","*","4","]",".","The","height_l","and","width_l","represent","the","dimension","of","bounding","box","regression","output","at","l-th","level",".","num_positives",":","Number","of","positive","anchors","in","the","image",".","boxes",":","Groundtruth","bounding","box","annotations",".","The","box","is","represented","in","[","y1",",","x1",",","y2",",","x2","]","format",".","The","tensor","is","padded","with","-1","to","the","fixed","dimension","[","self._max_instances_per_image",",","4","]",".","classes",":","Groundtruth","classes","annotations",".","The","tensor","is","padded","with","-1","to","the","fixed","dimension","[","self._max_instances_per_image","]","."]
code: def dataset_parser(self, value, example_decoder, anchor_labeler):
      """Parse data to a fixed dimension input image and learning targets.
  
      Args:
        value: a single serialized tf.Example string.
        example_decoder: TF example decoder.
        anchor_labeler: anchor box labeler.
        params: a dict of extra parameters.
  
      Returns:
        image: Image tensor that is preprocessed to have normalized value and
          fixed dimension [image_height, image_width, 3]
        cls_targets_dict: ordered dictionary with keys
          [min_level, min_level+1, ..., max_level]. The values are tensor with
          shape [height_l, width_l, num_anchors]. The height_l and width_l
          represent the dimension of class logits at l-th level.
        box_targets_dict: ordered dictionary with keys
          [min_level, min_level+1, ..., max_level]. The values are tensor with
          shape [height_l, width_l, num_anchors * 4]. The height_l and
          width_l represent the dimension of bounding box regression output at
          l-th level.
        num_positives: Number of positive anchors in the image.
        boxes: Groundtruth bounding box annotations. The box is represented in
          [y1, x1, y2, x2] format. The tensor is padded with -1 to the fixed
          dimension [self._max_instances_per_image, 4].
        classes: Groundtruth classes annotations. The tensor is padded with -1
          to the fixed dimension [self._max_instances_per_image].
      """
      params = self._params
  
      with tf.name_scope("parser"):
          data = example_decoder.decode(value)
          image = data["image"]
          boxes = data["groundtruth_boxes"]
          classes = data["groundtruth_classes"]
          classes = tf.reshape(
              tf.cast(classes, dtype=tf.float32), [-1, 1]
          )
  
          if self._is_training:
              if params.get("grid_mask", None):
                  from . import (
                      gridmask,
                  )  # pylint: disable=g-import-not-at-top
  
                  image, boxes = gridmask.gridmask(image, boxes)
  
          input_processor = DetectionInputProcessor(
              image, params["image_size"], boxes, classes
          )
          input_processor.normalize_image()
          if self._is_training:
              if params["input_rand_hflip"]:
                  input_processor.random_horizontal_flip()
  
              input_processor.set_training_random_scale_factors(
                  params["jitter_min"],
                  params["jitter_max"],
                  params.get("target_size", None),
              )
          else:
              input_processor.set_scale_factors_to_output_size()
          image = input_processor.resize_and_crop_image()
          boxes, classes = input_processor.resize_and_crop_boxes()
  
          # Assign anchors.
          (
              cls_targets,
              box_targets,
              num_positives,
          ) = anchor_labeler.label_anchors(boxes, classes)
  
          # Pad groundtruth data for evaluation.
          boxes = pad_to_fixed_size(
              boxes, -1, [self._max_instances_per_image, 4]
          )
          classes = pad_to_fixed_size(
              classes, -1, [self._max_instances_per_image, 1]
          )
          return (
              image,
              cls_targets,
              box_targets,
              num_positives,
              boxes,
              classes,
          )
  
imports: from absl import logging
  import tensorflow
  import utils
  from pipeline import anchors
  from .None import preprocessor
  from .None import tf_example_decoder
label_desc: Use image node_id 2 for calling the InputReader obj's underlying member method code with example usage: obj.dataset_parser(value, example_decoder, anchor_labeler) and returns: image,  cls_targets,  box_targets,  num_positives,  boxes,  classes