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

fast tensor mult #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

vermashresth
Copy link

Scipy zoom function and the numpy dot product are really slow and also, can't take advantage of computation on GPU. A much faster way is to use tensorflow for both operations and convert the final result back to a numpy array. On my system, running code on CPU, this saves approximately 10 seconds for a single image.

@HectorNet
Copy link

I faced the performance issue as well.
I modified original code to

# ResNet_CAM.py
mat_for_mult = tf.image.resize(last_conv_output, (224, 224))
amp_layer_weights = all_amp_layer_weights[:, pred:pred+1]
final_output = tf.matmul(mat_for_mult, amp_layer_weights)[:,:,0]

It got 10 times faster.

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

Successfully merging this pull request may close these issues.

2 participants