Converting Detectron2 Predicted Boxes to COCO Format

I’m wondering if there’s a pre-existing script that takes in a list of predictions (and their corresponding image file names) from a Detectron2 model and converts them to COCO format. The predictions are a list of instance objects:

[
{'instances': Instances(num_instances=1, image_height=h, image_width=w, fields=[pred_boxes: Boxes(tensor([[xmin, ymin, xmax, ymax]])), scores: tensor([score]), pred_classes: tensor([class])])}, 
...]