def build_pr_id2annotations(pr: list) -> dict:
    """Build image to annotation dictionary based on list of predictions.

    Arguments:
        pr {list} -- List of predictions from Detectron2 (coco-instance-results.json)

    Returns:
        id_to_annotation {dict} -- Image IDs to predicted annotations.
    """
    id_to_annotation = dict()
    for annotation in pr:
        id_to_annotation[annotation["image_id"]] = []
    for annotation in pr:
        id_to_annotation[annotation["image_id"]].append(annotation)
    return id_to_annotation