code: def segmentation(ann_starts, ann_ends, det_starts, det_ends):
      """
      Compute the normalized Hamming divergence between chord
      segmentations as defined in [1]_ (Eqs. 8.37 and 8.38).
  
      Parameters
      ----------
      ann_starts : list or numpy array
          Start times of annotated chord segments.
      ann_ends : list or numpy array
          End times of annotated chord segments.
      det_starts : list or numpy array
          Start times of detected chord segments.
      det_ends : list or numpy array
          End times of detected chord segments.
  
      Returns
      -------
      distance : float
          Normalised Hamming divergence between annotated and
          detected chord segments.
  
      References
      ----------
      .. [1] Christopher Harte, "Towards Automatic Extraction of Harmony
             Information from Music Signals." Dissertation,
             Department for Electronic Engineering, Queen Mary University of
             London, 2010.
  
      """
      est_ts = np.unique(np.hstack([det_starts, det_ends]))
      seg = 0.0
      for start, end in zip(ann_starts, ann_ends):
          dur = end - start
          seg_ts = np.hstack(
              [start, est_ts[(est_ts > start) & (est_ts < end)], end]
          )
          seg += dur - np.diff(seg_ts).max()
  
      return seg / (ann_ends[-1] - ann_starts[0])
  
imports: import numpy
  from .None import evaluation_io, EvaluationMixin
  from ..io import load_chords
label_desc: Use image node_id 18 for calling a global function with example usage: segmentation(ann_starts, ann_ends, det_starts, det_ends) and returns: unknown