def _recursion(scores, i):
  """Recursive approach for finding best matches."""
  if scores.shape[0] == 0 or scores.shape[1] == 0:
    return [], 0.0
  index = np.argmax(scores[0, :])
  score = scores[0, index]
  if score > IOU_THRESHOLD:
    seq_, score_ = _recursion(scores[1:, 1:], i + 1)
    return [index + i, *seq_], score_ + score
  else:
    seq_, score_ = _recursion(scores[1:, :], i)
    return [None, *seq_], score_
Recursive approach for finding best matches.
language/fruit/rendering_utils.py