DRAEM icon indicating copy to clipboard operation
DRAEM copied to clipboard

How to make a heatmap?

Open VivizSun opened this issue 3 years ago • 5 comments

Hello How do I generate a heatmap in test_DRAEM.py when I predict data?

VivizSun avatar Feb 16 '22 05:02 VivizSun

@VivizSun have do ou reslove that problem? if you solved it, please guide me!

vuhungtvt2018 avatar Dec 26 '22 08:12 vuhungtvt2018

@VivizSun @vuhungtvt142 You can get the predicted Anomaly heatmap of the image by adding the following lines after line 103 : plt.imshow(out_mask_cv) plt.title('Predicted Anomaly Heatmap') plt.show()

This should display the heatmap for the image

hamzakhalil798 avatar Jan 02 '23 06:01 hamzakhalil798

@hamzakhalil798 Which directory does the predicted anomaly heatmap reside in as I only get these below as the output Figure(640x480) Figure(640x480) Figure(640x480) Figure(640x480) Figure(640x480) Figure(640x480) Figure(640x480) Figure(640x480) Figure(640x480) Figure(640x480) Figure(640x480)

Brym-Gyimah avatar Jan 15 '23 04:01 Brym-Gyimah

@Brym-Gyimah It doesn't save the heatmap , Instead displays the heatmaps. Are you running the code on jupyter or Colab? If yes use %matplotlib inline in the cell to see these figures. Or Else to save them in a directory You can use Plt.savefig("path_to_image/image_name.png") If you wanr to save heatmaps.

Eg

plt.imshow(out_mask_cv) plt.title('Predicted Anomaly Heatmap') Plt.savefig("results/image.png") plt.show()

Note: you will have to make a directory(results).

hamzakhalil798 avatar Jan 15 '23 05:01 hamzakhalil798

@hamzakhalil798 Hello, according to the code you provided, I have successfully generated a heatmap, but the color of the heatmap is dark purple, which is not conducive to observation. How can I modify it to change the color of the heatmap?

xin94wang avatar Aug 23 '24 08:08 xin94wang