code: def _distance_acc(distances, thr=0.5):
      """Return the percentage below the distance threshold, while ignoring
      distances values with -1.
  
      Note:
          batch_size: N
      Args:
          distances (np.ndarray[N, ]): The normalized distances.
          thr (float): Threshold of the distances.
  
      Returns:
          float: Percentage of distances below the threshold. \
              If all target keypoints are missing, return -1.
      """
      distance_valid = distances != -1
      num_distance_valid = distance_valid.sum()
      if num_distance_valid > 0:
          return (
              distances[distance_valid] < thr
          ).sum() / num_distance_valid
      return -1
  
imports: import cv2
  import numpy
  import paddle.nn.functional
label_desc: Use image node_id 17 for calling a global function with example usage: _distance_acc(distances, thr) and returns: unknown, unknown