Open violet2422 opened 2 years ago
博主您好,很欣赏您的这个项目,特征图可视化过程有一些疑惑? 1、为何要reshape为(3.-1)np.reshape(sub_output, [b, 3, -1, h, w]) 2、为何要在取score的时候只取最后一个维度的索引为4的部分并进行sigmoid再求max?np.max(sigmoid(sub_output[..., 4]), -1) 以下是代码部分,或者您可以点击这里进入原代码部分
np.reshape(sub_output, [b, 3, -1, h, w])
np.max(sigmoid(sub_output[..., 4]), -1)
plt.imshow(image, alpha=1) plt.axis('off') mask = np.zeros((image.size[1], image.size[0])) for sub_output in outputs: sub_output = sub_output.cpu().numpy() b, c, h, w = np.shape(sub_output) sub_output = np.transpose(np.reshape(sub_output, [b, 3, -1, h, w]), [0, 3, 4, 1, 2])[0] score = np.max(sigmoid(sub_output[..., 4]), -1) score = cv2.resize(score, (image.size[0], image.size[1])) normed_score = (score * 255).astype('uint8') mask = np.maximum(mask, normed_score) plt.imshow(mask, alpha=0.5, interpolation='nearest', cmap="jet") plt.axis('off') plt.subplots_adjust(top=1, bottom=0, right=1, left=0, hspace=0, wspace=0) plt.margins(0, 0) plt.savefig(heatmap_save_path, dpi=200, bbox_inches='tight', pad_inches = -0.1) print("Save to the " + heatmap_save_path) plt.show()
非常感谢您的解答!!!😊
-1是每个先眼框的属性
这个不是热力图吗,只取得分最高的种类
不好意思,由于我的失误,没有看到在输出层做的特征图mask操作,误以为在主干或者颈部网络的某一层抽取特征图做的mask,谢谢您的解答!👏
好的
博主您好,很欣赏您的这个项目,特征图可视化过程有一些疑惑? 1、为何要reshape为(3.-1)
np.reshape(sub_output, [b, 3, -1, h, w])
2、为何要在取score的时候只取最后一个维度的索引为4的部分并进行sigmoid再求max?np.max(sigmoid(sub_output[..., 4]), -1)
以下是代码部分,或者您可以点击这里进入原代码部分非常感谢您的解答!!!😊