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 range(generator.size()):
        annotations = generator.load_annotations(i)
        for label in range(generator.num_classes()):
            all_annotations[i][label] = annotations[(annotations[:, (4)] ==
                label), :4].copy()
        print('{}/{}'.format(i + 1, generator.size()), end='\r')
    return all_annotations
