import numpy as np
import matplotlib.pyplot as plt
def normalization(data):
rang=np.max(data)-np.min(data)
return (data-np.min(data))/rang
def save_1_feature_map(feature_map):
# [1, H, W] -> [H, W]
im = np.squeeze(feature_map.detach().cpu().numpy())
# normalization
im=normalization(-im)
# plt.figure()
plt.axis('off')
plt.imshow(im, cmap='jet')
plt.savefig('feature_map{}.png'.format(1))
tensor类型,单通道feature画注意力图
最新推荐文章于 2024-03-25 10:53:17 发布