Facing problem to run the cosine similarity search, as the input size not matching with the data fitted into the model.

#1
by priyasaravana - opened

Facing problem to run the cosine similarity search, as the input size not matching with the data fitted into the model. Could you explain it bit further to fix teh same.

GSI Technology org
edited Aug 16, 2023

We use the "packed" version of the embeddings to compute hamming distance, which keeps every feature compressed into 1 bit.
If you want to use cosine similarity you need to use the non-packed version of the embeddings

GSI Technology org

Change line 158 from:
nn_search.fit(np.packbits((ft_visual_features_database > 0.0).astype(bool), axis=1), o_data=ft_visual_features_database)
to:
nn_search.fit(ft_visual_features_database)

If you want to run cosine similarity search

Thanks for the response.. I got it

priyasaravana changed discussion status to closed

Sign up or log in to comment