nuclearboy95 / Anomaly-Detection-PatchSVDD-PyTorch

246 stars 56 forks source link

How to distinguish good and bad cases? #9

Open RaidenCJ opened 3 years ago

RaidenCJ commented 3 years ago

Hello, author, Thank you for your greate work! I have one question when trying "python main_visualize.py --obj=bottle" The good case visualize the following picture: n077 It looks like all red, In parellel the bad cases always visualize part of red in result picture as following: n037

So I 'd like to know how to distinguish good and bad cases? Thank you so much!

nuclearboy95 commented 3 years ago

I think that the anomaly map is not normalized before plt.imshow() is called.

I presume that the following line is called in an inappropriate way. https://github.com/nuclearboy95/Anomaly-Detection-PatchSVDD-PyTorch/blob/934d6238e5e0ad511e2a0e7fc4f4899010e7d892/main_visualize.py#L30.

jcthink commented 3 years ago

Hi Thanks for the great work. I am also facing the same issue. For the defected images anomaly score maps is looking good like spotting the defects (dark red color) on correct area. But for the good images it looks like almost red. So while testing it would be difficult to identify the given test image as good or bad. Looking forward for your solution for the same.

nuclearboy95 commented 3 years ago

Hi The reason is that the anomaly map is not properly normalized. The anomaly maps should be max-normalized using maximum anomaly score of the whole images in the same class. Without such manual max-normalization, matplotlib would normalize the map with the maximum anomaly score of the specific anomaly map, which may result in a almost-red image.

MuchmorePatience commented 3 years ago

Hello, I am also facing the same issue. Have you resolved the problem? Looking forward to your solution for the same issue.

MuchmorePatience commented 3 years ago

@jcthink Hi do you resolve this issue?I am also facing the same issue. Hope your reply.

jcthink commented 3 years ago

@MuchmorePatience Hi Not yet found a good solution.

MuchmorePatience commented 3 years ago

@jcthink OK ,Thanks anyway. Hope to keep in touch if u find a good solution.

jcthink commented 3 years ago

@MuchmorePatience Sure