code: def anchor_fitness(
      k: np.ndarray, wh: np.ndarray, thr: float
  ):  # mutation fitness
      r = wh[:, None] / k[None]
      x = np.minimum(r, 1.0 / r).min(2)  # ratio metric
      # x = wh_iou(wh, k)  # iou metric
      best = x.max(1)
      f = (best * (best > thr).astype(np.float32)).mean()  # fitness
      bpr = (
          (best > thr).astype(np.float32).mean()
      )  # best possible recall
      return f, bpr
  
file_path: deep-learning-for-image-processing/others_project/kmeans_anchors/main.py
imports: import random
  import numpy
  from tqdm import tqdm
  from scipy.cluster.vq import kmeans
  from read_voc import VOCDataSet
  from yolo_kmeans import k_means, wh_iou
label_desc: Use image node_id 1 for calling a global function with example usage: anchor_fitness(k, wh, thr) and returns: f,  bpr