Faiss: reconstruct, indexFlatL2, IVFFlat, IVFPQ, different results

Created on 25 Feb 2020  路  2Comments  路  Source: facebookresearch/faiss

Hi, I use reconstruct() to get a vector from index, I get the right answer with indexFlatL2 and indexIVFFlat, but with indexIVFPQ, the vector I got is not the same as before when I put same index. How could I use reconstruct() for indexIVFPQ?

question

Most helpful comment

IndexIVFPQ uses product quantization to lossily compress the vector, so reconstruct() is returning the quantized representation of the vector (it is "reconstructed" from the data present in the index). The vector you added appears to the index in the form that reconstruct() returns.

IVFFlat and Flat store vector data without compression, so it makes sense that those are returning the vector that you had originally.

All 2 comments

IndexIVFPQ uses product quantization to lossily compress the vector, so reconstruct() is returning the quantized representation of the vector (it is "reconstructed" from the data present in the index). The vector you added appears to the index in the form that reconstruct() returns.

IVFFlat and Flat store vector data without compression, so it makes sense that those are returning the vector that you had originally.

Hi, I use reconstruct() to get a vector from index, I get the right answer with indexFlatL2 and indexIVFFlat, but with indexIVFPQ, the vector I got is not the same as before when I put same index. How could I use reconstruct() for indexIVFPQ?

hi,Buddy. I have the problem when I use reconstruct(). Index already created by indexIVFFlat that has the hash ids. The error is :+1: RuntimeError: Error in virtual void faiss::IndexIVF::reconstruct(faiss::Index::idx_t, float*) const at IndexIVF.cpp:191: Error: 'direct_map.size() == ntotal' failed: direct map is not initialized

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lukedeo picture lukedeo  路  3Comments

0DF0Arc picture 0DF0Arc  路  3Comments

Tony-Hou picture Tony-Hou  路  3Comments

xxllp picture xxllp  路  3Comments

danny1984 picture danny1984  路  3Comments