yhenon / pyimgsaliency

A python toolbox for computing image saliency
Apache License 2.0
171 stars 53 forks source link

IndexError in saliency.py for rbd #3

Open dineshbvadhia opened 7 years ago

dineshbvadhia commented 7 years ago

Running demo.py, get 'rbd' error in saliency.py:

File "saliency.py", line 62, in edges = [[vertices[x%num_vertices], vertices[x/num_vertices]] for x in edges] IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

Both ft and mdb run without problems.

RoseLii commented 7 years ago

please help me ImportError: No module named pyimgsaliency

qiaoshh commented 6 years ago

,I have the same problem, maybe u can run the code with the mainly funciotn by building a new programme.

zzApotheosis commented 6 years ago

Did any of you guys ever find out what was wrong? I've got the same problem @dineshbvadhia has.

shaoqia commented 6 years ago

the same problem @dineshbvadhia

Eracro commented 6 years ago

Hola !

I think it's just a little type problem due to the division, you can correct it by casting the result before using it as an index, just replace the line 61 in saliency.py by :

edges = [[vertices[x%num_vertices],vertices[int(x/num_vertices)]] for x in edges]

and it should be ok

doublemanyu commented 5 years ago

Running demo.py, get 'rbd' error in saliency.py:

File "saliency.py", line 62, in edges = [[vertices[x%num_vertices], vertices[x/num_vertices]] for x in edges] IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

Both ft and mdb run without problems.

Have you sloved it yet? I meet the same probloem. Could you tell me how can i fix it?

roysubhankar commented 5 years ago

Running demo.py, get 'rbd' error in saliency.py:

File "saliency.py", line 62, in edges = [[vertices[x%num_vertices], vertices[x/num_vertices]] for x in edges] IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

Both ft and mdb run without problems.

The error occurs because this code is written in Python2.7. If you run in python2.7 environment there is no error and it works fine.

suzhengpeng commented 4 years ago

i got the same error.. can anyone tell me how to fix it??

Yqknight commented 4 years ago

Hola !

I think it's just a little type problem due to the division, you can correct it by casting the result before using it as an index, just replace the line 61 in saliency.py by :

edges = [[vertices[x%num_vertices],vertices[int(x/num_vertices)]] for x in edges]

and it should be ok

It did work! Thank you very much

Liangliangb commented 1 year ago
After I modified it, a new error appeared: geodesic[v1,v2] = path_length(all_shortest_paths_color[v1][v2],G)

IndexError: index 247 is out of bounds for axis 1 with size 247

Liangliangb commented 1 year ago

After I modified it, a new error appeared: geodesic[v1,v2] = path_length(all_shortest_paths_color[v1][v2],G) IndexError: index 247 is out of bounds for axis 1 with size 247