提交 4cd9dc0e 编写于 作者: Y yunyaoXYY 提交者: Walter

fix faiss bug

上级 d0c01a97
......@@ -26,7 +26,7 @@
#include <map>
struct SearchResult {
std::vector <faiss::Index::idx_t> I;
std::vector<faiss::idx_t> I;
std::vector<float> D;
int return_k;
};
......@@ -53,7 +53,7 @@ public:
const SearchResult &Search(float *feature, int query_number);
const std::string &GetLabel(faiss::Index::idx_t ind);
const std::string &GetLabel(faiss::idx_t ind);
const float &GetThreshold() { return this->score_thres; }
......@@ -65,6 +65,6 @@ private:
faiss::Index *index;
int max_query_number = 6;
std::vector<float> D;
std::vector <faiss::Index::idx_t> I;
std::vector<faiss::idx_t> I;
SearchResult sr;
};
......@@ -29,11 +29,11 @@ void VectorSearch::LoadIdMap() {
std::string file_path = this->index_dir + OS_PATH_SEP + "id_map.txt";
std::ifstream in(file_path);
std::string line;
std::vector <std::string> m_vec;
std::vector<std::string> m_vec;
if (in) {
while (getline(in, line)) {
std::regex ws_re("\\s+");
std::vector <std::string> v(
std::vector<std::string> v(
std::sregex_token_iterator(line.begin(), line.end(), ws_re, -1),
std::sregex_token_iterator());
if (v.size() != 2) {
......@@ -57,6 +57,6 @@ const SearchResult &VectorSearch::Search(float *feature, int query_number) {
return this->sr;
}
const std::string &VectorSearch::GetLabel(faiss::Index::idx_t ind) {
const std::string &VectorSearch::GetLabel(faiss::idx_t ind) {
return this->id_map.at(ind);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册