code: def __init__(
      self,
      img_folder,
      ann_folder,
      ann_file,
      transforms=None,
      return_masks=True,
  ):
      with open(ann_file, "r") as f:
          self.coco = json.load(f)
  
      # sort 'images' field so that they are aligned with 'annotations'
      # i.e., in alphabetical order
      self.coco["images"] = sorted(
          self.coco["images"], key=lambda x: x["id"]
      )
      # sanity check
      if "annotations" in self.coco:
          for img, ann in zip(
              self.coco["images"], self.coco["annotations"]
          ):
              assert img["file_name"][:-4] == ann["file_name"][:-4]
  
      self.img_folder = img_folder
      self.ann_folder = ann_folder
      self.ann_file = ann_file
      self.transforms = transforms
      self.return_masks = return_masks
  
file_path: detr/datasets/coco_panoptic.py
imports: import json
  from pathlib import Path
  import numpy
  import torch
  from PIL import Image
  from panopticapi.utils import rgb2id
  from util.box_ops import masks_to_boxes
  from .coco import make_coco_transforms
label_desc: Use image node_id 1 to create a new CocoPanoptic object  with example: obj = CocoPanoptic(img_folder, ann_folder, ann_file, transforms, return_masks)