INNER CODE UNIT · Python
m_masked
patrickjohncyh/fashion-clip · fashion_clip/attention_map.py:59
m_masked = image * m + gray * m_bar
m_masked = m_masked.astype(np.uint8)
image_crops.append(Image.fromarray(m_masked))
masks.append(m)
return image_crops, masks
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')