ResNetCAM-keras icon indicating copy to clipboard operation
ResNetCAM-keras copied to clipboard

fast tensor mult

Open vermashresth opened this issue 7 years ago • 1 comments

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.

vermashresth avatar Aug 05 '17 16:08 vermashresth

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.

HectorNet avatar Nov 19 '21 04:11 HectorNet