docstr: Prepare ._gts and ._dts for evaluation based on params
  :return: None
docstr_tok: ["Prepare","._gts","and","._dts","for","evaluation","based","on","params",":","return",":","None"]
code: def _prepare(self):
      """
      Prepare ._gts and ._dts for evaluation based on params
      :return: None
      """
  
      def _toMask(anns, coco):
          # modify ann['segmentation'] by reference
          for ann in anns:
              rle = coco.annToRLE(ann)
              ann["segmentation"] = rle
  
      p = self.params
      if p.useCats:
          gts = self.cocoGt.loadAnns(
              self.cocoGt.getAnnIds(imgIds=p.imgIds, catIds=p.catIds)
          )
          dts = self.cocoDt.loadAnns(
              self.cocoDt.getAnnIds(imgIds=p.imgIds, catIds=p.catIds)
          )
      else:
          gts = self.cocoGt.loadAnns(
              self.cocoGt.getAnnIds(imgIds=p.imgIds)
          )
          dts = self.cocoDt.loadAnns(
              self.cocoDt.getAnnIds(imgIds=p.imgIds)
          )
  
      # convert ground truth to mask if iouType == 'segm'
      if p.iouType == "segm":
          _toMask(gts, self.cocoGt)
          _toMask(dts, self.cocoDt)
      # set ignore flag
      for gt in gts:
          gt["ignore"] = gt["ignore"] if "ignore" in gt else 0
          gt["ignore"] = "iscrowd" in gt and gt["iscrowd"]
          if p.iouType == "keypoints":
              gt["ignore"] = (gt["num_keypoints"] == 0) or gt["ignore"]
      self._gts = defaultdict(list)  # gt for evaluation
      self._dts = defaultdict(list)  # dt for evaluation
      for gt in gts:
          self._gts[gt["image_id"], gt["category_id"]].append(gt)
      for dt in dts:
          self._dts[dt["image_id"], dt["category_id"]].append(dt)
      self.evalImgs = defaultdict(
          list
      )  # per-image per-category evaluation results
      self.eval = {}
  
imports: import numpy
  import datetime
  import time
  from collections import defaultdict
  from .mask import *
  import copy
label_desc: Use image node_id 2 for calling the COCOeval obj's underlying member method code with example usage: obj._prepare() without return types