我正在关注这个漂亮的笔记本,以了解我的模型正在学习什么: https://github.com/fchollet/deep-learning-with-python-notebooks/blob/master/5.4-visualizing-what-convnets-learn.ipynb
问题是当我绘制热图时,我拥有与github上相同的图像(即黄色显示了模型用于评估类的部分)
heatmap = np.maximum(heatmap, 0) heatmap /= np.max(heatmap)
plt.matshow(heatmap) plt.show()
但是当我执行以下操作时,就像github一样:
# We use cv2 to load the original image
img = img_aug
# We resize the heatmap to have the same size as the original image
heatmap = cv2.resize(heatmap, (img.shape[1], img.shape[0]))
# We convert the heatmap to RGB
heatmap = np.uint8(255 * heatmap)
# We apply the heatmap to the original image
heatmap = cv2.applyColorMap(heatmap, cv2.COLORMAP_JET)
# 0.4 here is a heatmap intensity factor
superimposed_img = heatmap * 0.4 + img
plt.imshow(superimposed_img.astype(int));
我有一张图像,现在网络正在查看的部分是蓝色的(与第一张图片相比颜色是相反的),而在github中,它仍然像初始的热图。我想我在那儿错过了一个细节。...谁能给我一个提示吗? 非常感谢你!