def add_single_ground_truth_image_info(self,
                                         image_key,
                                         groundtruth_boxes,
                                         groundtruth_class_labels,
                                         groundtruth_is_difficult_list=None,
                                         groundtruth_is_group_of_list=None,
                                         groundtruth_masks=None):
    """Adds groundtruth for a single image to be used for evaluation.

    Args:
      image_key: A unique string/integer identifier for the image.
      groundtruth_boxes: float32 numpy array of shape [num_boxes, 4] containing
        `num_boxes` groundtruth boxes of the format [ymin, xmin, ymax, xmax] in
        absolute image coordinates.
      groundtruth_class_labels: integer numpy array of shape [num_boxes]
        containing 0-indexed groundtruth classes for the boxes.
      groundtruth_is_difficult_list: A length M numpy boolean array denoting
        whether a ground truth box is a difficult instance or not. To support
        the case that no boxes are difficult, it is by default set as None.
      groundtruth_is_group_of_list: A length M numpy boolean array denoting
        whether a ground truth box is a group-of box or not. To support the case
        that no boxes are groups-of, it is by default set as None.
      groundtruth_masks: uint8 numpy array of shape [num_boxes, height, width]
        containing `num_boxes` groundtruth masks. The mask values range from 0
        to 1.
    """
    if image_key in self.groundtruth_boxes:
      logging.warning(
          'image %s has already been added to the ground truth database.',
          image_key)
      return

    self.groundtruth_boxes[image_key] = groundtruth_boxes
    self.groundtruth_class_labels[image_key] = groundtruth_class_labels
    self.groundtruth_masks[image_key] = groundtruth_masks
    if groundtruth_is_difficult_list is None:
      num_boxes = groundtruth_boxes.shape[0]
      groundtruth_is_difficult_list = np.zeros(num_boxes, dtype=bool)
    self.groundtruth_is_difficult_list[
        image_key] = groundtruth_is_difficult_list.astype(dtype=bool)
    if groundtruth_is_group_of_list is None:
      num_boxes = groundtruth_boxes.shape[0]
      groundtruth_is_group_of_list = np.zeros(num_boxes, dtype=bool)
    if groundtruth_masks is None:
      num_boxes = groundtruth_boxes.shape[0]
      mask_presence_indicator = np.zeros(num_boxes, dtype=bool)
    else:
      mask_presence_indicator = (np.sum(groundtruth_masks,
                                        axis=(1, 2)) == 0).astype(dtype=bool)

    self.groundtruth_is_group_of_list[
        image_key] = groundtruth_is_group_of_list.astype(dtype=bool)

    self._update_ground_truth_statistics(
        groundtruth_class_labels,
        groundtruth_is_difficult_list.astype(dtype=bool)
        | mask_presence_indicator,  # ignore boxes without masks
        groundtruth_is_group_of_list.astype(dtype=bool))
Adds groundtruth for a single image to be used for evaluation.

    Args:
      image_key: A unique string/integer identifier for the image.
      groundtruth_boxes: float32 numpy array of shape [num_boxes, 4] containing
        `num_boxes` groundtruth boxes of the format [ymin, xmin, ymax, xmax] in
        absolute image coordinates.
      groundtruth_class_labels: integer numpy array of shape [num_boxes]
        containing 0-indexed groundtruth classes for the boxes.
      groundtruth_is_difficult_list: A length M numpy boolean array denoting
        whether a ground truth box is a difficult instance or not. To support
        the case that no boxes are difficult, it is by default set as None.
      groundtruth_is_group_of_list: A length M numpy boolean array denoting
        whether a ground truth box is a group-of box or not. To support the case
        that no boxes are groups-of, it is by default set as None.
      groundtruth_masks: uint8 numpy array of shape [num_boxes, height, width]
        containing `num_boxes` groundtruth masks. The mask values range from 0
        to 1.
    
inference_api/src/main/object_detection/utils/object_detection_evaluation.py