code: def _compute_segment_ious(preds, gts):
      is_symmetric = preds is gts
  
      ious = np.zeros((len(preds), len(gts)))
      for j, gt in enumerate(gts):
          gst, get = gt.support
          gt_len = get - gst
  
          for i, pred in enumerate(preds):
              if is_symmetric and i < j:
                  iou = ious[j, i]
              elif is_symmetric and i == j:
                  iou = 1
              else:
                  pst, pet = pred.support
                  pred_len = pet - pst
  
                  if pred_len == 0 and gt_len == 0:
                      iou = float(pet == get)
                  else:
                      # Length of temporal intersection
                      inter = min(get, pet) - max(gst, pst)
                      if inter <= 0:
                          continue
  
                      union = pred_len + gt_len - inter
                      iou = min(etan.safe_divide(inter, union), 1)
  
              ious[i, j] = iou
  
      return ious
  
imports: import contextlib
  import itertools
  import logging
  import numpy
  import scipy.spatial
  import eta.core.numutils
  import eta.core.utils
  import fiftyone.core.labels
  import fiftyone.core.utils
  import fiftyone.core.validation
  from .utils3d import compute_cuboid_iou
label_desc: Use image node_id 17 for calling a global function with example usage: _compute_segment_ious(preds, gts) and returns: ious