594422814/TransformerTrack

How to visualize attention map in your paper?

Closed this issue · 4 comments

Thank you for your great work? Could you share the code for visualizing attention maps?
Thank you so much!

I simply use the functions such as 'plt.imshow()' and 'plt.savefig()' to print the response maps and attention maps.

If it is possible, could you share the code to create attention maps? I try many times to output but still have problems.
Thank you so much.

Response map:
'''
plt.imshow(scores_raw[0,0,:,:].cpu().detach())
res_path = '/home/XXX/debug/frame_' + str(self.frame_num) + 'response' + '.png'
plt.savefig(res_path)
'''
I use this code in the 'dimp.py' to visualize the response maps

For the attention map, I use a similar way to visualize the 'dot_prod' or 'affinity' in 'ltr/models/target_classifier/multihead_attention.py'.

I got it. thank you so much for your help