灰度图attention_map彩色化
color bar 的格式可以自由选择
import cv2
img = cv2.imread('./attention_map.png')#'../v2.4/shadow_free/USR_shadow_0394_heatmap.jpg'
heatmap = cv2.applyColorMap(cv2.resize(img, (512, 512)), 2) #2 对应的是cv2.COLORMAP_JET
result = heatmap #比例可以自己调节
cv2.imshow("image", result)
cv2.waitKey(0)
cv2.destroyAllWindows()
另一种基于Plt image,但是这种会自动做归一化的操作,有时候我们并不需要
plt.imsave('residual/image5.png', attention,cmap='jet')