INNER CODE UNIT · Python
display_heatmap
patrickjohncyh/fashion-clip · fashion_clip/attention_map.py:66
def display_heatmap(image, text, heatmap):
fig = plt.figure(figsize=(15, 30), facecolor='white')
ax1 = fig.add_subplot(131)
ax2 = fig.add_subplot(132)
ax3 = fig.add_subplot(133)
ax1.imshow(image)
ax2.imshow(heatmap)
ax3.imshow(np.asarray(image) / 255. * heatmap)
ax1.axis('off')
ax2.axis('off')
ax3.axis('off')
ax1.title.set_text('input image')
ax2.title.set_text(text)
return fig