code: def _get_annotations(generator):
      """Get the ground truth annotations from the generator.
  
      The result is a list of lists such that the size is:
          all_detections[num_images][num_classes] = annotations[num_detections, 5]
  
      # Arguments
          generator : The generator used to retrieve ground truth annotations.
      # Returns
          A list of lists containing the annotations for each image in the generator.
      """
      all_annotations = [
          [None for i in range(generator.num_classes())]
          for j in range(generator.size())
      ]
  
      for i in progressbar.progressbar(
          range(generator.size()), prefix="Parsing annotations: "
      ):
          # load the annotations
          annotations = generator.load_annotations(i)
  
          # copy detections to all_annotations
          for label in range(generator.num_classes()):
              if not generator.has_label(label):
                  continue
  
              all_annotations[i][label] = annotations["bboxes"][
                  annotations["labels"] == label, :
              ].copy()
  
      return all_annotations
  
file_path: ImageAI/imageai_tf_deprecated/Detection/keras_retinanet/utils/eval.py
imports: from .anchors import compute_overlap
  from .visualization import draw_detections, draw_annotations
  from tensorflow import keras
  import numpy
  import os
  import time
  import cv2
  import progressbar
label_desc: Use image node_id 3 for calling a global function with example usage: _get_annotations(generator) and returns: all_annotations