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

improve occlusion_heatmap() performance #218

Closed
rldw opened this issue Feb 25, 2016 · 3 comments
Closed

improve occlusion_heatmap() performance #218

rldw opened this issue Feb 25, 2016 · 3 comments

Comments

@rldw
Copy link

rldw commented Feb 25, 2016

I'd like to use the occlusion_heatmap() function in visualize.py to drastically improve my prediction performance. However, for a 45x90px CMYK image this takes roughly 2s. Considering that I have a couple of thousand images in my test set this is not really practical. So is there a way to improve the function's performance?

I'm not too familiar with numpy, but I assume that one could vectorize the nested for-loop?

for i in range(s0): for j in range(s1):

@dnouri
Copy link
Owner

dnouri commented Mar 4, 2016

I haven't used occlusion_heatmap() too much. I assume you're running the code on the GPU? You could try to profile it, or just sprinkle some print(time() - t0) over the code to understand better where time is spent.

@BenjaminBossan
Copy link
Collaborator

Vectorizing the nested for-loop would not help since the slow part - the call to predict_proba - is already outside the inner loop. The problem is that for each image, you have 45x90 predictions, so I would expect the function call to be approximately as slow as calling predict_proba on 4050 samples (if not, please report).

What could be done? I see two solutions:

  1. Don't predict for all images - I at least just look at a couple of them to get a feel.
  2. Don't use occlusion_heatmap but instead propagate the error back on the image; this does not provide the same information, but it might still help and at least it should be much faster.

@dnouri
Copy link
Owner

dnouri commented Mar 11, 2016

By the way, the second option is being implemented in #223.

@dnouri dnouri closed this as completed Mar 11, 2016
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

3 participants