PaDiM-Anomaly-Detection-Localization-master
PaDiM-Anomaly-Detection-Localization-master copied to clipboard
Apply PaDiM to another domain.
Hi I'm sangkyu from south korea.
I am trying to apply PaDiM to another domain.
Several issues arose during application.
I want to do anomaly detection with an image of size 80x160x3. The score distribution of the normal image tends to be higher than that of the abnormal image. I know that PaDiM is sensitive to the location, and the background was also erased with contours to minimize the background effect. However, the distribution of normal scores is still high. Can you leave any comments on this?
I applied on another domain, was fine, can you increase the resolution: make your image size: 160 x160
I applied on another domain, was fine, can you increase the resolution: make your image size: 160 x160
I've already tried to make image resolution as 160x160 by padding. but it didn't work properly. Are you talking about to make images to 160x160 by resizing????
Heat maps are relative to the image data. example) nomal data = 0,0,0,1,2(red),1,1,4(red),2(red),1,... anomaly data = 0,0,0,1,2,1,1,14(red),2,1,16(red),... Are you check threshold? need gt mask
I'm taking about heatmap result. i think normal data has to be covered by blue but it has abnormal points which is colored by red. I don't need gt masks because I'm gonna shift threshold by circumstances.
In the case of normal image, even if there is little data deviation, it is expressed red in the heat map. This is because heat maps make data normalize. You'd better check it a score map.
Thanks for replying! I modified the code a lot. heat map is in range 0 to 1, and score map 0 to 1 has proper value.. and I compared normal and abnormal image's distribution. I found nothing wrong with normalize.
because of this code norm = matplotlib.colors.Normalize(vmin=vmin, vmax=vmax)
if you change ax = ax_img[2].imshow(heat_map, cmap='jet', norm=None)
You will see the range of color bar range changing.
However, because heat maps are relative to the data, the high data will still look red.
easy to trick heatmap
heat_map = scores[i] * 255 <--below this code heat_map[0] = vmax <-- write
because of this code norm = matplotlib.colors.Normalize(vmin=vmin, vmax=vmax)
if you change ax = ax_img[2].imshow(heat_map, cmap='jet', norm=None)
You will see the range of color bar range changing.
However, because heat maps are relative to the data, the high data will still look red.
easy to trick heatmap
heat_map = scores[i] * 255 <--below this code heat_map[0] = vmax <-- write
like I said, I checked score maps of normal and abnormal data, it was not heat map range problem. I fixed heat map range with static number
It doesn't mean anything to fix the heat map range.
This is because when displaying image data in matplot, scale up to range.
The scale should be prevented by putting the max value into the image data.
Have you tested it like below?
- heat_map[0] = vmax
I'm sorry if it wasn't the answer you wanted.
Try to swap this lines: mask[mask > threshold] = 1 mask[mask <= threshold] = 0 like this: mask[mask <= threshold] = 0 mask[mask > threshold] = 1
If threshold is too high (>1), then some mask values become 1 then all mask values become 0 (as all values will be under threshold)