def _panoptic_to_standard_annotations(annotations):
  """Translates panoptic annotations to standard annotations.

  Panoptic annotations have one extra level of nesting compared to
  detection annotations (see https://cocodataset.org/#format-data), which
  we remove here. Also see
  pycocotools/panopticapi/converters/panoptic2detection_coco_format.py
  for reference regarding the conversion. Here, we do not convert the
  segmentation masks, since they are not required for the detection
  metric.

  Args:
    annotations: Dict with panoptic annotations loaded from JSON.

  Returns:
    Updated annotations dict in standard COCO format.
  """

  object_annotations = []
  for image_annotation in annotations:
    for object_annotation in image_annotation['segments_info']:
      object_annotations.append({
          'image_id': image_annotation['image_id'],
          'id': object_annotation['id'],
          'category_id': object_annotation['category_id'],
          'iscrowd': object_annotation['iscrowd'],
          'bbox': object_annotation['bbox'],
          'area': object_annotation['area'],
      })
  return object_annotations