Skip to content

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