def build_gt_id2annotations(gt: dict) -> dict:
    """Build image to annotation dictionary based on the ground truth dataset.

    Arguments:
        gt {dict} -- COCO dataset of ground truth annotations.

    Returns:
        id_to_annotation {dict} -- Image IDs to ground-truth annotations.
    """
    id_to_annotation = dict()
    for image in gt["images"]:
        id_to_annotation[image["id"]] = []
    for annotation in gt["annotations"]:
        id_to_annotation[annotation["image_id"]].append(annotation)
    return id_to_annotation