code: def compute_iou(segment1: Array, segment2: Array) -> Any:
      """Computes the IoU score between two temporal segments."""
      start = max(segment1[0], segment2[0])
      end = min(segment1[1], segment2[1])
      if start >= end:
          return 0.0
      intersection = end - start
      duration1 = segment1[1] - segment1[0]
      duration2 = segment2[1] - segment2[0]
      union = duration1 + duration2 - intersection
      return intersection / union
  
file_path: scenic/scenic/projects/unloc/metrics.py
imports: from typing import Any, List, Union
  import jax.numpy
  import numpy
label_desc: Use image node_id 5 for calling a global function with example usage: compute_iou(segment1, segment2) and returns: unknown, int