Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: unhashable type: 'numpy.ndarray' #60

Open
Zehaos opened this issue Dec 12, 2016 · 0 comments
Open

TypeError: unhashable type: 'numpy.ndarray' #60

Zehaos opened this issue Dec 12, 2016 · 0 comments

Comments

@Zehaos
Copy link

Zehaos commented Dec 12, 2016

Hi,
I'm trying NearPy, and I got some error. Below is some code and error message.

import scipy.io as sio

mat_file = sio.loadmat("C:\\Users\\RA2\\Desktop\\Workspaces\\LightenedCNN_A_lfw.mat")
fea = mat_file["features"]
labels = mat_file["labels_original"]
img_path = mat_file["image_path"]

from nearpy import Engine
from nearpy.hashes import RandomBinaryProjections

# Dimension of our vector space
dimension = 256

n_d = 10
rbp1 = RandomBinaryProjections('rbp', n_d)


# Create engine with pipeline configuration
engine = Engine(dimension, lshashes=[rbp1])

for v, i in zip(fea[1:,:], range(1, len(fea)+1)):
    engine.store_vector(v, img_path[i])

query = fea[0]

# Get nearest neighbours
N = engine.neighbours(query)
File "C:\Users\RA2\Anaconda3\lib\site-packages\nearpy\filters\uniquefilter.py", line 51, in filter_vectors
    unique_dict[v[1]] = v

TypeError: unhashable type: 'numpy.ndarray'

The code crash when n_d is below 15.
Is this a bug?

Thanks
Zehao Shi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant