marco-rudolph / cs-flow

This is the official repository to the WACV 2022 paper "Fully Convolutional Cross-Scale-Flows for Image-based Defect Detection" by Marco Rudolph, Tom Wehrbein, Bodo Rosenhahn and Bastian Wandt.
111 stars 30 forks source link

Why is the anomaly score z^2? #18

Closed BenediktAlkin closed 2 years ago

BenediktAlkin commented 2 years ago

Hi!

I've been playing around with DifferNet and CS-Flow and am wondering why the anomaly score is set equal to z^2.

z^2 is basically the likelihood that z comes from a standard normal distribution, but the model is anyway trained with the likelihood of the input sample on the data distribution. Shouldn't the data likelihood (as calculated here) be a better anomaly score since we don't necessarily care about how well the transformed input sample is of a normal distribution, but how likely it is that an input sample is of the real data distribution?

I tried using the data likelihood as anomaly score and while it didn't really change the results for MVTec, it greatly improved (by up to 0.1 AUC) the performance on another dataset.

marco-rudolph commented 2 years ago

In fact, it would theoretically make sense to include the Jacobian. However, in our experiments, this has been found to degrade performance in some cases. Apparently, however, there are also cases where it is helpful to use it.

BenediktAlkin commented 2 years ago

I see, thanks for your quick response!