Faiss是Facebook AI团队开源的针对聚类和相似性搜索库

用自己数据跑faiss示例代码报错:

%time index = faiss.IndexFlatL2(d)   # build the index
print(index.is_trained)
index.add(xb1) 

搜了一下是因为faiss要求输入数据必须是连续数据,所以先要对数据进行连续化处理:np.ascontiguousarray

%time index = faiss.IndexFlatL2(d)   # build the index
print(index.is_trained)
index.add(np.ascontiguousarray(xb1))

问题解决

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐