code: def __init__(
      self,
      opts,
      split: Optional[str] = "val",
      year: Optional[int] = 2017,
      is_distributed: Optional[bool] = False,
  ):
      # disable printing on console, so that pycocotools print statements are not printed on console
      logger.disable_printing()
      bkrnd_id = (
          0
          if getattr(opts, "dataset.detection.no_background_id", False)
          else 1
      )
  
      iou_types = getattr(opts, "stats.coco_map.iou_types", ["bbox"])
  
      root = getattr(opts, "dataset.root_val", None)
      ann_file = os.path.join(
          root, "annotations/instances_{}{}.json".format(split, year)
      )
      coco_gt = COCO(ann_file)
  
      coco_categories = sorted(coco_gt.getCatIds())
      self.coco_id_to_contiguous_id = {
          coco_id: i + bkrnd_id
          for i, coco_id in enumerate(coco_categories)
      }
      self.contiguous_id_to_coco_id = {
          v: k for k, v in self.coco_id_to_contiguous_id.items()
      }
  
      self.coco_gt = coco_gt
      self.iou_types = iou_types
      self.is_distributed = is_distributed
      self.is_master_node = is_master(opts)
  
      self.coco_results = None
      self.reset()
  
      # enable printing, to enable cvnets log printing
      logger.enable_printing()
  
imports: import io
  import os
  from contextlib import redirect_stdout
  from typing import Any, Dict, List, Optional, Union
  import numpy
  import torch
  from pycocotools import mask
  from pycocotools.coco import COCO
  from pycocotools.cocoeval import COCOeval
  from torch import Tensor
  from torch.nn import functional
  from cvnets.models.detection import DetectionPredTuple
  from metrics import METRICS_REGISTRY
  from metrics.metric_base import BaseMetric
  from utils import logger
  from utils.ddp_utils import is_master
  from utils.tensor_utils import all_gather_list
label_desc: Use image node_id 1 to create a new COCOEvaluator object from inherited base classes: BaseMetric with example: obj = COCOEvaluator(opts, split, year, is_distributed)