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))