code: def computeIoU(self, vidId, catId):
      p = self.params
      if p.useCats:
          gt = self._gts[vidId, catId]
          dt = self._dts[vidId, catId]
      else:
          gt = [_ for cId in p.catIds for _ in self._gts[vidId, cId]]
          dt = [_ for cId in p.catIds for _ in self._dts[vidId, cId]]
      if len(gt) == 0 and len(dt) == 0:
          return []
      inds = np.argsort([-d["score"] for d in dt], kind="mergesort")
      dt = [dt[i] for i in inds]
      if len(dt) > p.maxDets[-1]:
          dt = dt[0 : p.maxDets[-1]]
  
      if p.iouType == "segm":
          g = [g["segmentations"] for g in gt]
          d = [d["segmentations"] for d in dt]
      elif p.iouType == "bbox":
          g = [g["bboxes"] for g in gt]
          d = [d["bboxes"] for d in dt]
      else:
          raise Exception("unknown iouType for iou computation")
  
      # compute iou between each dt and gt region
  
      def iou_seq(d_seq, g_seq):
          i = 0.0
          u = 0.0
          for d, g in zip(d_seq, g_seq):
              if d and g:
                  i += maskUtils.area(maskUtils.merge([d, g], True))
                  u += maskUtils.area(maskUtils.merge([d, g], False))
              elif not d and g:
                  u += maskUtils.area(g)
              elif d and not g:
                  u += maskUtils.area(d)
          if not u > 0.0:
              print(
                  "Mask sizes in video {} and category {} may not match!".format(
                      vidId, catId
                  )
              )
          iou = i / u if u > 0.0 else 0.0
          return iou
  
      ious = np.zeros([len(d), len(g)])
      for i, j in np.ndindex(ious.shape):
          ious[i, j] = iou_seq(d[i], g[j])
  
      return ious
  
imports: import copy
  import datetime
  import time
  from collections import defaultdict
  import numpy
  from pycocotools import mask
label_desc: Use image node_id 4 for calling the YTVISeval obj's underlying member method code with example usage: obj.computeIoU(vidId, catId) and returns: ious, list, iou