# import faiss # # Load the FAISS index # index = faiss.read_index("face_index.faiss") # # Print information about the index # print(f"Number of vectors in the index: {index.ntotal}") # print(index) import faiss import numpy as np # Load the FAISS index index = faiss.read_index("face_index.faiss") # Check the total number of vectors in the index total_vectors = index.ntotal print(f"Number of vectors in the index: {total_vectors}") # Reconstruct vectors one by one vectors = [] for i in range(total_vectors): vectors.append(index.reconstruct(i)) # Convert the list of vectors to a NumPy array vectors_array = np.array(vectors) # Save the array to a text file for inspection np.savetxt("faiss_vectors.txt", vectors_array, fmt="%.6f") print("Vectors saved to faiss_vectors.txt")