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

Error while get top5_result in GradcamDemo #5

Open
MacwinWin opened this issue Feb 3, 2018 · 2 comments
Open

Error while get top5_result in GradcamDemo #5

MacwinWin opened this issue Feb 3, 2018 · 2 comments

Comments

@MacwinWin
Copy link

MacwinWin commented Feb 3, 2018

When I run the /darkon-examples/GradcamDemo.ipynb, I got the error below:

`IndexError Traceback (most recent call last)
in ()
1 probs = insp._prob_ts
2 probs_eval = sess.run(probs,feed_dict={inputs:np.reshape(image1,(1,224,224,3))})
----> 3 top5_result = imagenet_decoder(probs_eval)
4 print(top5_result)

~/darkon-examples-master/gradcam/imagenet_decoder.py in imagenet_decoder(preds, top)
1007 result = []
1008 for i in range(top):
-> 1009 result.append((class_names[top_indices[i]], top_indices[i]))
1010 return result

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

I'm using tensorflow 1.5.0

@MacwinWin MacwinWin changed the title Error while get top5_result GradcamDemo Error while get top5_result in GradcamDemo Feb 3, 2018
@MacwinWin
Copy link
Author

MacwinWin commented Feb 4, 2018

I solved this error by change

preds_sort = np.argsort(preds[0][0])

to

preds_sort = np.argsort(preds[0])

in file "imagenet_decoder.py"

zironycho added a commit that referenced this issue Feb 5, 2018
@zironycho
Copy link
Member

Thank you for reporting and solving this issue!

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

No branches or pull requests

2 participants