dhkdnduq / PatchCore_anomaly_detection

Unofficial implementation of PatchCore anomaly detection
Apache License 2.0
25 stars 4 forks source link

First thank you for your code. May I have a question for Anomaly Detection with PatchCore? #11

Open Williamyichang opened 2 years ago

Williamyichang commented 2 years ago

In your code, I didn't find any implement for below formula, if no need this code , Could a little bit explain? image image

dhkdnduq commented 2 years ago

When training, the maximum mean and minimum mean values of all images are obtained and stored. It is used for thresholds for determining abnormalities or create heat map

Look at this. def analyze_data(self):

double maxscore = cfg.vanomaly[category].anomalyMaxScore; double minscore = cfg.vanomaly[category].anomalyMinScore;

Williamyichang commented 2 years ago

When training, the maximum mean and minimum mean values of all images are obtained and stored. It is used for thresholds for determining abnormalities or create heat map

Look at this. def analyze_data(self):

double maxscore = cfg.vanomaly[category].anomalyMaxScore; double minscore = cfg.vanomaly[category].anomalyMinScore;

Thank you for your reply, May I have one more questions? Is the code "scores = (score_pathces - min_score) / (max_score - min_score)" is equal to below formula? image

dhkdnduq commented 2 years ago

Thank you for your reply, May I have one more questions? Is the code "scores = (score_pathces - min_score) / (max_score - min_score)" is equal to below formula?

No.It's for the heat map.

There is no GT in the industry. Therefore, the value of the patch scores was used.

score_patches = knn(torch.from_numpy(embedding_test).cuda())[0].cpu().detach().numpy() np.mean(score_patches ) *Require precise processing of data depending on the situation

Then, find the threshold value between OK and NG data through "Find_Optimal_Cutoff."

Williamyichang commented 2 years ago

Thank you for the explanation. I need take time to digest.