code: def __init__(self, ds, indexfile):
      self.d = ds.d
      self.metric = ds.metric
      self.nq = ds.nq
      self.xq = ds.get_queries()
  
      # get the xb set
      src_index = faiss.read_index(indexfile)
      src_quant = faiss.downcast_index(src_index.quantizer)
      centroids = faiss.vector_to_array(src_quant.xb)
      self.xb = centroids.reshape(-1, self.d)
      self.nb = self.nt = len(self.xb)
  
file_path: faiss/benchs/bench_all_ivf/datasets_oss.py
imports: import time
  import numpy
  import faiss
  from faiss.contrib import datasets
label_desc: Use image node_id 1 to create a new DatasetCentroids object from inherited base classes: faiss_datasets with example: obj = DatasetCentroids(ds, indexfile)