QueryDet-PyTorch icon indicating copy to clipboard operation
QueryDet-PyTorch copied to clipboard

请问如何可视化热力图啊

Open liuw20 opened this issue 1 year ago • 2 comments

liuw20 avatar Apr 23 '24 03:04 liuw20

请问你解决了吗?

judycpChen avatar May 04 '24 13:05 judycpChen

Hi, you can visualize the heatmap with the following steps:

  1. summing the feature map, e.g., the last layer of the small object classification branch, along its channel dimension
  2. normalize the feature map to (0~1) by normed_feature = (feature.max() - feature) / (feature.max() - feature.min())
  3. resize the feature map to the image size with bilinear interpolation
  4. convert the normalized feature map to an RGB map. Here is a simple example.
  5. combine the computed RGB map with the original image for the final visualization. For example: vis = (0.5 * image + 0.5 * rgb_map).astype(np.uint8)

The above steps are used to visualize intermediate feature maps. However, it's easier and more straightforward to visualize the small object detection heatmap. You can skip the first two steps and use the sigmoid result as the normalized map.

ChenhongyiYang avatar May 04 '24 13:05 ChenhongyiYang