code: def get_intersection_cardinality_frequencies(
      I: np.ndarray, I_gt: np.ndarray
  ) -> Dict[int, int]:
      """
      Computes the frequencies for the cardinalities of the intersection of neighbour indices.
      """
      nq = I.shape[0]
      res = []
      for ell in range(nq):
          res.append(len(np.intersect1d(I[ell, :], I_gt[ell, :])))
      values, counts = np.unique(res, return_counts=True)
      return dict(zip(values, counts))
  
file_path: faiss/demos/offline_ivf/utils.py
imports: import numpy
  import os
  from typing import Dict
  import yaml
  import faiss
  from faiss.contrib.datasets import SyntheticDataset
label_desc: Use image node_id 5 for calling a global function with example usage: get_intersection_cardinality_frequencies(I, I_gt) and returns: dict