hcw-00 / PatchCore_anomaly_detection

Unofficial implementation of PatchCore anomaly detection
Apache License 2.0
317 stars 93 forks source link

Trivial use of AdaptiveAvgPool2d #3

Closed rvorias closed 3 years ago

rvorias commented 3 years ago

https://github.com/hcw-00/PatchCore_anomaly_detection/blob/ded157b8546bd71338b89a47d6ee5a872f382b14/train.py#L295

AdaptiveAvgPool is applied to each feature map on the same scale due to feature[0].shape[-2:] This means that nothing happens to the feature maps.

If you want to rescale the second feature maps to the first, I guess you could use features[0].shape[-2:]

Furthermore, even if you would use the suggestion above, you still don't apply any aggregation function f_agg to the first feature maps (as described in the paper). Shouldn't you use AvgPool2d in order to actually aggregate information from nearby patches?

hcw-00 commented 3 years ago

I missed that point. I'm gonna replace AdaptiveAvgPool2d as AvgPool2d and update all results. Thanks!

hcw-00 commented 3 years ago

I updated code&score table. Now It seems scores are comparable to the paper's. Thanks a lot.