Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is the PatchCore image-level anomaly score correctly calculated? #286

Closed
StefanoSamele-PoliMi opened this issue Apr 27, 2022 · 3 comments · Fixed by #580
Closed

Is the PatchCore image-level anomaly score correctly calculated? #286

StefanoSamele-PoliMi opened this issue Apr 27, 2022 · 3 comments · Fixed by #580
Assignees
Labels

Comments

@StefanoSamele-PoliMi
Copy link

We have found a significant difference between the implementation proposed and the one described in the paper, for the PatchCore image-level anomaly score calculation.

For a test image , they first calculate the maximum distance score as:

Screenshot 2022-04-26 at 16 36 19

where is the set of patches of image and the memory bank.

They then apply a re-weighting factor to take into account if the patch is far from neighboring samples and thereby
an already rare nominal occurrence.

Screenshot 2022-04-26 at 16 17 38

We underline that are the nearest neighbors of in the memory bank. In your implementation instead, you weigh according to the nearest neighbors of , choosing the distance from the furthest element as numerator, and the distances from the others as denominator.

We have tested the two scoring methods (the original one and the one proposed in this repository) on a custom dataset and no differences were registered in terms of AUCROC score. We are currently testing on some MVTEC classes.

@samet-akcay
Copy link
Contributor

Thanks @StefanoSamele-PoliMi! We'll check it out

@lorenzomammana
Copy link

Adding to the discussion, if you aren't aware patchcore authors updated their paper on arxiv and upload the official implementation of the algorithm, apparently it performs even better than the result reported by you (99.2 compared to 98.0 avg) with the wide resnet 50. If you have time might be worth checking it out!
https://github.com/amazon-research/patchcore-inspection

@cyj95
Copy link

cyj95 commented Aug 23, 2022

In official patchcore work, the performance is Patchcore(99.1,98.1).
But your work get (98.0,98.0),which is lower than official.
Why is that ? Is there any problem about the score calculation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants