code: def _create_panoptic_gt_annotations(self, ann_file, seg_map_dir):
      categories = [
          {
              "id": 0,
              "name": "person",
              "supercategory": "person",
              "isthing": 1,
          },
          {
              "id": 1,
              "name": "cat",
              "supercategory": "cat",
              "isthing": 1,
          },
          {
              "id": 2,
              "name": "dog",
              "supercategory": "dog",
              "isthing": 1,
          },
          {
              "id": 3,
              "name": "wall",
              "supercategory": "wall",
              "isthing": 0,
          },
      ]
  
      images = [
          {
              "id": 0,
              "width": 80,
              "height": 60,
              "file_name": "fake_name1.jpg",
          }
      ]
  
      annotations = [
          {
              "segments_info": [
                  {
                      "id": 1,
                      "category_id": 0,
                      "area": 400,
                      "bbox": [10, 10, 10, 40],
                      "iscrowd": 0,
                  },
                  {
                      "id": 2,
                      "category_id": 0,
                      "area": 400,
                      "bbox": [30, 10, 10, 40],
                      "iscrowd": 0,
                  },
                  {
                      "id": 3,
                      "category_id": 2,
                      "iscrowd": 0,
                      "bbox": [50, 10, 10, 5],
                      "area": 50,
                  },
                  {
                      "id": 4,
                      "category_id": 3,
                      "iscrowd": 0,
                      "bbox": [0, 0, 80, 60],
                      "area": 3950,
                  },
              ],
              "file_name": "fake_name1.png",
              "image_id": 0,
          }
      ]
  
      gt_json = {
          "images": images,
          "annotations": annotations,
          "categories": categories,
      }
  
      # 4 is the id of the background class annotation.
      gt = np.zeros((60, 80), dtype=np.int64) + 4
      gt_bboxes = np.array(
          [[10, 10, 10, 40], [30, 10, 10, 40], [50, 10, 10, 5]],
          dtype=np.int64,
      )
      for i in range(3):
          x, y, w, h = gt_bboxes[i]
          gt[y : y + h, x : x + w] = i + 1  # id starts from 1
  
      rgb_gt_seg_map = np.zeros(gt.shape + (3,), dtype=np.uint8)
      rgb_gt_seg_map[:, :, 2] = gt // (256 * 256)
      rgb_gt_seg_map[:, :, 1] = gt % (256 * 256) // 256
      rgb_gt_seg_map[:, :, 0] = gt % 256
  
      img_path = osp.join(seg_map_dir, "fake_name1.png")
      mmcv.imwrite(rgb_gt_seg_map[:, :, ::-1], img_path)
      dump(gt_json, ann_file)
  
      return gt_json
  
file_path: mmdetection/tests/test_evaluation/test_metrics/test_coco_panoptic_metric.py
imports: import os
  import os.path
  import tempfile
  import unittest
  from copy import deepcopy
  import mmcv
  import numpy
  import torch
  from mmengine.fileio import dump
  from mmdet.evaluation import INSTANCE_OFFSET, CocoPanopticMetric
label_desc: Use image node_id 1 for calling the TestCocoPanopticMetric obj's underlying member method code with example usage: obj._create_panoptic_gt_annotations(ann_file, seg_map_dir) and returns: gt_json