amazon-science / patchcore-inspection

Apache License 2.0
779 stars 154 forks source link

Anomaly score calculation is different from the paper #54

Open nuclearboy95 opened 1 year ago

nuclearboy95 commented 1 year ago

The anomaly score is calculated using softmax of query distances (Eq (7) of the paper), but the code omits the process.

davnn commented 1 year ago

Appears to be a duplicate of https://github.com/amazon-science/patchcore-inspection/issues/27.

In general, I would be interested, how Eq (7) should be interpreted. Given m^{test,*} is the patch with the largest distance to its nearest neighbor in the memory bank and m^* is said nearest neighbor patch in the memory bank; then s^* is the distance between those patches (a scalar). What does it mean to weigh a scalar? The Softmax expression would result in a weighing vector, but how do you weigh a scalar with that?